Skip to content

Commit

Permalink
introduce sample weights
Browse files Browse the repository at this point in the history
  • Loading branch information
ccomkhj committed Nov 27, 2023
1 parent 185e463 commit 2973a73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def __init__(
self.max_coef_ = min_coef_
self.min_coef_ = max_coef_

def fit(self, X, y, min_coef=None, max_coef=None):
X, y, X_offset, y_offset, X_scale = self._preprocess(X, y)
def fit(self, X, y, min_coef=None, max_coef=None, sample_weight=None):
X, y, X_offset, y_offset, X_scale = self._preprocess(X, y, sample_weight)

original_feature_count = X.shape[-1]
self.min_coef_ = self._verify_coef(
Expand Down
4 changes: 2 additions & 2 deletions constrainedML/selective_drop_positive_linear_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
class SelectiveDropPositiveLinearRegression(BaseSelectiveDropPositiveLinearRegression):
""" """

def fit(self, X, y, min_coef=None, max_coef=None):
X, y, X_offset, y_offset, X_scale = self._preprocess(X, y)
def fit(self, X, y, min_coef=None, max_coef=None, sample_weight=None):
X, y, X_offset, y_offset, X_scale = self._preprocess(X, y, sample_weight)
feature_count = X.shape[-1]
self.min_coef_ = self._verify_coef(feature_count, min_coef, -np.inf).flatten()
self.max_coef_ = self._verify_coef(feature_count, max_coef, np.inf).flatten()
Expand Down

0 comments on commit 2973a73

Please sign in to comment.