-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "solver" and "max_iter" parameters to class LogisticRegression #435
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a5ca541
Add "solver" and "max_iter" parameters to class LogisticRegression
dSerna4 5b511ce
Merge branch 'develop' into feature/logisticRegression
dSerna4 30a529d
Change end of line character to \n
dSerna4 94840a8
Update _logistic_regression.py
dSerna4 f4e5c1d
Correct str type hint
dSerna4 8f047b2
Correct format issues (hopefully)
dSerna4 b14ae14
Merge branch 'develop' into feature/logisticRegression
vnmabus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,12 @@ class LogisticRegression( | |
p: | ||
number of points (and coefficients) to be selected by | ||
the algorithm. | ||
solver: | ||
Algorithm to use in the multivariate logistic regresion | ||
optimization problem. For more info check the parameter | ||
"solver" in sklearn.linear_model.LogisticRegression. | ||
max_iter: | ||
Maximum number of iterations taken for the solver to converge. | ||
|
||
Attributes: | ||
classes\_: A list containing the name of the classes | ||
|
@@ -73,9 +79,13 @@ class LogisticRegression( | |
def __init__( | ||
self, | ||
p: int = 5, | ||
solver: str = 'lbfgs', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should have a |
||
max_iter: int = 100, | ||
) -> None: | ||
|
||
self.p = p | ||
self.max_iter = 100 | ||
self.solver = solver | ||
|
||
def fit( # noqa: D102 | ||
self, | ||
|
@@ -93,7 +103,11 @@ def fit( # noqa: D102 | |
selected_indexes = np.zeros(self.p, dtype=np.intc) | ||
|
||
# multivariate logistic regression | ||
mvlr = mvLogisticRegression(penalty='l2') | ||
mvlr = mvLogisticRegression( | ||
penalty='l2', | ||
solver=self.solver, | ||
max_iter=self.max_iter, | ||
) | ||
|
||
x_mv = np.zeros((n_samples, self.p)) | ||
LL = np.zeros(n_features) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
W291 trailing whitespace