Создание классов

Пример создания

class classname:

 

def fit(self, features, target):

    self.value = target_train.mean()

 

def predict(self, new_features):

    new_prediction = pd.Series(self.value, index=new_features.index)

    return new_prediction

 

Пример использования

model = classname()

model.fit(features, target)

new_predictions = model.predict(features_test)

print(new_predictions)