PointScaler#
- class chemotools.scale.PointScaler(point: int = 0, x_axis: ndarray | None = None, wavenumbers='deprecated')[源代码]
基类:
XAxisMixin,TransformerMixin,OneToOneFeatureMixin,BaseEstimatorA transformer that scales the input data by the intensity value at a given point. The point can be specified by an index or by a wavenumber.
- 参数:
point (int, optional, default=0) -- The point to scale the data by. It can be an index or an x-axis value.
x_axis (array-like, optional, default=None) -- The x-axis values of the input data. If not provided, the indices will be used instead. Default is None. If provided, the values must be in ascending order.
wavenumbers (array-like, optional) -- Deprecated alias for
x_axis.
- 变量:
示例
>>> from chemotools.datasets import load_fermentation_train >>> from chemotools.scale import PointScaler >>> # Load sample data >>> X, _ = load_fermentation_train() >>> # Initialize PointScaler with point index >>> scaler = PointScaler(point=10) PointScaler(point=10, wavenumbers=None) >>> # Fit and transform the data >>> X_scaled = scaler.fit_transform(X)
- fit(X: ndarray, y=None) PointScaler[源代码]
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.
- 返回类型:
PointScaler
- transform(X: ndarray, y=None) ndarray[源代码]
Transform the input data by scaling by the value at a given Point.
- 参数:
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)