RobustNormalVariate#

class chemotools.scatter.RobustNormalVariate(percentile: float = 25, epsilon: float = 1e-10)[源代码]

基类:TransformerMixin, OneToOneFeatureMixin, BaseEstimator

A transformer that calculates the robust normal variate of the input data.

参数:
  • percentile (float, optional, default=25) -- The percentile to use for the robust normal variate. The value should be between 0 and 100. The default is 25.

  • epsilon (float, optional, default=1e-10) -- A small value added to the denominator to avoid numerical instability (division by zero). The default is 1e-10.

变量:

n_features_in (int) -- The number of features in the training data.

抛出:

UserWarning -- If the standard deviation of the values below the specified percentile is zero, a warning and a small epsilon is added to the denominator to avoid NaNs.

引用

[1] Q. Guo, W. Wu, D.L. Massart.

"The robust normal variate transform for pattern recognition with near-infrared data." doi:10.1016/S0003-2670(98)00737-5

示例

>>> from chemotools.datasets import load_fermentation_train
>>> from chemotools.scatter import RobustNormalVariate
>>> # Load sample data
>>> X, _ = load_fermentation_train()
>>> # Initialize RobustNormalVariate
>>> rnv = RobustNormalVariate()
RobustNormalVariate()
>>> # Fit and transform the data
>>> X_scaled = rnv.fit_transform(X)
fit(X: ndarray, y=None) RobustNormalVariate[源代码]

Fit the transformer to the input data.

参数:
  • X (np.ndarray of shape (n_samples, n_features)) -- The input data to fit the transformer to.

  • y (None) -- Ignored to align with API.

返回:

self -- The fitted transformer.

返回类型:

RobustNormalVariate

transform(X: ndarray, y=None) ndarray[源代码]

Transform the input data by calculating the standard normal variate.

参数:
  • X (np.ndarray of shape (n_samples, n_features)) -- The input data to transform.

  • y (None) -- Ignored to align with API.

返回:

X_transformed -- The transformed data.

返回类型:

np.ndarray of shape (n_samples, n_features)