Skip to content

Commit

Permalink
Add attributes to optimizers
Browse files Browse the repository at this point in the history
  • Loading branch information
briandesilva committed May 4, 2020
1 parent b30047a commit 7f74d0a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
12 changes: 12 additions & 0 deletions pysindy/optimizers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ class BaseOptimizer(LinearRegression, ComplexityMixin):
copy_X : boolean, optional (default True)
If True, X will be copied; else, it may be overwritten.
Attributes
----------
coef_ : array, shape (n_features,) or (n_targets, n_features)
Weight vector(s).
ind_ : array, shape (n_features,) or (n_targets, n_features)
Array of 0s and 1s indicating which coefficients of the
weight vector have not been masked out.
history_ : list
History of ``coef_`` over iterations of the optimization algorithm.
"""

def __init__(self, max_iter=20, normalize=False, fit_intercept=False, copy_X=True):
Expand Down
5 changes: 5 additions & 0 deletions pysindy/optimizers/sr3.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ class SR3(BaseOptimizer):
Weight vector(s) that are not subjected to the regularization.
This is the w in the objective function.
history_ : list
History of sparse coefficients. ``history_[k]`` contains the
sparse coefficients (v in the optimization objective function)
at iteration k.
Examples
--------
>>> import numpy as np
Expand Down
6 changes: 5 additions & 1 deletion pysindy/optimizers/stlsq.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ class STLSQ(BaseOptimizer):
Attributes
----------
coef_ : array, shape (n_features,) or (n_targets, n_features)
Weight vector(s)
Weight vector(s).
ind_ : array, shape (n_features,) or (n_targets, n_features)
Array of 0s and 1s indicating which coefficients of the
weight vector have not been masked out.
history_ : list
History of ``coef_``. ``history_[k]`` contains the values of
``coef_`` at iteration k of sequentially thresholded least-squares.
Examples
--------
>>> import numpy as np
Expand Down

0 comments on commit 7f74d0a

Please sign in to comment.