discretefirstorder.DFORegressor¶
- class discretefirstorder.DFORegressor(loss='mse', learning_rate='auto', k=1, polish=True, n_runs=50, max_iter=100, tol=0.001, fit_intercept=True, normalize=True, random_state=None)[source]¶
Discrete first-order regressor.
- Parameters:
- lossstr
type of loss to be minimized. One of ‘mse’ or ‘mae’.
- learning_ratestr or float
learning rate to be used.
- kint
number of non-zero features to keep.
- polishbool
whether to polish coefficients by running least squares on the active set.
- n_runsint
number of runs of the discrete first order optimization procedure.
- max_iterint
maximum number of steps to take during one run of the discrete first order optimization algorithm.
- tolfloat
tolerance below which the optimization algorithm stops.
- fit_interceptbool
whether to fit an intercept term
- normalizebool
whether to normalize the input data.
Examples
>>> from discretefirstorder import DFORegressor >>> import numpy as np >>> X = np.arange(100).reshape(100, 1) >>> y = np.random.normal(size=(100, )) >>> estimator = DFORegressor() >>> estimator.fit(X, y) DFORegressor()
- Attributes:
- coef_ndarray, shape (n_features,)
coefficient vector.
- intercept_float
intercept.
- __init__(loss='mse', learning_rate='auto', k=1, polish=True, n_runs=50, max_iter=100, tol=0.001, fit_intercept=True, normalize=True, random_state=None)[source]¶
- fit(X, y, coef_init=None)[source]¶
Implementation of the fit method for the discrete first-order regressor.
- Parameters:
- Xarray-like of shape (n_samples, n_features)
the training input samples.
- yarray-like of shape (n_samples,)
the target values.
- coef_init(optional) array-like of shape (n_features,)
initial value of regression coefficients
- Returns:
- selfobject
Returns self.