oraclesai.classification.SLXClassifier

class SLXClassifier(spatial_weights_definition=None, random_state=None, balance_method=None, balance_ratio=1.0)

Implementation of the SLX Logistic Regression model. Executes Logistic Regression involving a feature engineering step to add features that provide a spatial context to the data. The algorithm adds one or more columns with the spatial lag of certain features, representing the average from neighboring observations.

Parameters:
  • spatial_weights_definition – SpatialWeightsDefinition, default=None. Establishes the interaction between neighboring observations.

  • random_state – RandomState instance or None, default=None. Determines random number generation.

  • balance_method – {None, ‘random’, ‘smote’}. The method chosen to balance the dataset. ‘random’ creates duplicates from random samples (with replacement) from the minority class. ‘smote’ selects a random sample from the minority class, A, and from its k nearest neighbors, it selects a random neighbor, B. The vector AB is multiplied by a random number in the range [0, 1], and the result is added to A, generating a new synthetic instance.

  • balance_ratio – float, default=1.0. A number between 0 and 1 representing the desired ratio of observations from minority classes during the balancing process. A value of 1 result in the same number of observations for both classes.

Methods

__init__([spatial_weights_definition, ...])

fit(X, y[, geometries, crs, ...])

Trains the SLX logistic regression model.

get_params([deep])

Get parameters for this estimator.

predict(X[, geometries, spatial_weights, ...])

Calculates the spatial lag of the dataset using the same columns defined in the fit process and returns the category with the highest probability according to Logistic Regression.

score(X, y[, sample_weight, geometries, ...])

Returns the accuracy of the model.

set_params(**params)

Set the parameters of this estimator.

Attributes

betas

returns:

An array with the estimated parameters for the trained model. For multi_class,

k

returns:

The number of variables for which coefficients are estimated (including the

model_type

returns:

The type of the classification model

predy

returns:

An array with the predictions for the training data. For multi_class, the

summary

returns:

A string containing statistics and estimated parameters of the fitted models.

u

returns:

An array with the residuals of the trained model