def check(self,df):
if self.objective == "regression" or self.objective == "classification":
if self.input_type == "text":
if not self.text_field:
raise Exception("Please specify a text field")
else:
if not self.target:
raise Exception("Please specify a target field")
if len(self.fields) == 0:
raise Exception("Please specify at least one predictor field")
numericTarget = False
if df[self.target].dtype == np.number:
numericTarget = True
if self.objective == "regression" and not numericTarget:
raise Exception("Please use a numeric target field for the regression objective")
if self.objective == "classification" and numericTarget:
raise Exception("Please use a string target field for the classification objective")
elif self.objective == "time_series":
if not self.target:
raise Exception("Please specify a target field")
if not self.order_field:
raise Exception("Please specify an index field")
if df[self.target].dtype != np.number:
raise Exception("Please use a numeric target field for the time series objective")
else:
if len(self.fields) == 0:
raise Exception("Please specify at least one predictor field")
评论列表
文章目录