RogueWave

imsl.regression.LogisticRegression.fit

LogisticRegression.fit(x, y, update=False, guess=None, tol=None, max_iter=20)

Fit or update the logistic regression model using the given data.

Parameters:

x : (n_obs,) or (n_obs,n_predictors) array_like

Array containing n_obs samples of the n_predictors predictor variables.

y : Object

An object of type ResponseFormatRef, ResponseFormatID or ResponseFormatAll, containing information on the responses corresponding to the predictor variables. Essentially, from y attribute class_counts_matrix, the n_obs by n_classes matrix containing the response counts, is used.

update : bool, optional

If True, method fit updates the actual logistic regression fit by generating a fit to the new data x, y and aggregating it with the existing fit. If False, method fit replaces the current fit with a new fit based on the training data x, y.

Default: update = False.

guess : (n_classes,) or (n_classes, n_coeffs) array_like, optional

Initial guess of the regression coefficients. Here, n_coeffs = n_predictors+n_x_interact if no intercept term is included, and n_coeffs = n_predictors+n_x_interact+1 if an intercept term is included.

By default, an initial guess is computed internally.

tol : float, optional

Convergence tolerance. Iteration completes when the normed difference between successive estimates is less than tol or max_iter iterations are reached.

Default: tol = 100.0 * eps, where eps denotes machine epsilon.

max_iter : int, optional

The maximum number of iterations.

Notes

The iteration stops when the estimates converge within tolerance, when maximum iterations are reached, or when the gradient converges within tolerance, whichever event occurs first. When the gradient converges before the coefficient estimates converge, a condition in the data known as complete or quasi-complete separation may be present. Separation in the data means that one or more independent variables perfectly predicts the response. When detected, the method stops the iteration, issues a warning, and returns the current values of the model estimates. Some of the coefficient estimates and standard errors may not be reliable. Furthermore, overflow issues may occur before the gradient converges. In such cases, the method throws an exception.