Skip to content

igl.models

scikit-learn-compatible estimators: classifier, regressor, autoencoder.

igl.models.classifier.IGLClassifier

Bases: _BaseIGLEstimator[CrossEntropyLoss], ClassifierMixin

scikit-learn-compatible classifier built on :class:igl.IGLModule.

Parameters:

Name Type Description Default
max_dim int

Latent dimension d_max for Matryoshka truncation.

16
n_anchors int | None

Anchor count. None defers to config or default 64.

None
n_scales int | None

Scale count. None defers to config or 4.

None
operator OperatorNameLike | None

Kernel operator. None defers to config or OperatorName.GAUSSIAN.

None
normalize NormalizeModeLike | None

Φ-normalization mode.

None
encoder_hidden int | tuple[int, ...] | None

Encoder hidden shorthand (int for uniform width, tuple for per-layer widths).

None
encoder_depth int | None

Encoder depth shorthand.

None
config IGLConfig | None

Optional :class:igl.IGLConfig. Explicit kwargs override it.

None
random_state int | None

Optional integer seed for reproducible training.

None
validation_fraction float | None

If set, hold out this fraction of training data for early-stopping and dimension-curve evaluation.

0.2

Attributes:

Name Type Description
classes_

Sorted unique training labels.

n_features_in_

Ambient input dimension seen during fit.

module_

The underlying :class:igl.IGLModule.

history_

:class:igl.TrainingHistory from the trainer.

dimension_curve_

{k: error_rate} from :func:igl.eval_dimension_curve post-fit.

effective_dimension_

Detected elbow k (the discovered d_eff).

scaler_

:class:sklearn.preprocessing.StandardScaler used on inputs.

fit(x, y)

Fit the classifier on (x, y).

predict(x)

Predict class labels for x.

predict_proba(x)

Predict class probabilities for x.

igl.models.regressor.IGLRegressor

Bases: _BaseIGLEstimator[MSELoss], RegressorMixin

scikit-learn-compatible regressor.

Supports scalar and multi-output regression. Targets y may be a 1-D array ([n_samples]) for scalar regression, or 2-D ([n_samples, n_outputs]) for multi-output. The output dimension is inferred from y in :meth:fit.

Args mirror :class:IGLClassifier except for validation_fraction.

Attributes:

Name Type Description
n_features_in_

Ambient input dimension seen during fit.

n_outputs_

Number of output dimensions inferred from y.

module_

The underlying :class:igl.IGLModule.

history_

:class:igl.TrainingHistory from the trainer.

dimension_curve_

{k: mse} from :func:igl.eval_dimension_curve.

effective_dimension_

Discovered d_eff.

scaler_

:class:sklearn.preprocessing.StandardScaler.

fit(x, y)

Fit the regressor on (x, y).

predict(x)

Predict targets for x. Returns 1-D if fit with scalar targets.

igl.models.autoencoder.IGLAutoencoder

Bases: _BaseIGLEstimator[MSELoss], TransformerMixin

Train an IGL model with y = x (reconstruction).

The :meth:fit method ignores its y argument and uses x as both input and target.

Attributes:

Name Type Description
n_features_in_

Ambient input dimension.

n_outputs_

Equal to n_features_in_.

module_

The underlying :class:igl.IGLModule.

history_, (dimension_curve_, effective_dimension_, scaler_)

same as :class:IGLRegressor.

fit(x, y=None)

Fit the autoencoder. y is ignored; the scaled x is the target.

Reconstruction is therefore measured in the StandardScaler-scaled feature space. :meth:reconstruct inverse-transforms back to the original feature space for users who need real-space outputs.

reconstruct(x)

Inverse-transform the reconstruction back to the original feature space.

transform(x)

Return the reconstructed input (in the scaled feature space).