def fit(self, X, y):
X = np.asanyarray(X)
y = np.asanyarray(y)
# Selection
self.selector.fit(X, y)
self.selected_ = (np.abs(self.selector.coef_) >= self.threshold)
# Final Estimation
self.estimator.fit(X[:, self.selected_], y)
# Coefficients
self.coef_ = np.zeros_like(self.selector.coef_)
self.coef_[self.selected_] = self.estimator.coef_
self.intercept_ = self.estimator.intercept_
return self
评论列表
文章目录