tick.linear_model.
PoissonRegression
(step=0.001, fit_intercept=True, penalty='l2', C=1000.0, tol=1e-05, max_iter=100, solver='svrg', verbose=False, warm_start=False, print_every=10, record_every=1, elastic_net_ratio=0.95, random_state=None, blocks_start=None, blocks_length=None)[source]¶Poisson regression learner, with exponential link function.
It supports several solvers and several penalizations.
Note that for this model, there is no way to tune
automatically the step
of the solver. Thus, the default for step
might work, or not, so that several values should be tried out.
step : float
, default=1e-3
Step-size to be used for the solver. For Poisson regression there is no way to tune it automatically. The default tuning might work, or not…
C : float
, default=1e3
Level of penalization
penalty : {‘l1’, ‘l2’, ‘elasticnet’, ‘tv’}, default=’l2’
The penalization to use. Default is ridge penalization
solver : {‘gd’, ‘agd’, ‘bfgs’, ‘svrg’, ‘sgd’}, default=’svrg’
The name of the solver to use
fit_intercept : bool
, default=True
If
True
, include an intercept in the model
warm_start : bool
, default=False
If true, learning will start from the last reached solution
tol : float
, default=1e-6
The tolerance of the solver (iterations stop when the stopping criterion is below it). By default the solver does
max_iter
iterations
max_iter : int
, default=100
Maximum number of iterations of the solver
verbose : bool
, default=False
If
True
, we verbose things, otherwise the solver does not print anything (but records information in history anyway)
print_every : int
, default=10
Print history information when
n_iter
(iteration number) is a multiple ofprint_every
record_every : int
, default=1
Record history information when
n_iter
(iteration number) is a multiple ofrecord_every
weights : numpy.array
, shape=(n_features,)
The learned weights of the model (not including the intercept)
intercept : float
or None
The intercept, if
fit_intercept=True
, otherwiseNone
__init__
(step=0.001, fit_intercept=True, penalty='l2', C=1000.0, tol=1e-05, max_iter=100, solver='svrg', verbose=False, warm_start=False, print_every=10, record_every=1, elastic_net_ratio=0.95, random_state=None, blocks_start=None, blocks_length=None)¶decision_function
(X)[source]¶Decision function for given samples. This is simply given by the predicted means of each sample. Predicted mean in this model for a features vector x is simply given by exp(x.dot(weights) + intercept)
X : np.ndarray
or scipy.sparse.csr_matrix
, shape=(n_samples, n_features)
Features matrix
output : np.array
, shape=(n_samples,)
Value of the decision function of each sample points
fit
(X: object, y: numpy.array)[source]¶Fit the model according to the given training data.
X : np.ndarray
or scipy.sparse.csr_matrix
,, shape=(n_samples, n_features)
Training vector, where n_samples in the number of samples and n_features is the number of features.
y : np.array
, shape=(n_samples,)
Target vector relative to X.
self : PoissonRegression
The fitted instance of the model
get_params
()¶Get parameters for this estimator.
params : dict
Parameter names mapped to their values.
loglik
(X, y)[source]¶Compute the minus log-likelihood of the model, using the given features matrix and labels, with the intercept and model weights currently fitted in the object. Minus log-likelihood is computed, so that smaller is better.
X : np.ndarray
or scipy.sparse.csr_matrix
,, shape=(n_samples, n_features)
Features matrix
y : np.array
, shape=(n_samples,)
Labels vector relative to X
output : float
Value of the minus log-likelihood
predict
(X)[source]¶Predict label for given samples
X : np.ndarray
or scipy.sparse.csr_matrix
, shape=(n_samples, n_features)
Features matrix
output : np.array
, shape=(n_samples,)
Returns predicted labels
set_params
(**kwargs)¶Set the parameters for this learner.
**kwargs : :
Named arguments to update in the learner
output : LearnerGLM
self with updated parameters
tick.linear_model.PoissonRegression
¶