[docs]classSkBaseRegressor(SkBaseLearner):""" Defines a custom regressor. """def__init__(self,**kwargs):""" constructor """SkBaseLearner.__init__(self,**kwargs)
[docs]defscore(self,X,y=None,sample_weight=None):""" Returns the mean accuracy on the given test data and labels. :param X: Training data, numpy array or sparse matrix of shape [n_samples,n_features] :param y: Target values, numpy array of shape [n_samples, n_targets] (optional) :param sample_weight: Weight values, numpy array of shape [n_samples, n_targets] (optional) :return: score : float, Mean accuracy of self.predict(X) wrt. y. """returnr2_score(y,self.predict(X),sample_weight=sample_weight)