#!/usr/bin/env python3
from sklearn.metrics import r2_score
import numpy as np


class BaselineModel(object):
    def get_params(self):
        return None

    def predict(self, X):
        return np.ones_like(X.index.values) * self._y_pred

    def score(self, X, y):
        y_true = y
        y_pred = np.ones_like(y_true) * self._y_pred
        return r2_score(y_true, y_pred)


class BaselineClassificationPrediction(BaselineModel):
    def fit(
        self, X, y,
    ):
        self.y_pred = y.mode()
        return self

    def predict(
        self, X,
    ):
        return self.y_pred


class BaselineRegressionPrediction(BaselineModel):
    def fit(self, X, y):
        self._y_pred = y.median()
        return self

[(16, 'sklearn.metrics.r2_score', 'r2_score', False, 'from sklearn.metrics import r2_score\n'), (11, 'numpy.ones_like', 'np.ones_like', True, 'import numpy as np\n'), (15, 'numpy.ones_like', 'np.ones_like', True, 'import numpy as np\n')]