当我尝试调用类的方法时遇到此错误。我不知道我要去哪里哪里
class KickstarterModel:
def __init__(self):
self.model = DecisionTreeClassifier()
self.X_train = None
self.y_train = None
def preprocess_training_data(self, df):
y_train = df['state'].apply(lambda x: 0 if x == 'failed' else 1)
numerical_columns = df.describe().columns
X = df[numerical_columns].copy()
X.set_index('id', inplace=True)
X["dif_launched_created"] = X.launched_at - X.created_at
X["dif_deadline_created"] = X.deadline - X.created_at
X["dif_deadline_launched"] = X.deadline - X.launched_at
X['goal_in_usd'] = X.goal * X.static_usd_rate
X.drop(['deadline', 'created_at', 'launched_at', 'goal', 'static_usd_rate'], axis=1, inplace=True)
X_train = X
y_train = y
错误消息:
NotImplementedError
Traceback (most recent call last)
<ipython-input-25-18acf6b32d72> in <module>()
1 model = KickstarterModel()
2
----> 3 model.preprocess_training_data(df)
~\OneDrive\Documents\Cambridge Spark\Module 3\model.py in preprocess_training_data(self, df)
7 self.y_train = None
8
----> 9
10 def preprocess_training_data(self, df):
11
NotImplementedError: