Menu

PyTorch toolbox to work with spherical surfaces.

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the gallery for the big picture.

class surfify.preprocessing.StandardScaler(mode='sub', mask=None, copy=True, with_mean=True, with_std=True)[source]

Bases: StandardScaler

Standardize features by removing the mean and scaling to unit variance.

Based on sklearn.preprocessing.StandardScaler.

Init scler.

Parameters:

mode : str, default=’sub’

the scaling mode, either ‘sub’ to operate at the subject level or ‘group’ to operate at the group level.

mask : array or str, default=None

mask the input data before scaling, i.e. normalize only vertices that are masked.

copy : bool, default=True

If False, try to avoid a copy and do inplace scaling instead. This is not guaranteed to always work inplace; e.g. if the data is not a NumPy array or scipy.sparse CSR matrix, a copy may still be returned.

with_mean : bool, default=True

If True, center the data before scaling. This does not work (and will raise an exception) when attempted on sparse matrices, because centering them entails building a dense matrix which in common use cases is likely to be too large to fit in memory.

with_std : bool, default=True

If True, scale the data to unit variance (or equivalently, unit standard deviation).

fit(X, y=None)[source]

Compute the mean and std to be used for later scaling.

Parameters:

X : {array-like, sparse matrix} of shape (n_subjects, n_vertices)

the data used to compute the mean and standard deviation used for later scaling along the features axis.

y : None

ignored.

Returns:

self : object

fitted scaler.

get_metadata_routing(*args, **kwargs)[source]

Get metadata routing of this object.

inverse_transform(X, copy=None)[source]

Scale back the data to the original representation.

Parameters:

X : {array-like, sparse matrix} of shape (n_subjects, n_vertices)

the data used to scale along the features axis.

copy : bool, default=None

copy the input X or not.

Returns:

X_tr : {ndarray, sparse matrix} of shape (n_subjects, n_vertices)

transformed array.

set_inverse_transform_request(*, copy: bool | None | str = '$UNCHANGED$') StandardScaler

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

copy : str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for copy parameter in inverse_transform.

Returns:

self : object

The updated object.

set_partial_fit_request(*, sample_weight: bool | None | str = '$UNCHANGED$') StandardScaler

Request metadata passed to the partial_fit method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to partial_fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to partial_fit.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

sample_weight : str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for sample_weight parameter in partial_fit.

Returns:

self : object

The updated object.

set_transform_request(*, copy: bool | None | str = '$UNCHANGED$') StandardScaler

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

New in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

copy : str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for copy parameter in transform.

Returns:

self : object

The updated object.

transform(X, copy=None)[source]

Perform standardization by centering and scaling.

Parameters:

X : {array-like, sparse matrix of shape (n_subjects, n_vertices)

the data used to scale along the features axis.

copy : bool, default=None

copy the input X or not.

Returns:

X_tr : {ndarray, sparse matrix} of shape (n_subjects, n_vertices)

transformed array.

Follow us

© 2025, surfify developers