def fit(self, X, y, check_input=True):
self._label_binarizer = LabelBinarizer(pos_label=1, neg_label=-1)
Y = self._label_binarizer.fit_transform(y)
if self._label_binarizer.y_type_.startswith('multilabel'):
# we don't (yet) support multi-label classification in ENet
raise ValueError(
"%s doesn't support multi-label classification" % (
self.__class__.__name__))
# Y = column_or_1d(Y, warn=True)
super(ElasticNetClassifier, self).fit(X, Y)
if self.classes_.shape[0] > 2:
ndim = self.classes_.shape[0]
else:
ndim = 1
self.coef_ = self.coef_.reshape(ndim, -1)
return self
评论列表
文章目录