/** * @license * Copyright 2021, JsData. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================================== */ import { TransformerMixin } from '../mixins'; import { Scikit2D, Tensor1D, Tensor2D } from '../types'; /** MaxAbsScaler scales the data by dividing by the max absolute value that it finds per feature. * It's a useful scaling if you wish to keep sparsity in your dataset. * * @example * ```js * import { MaxAbsScaler } from 'scikitjs' * * const scaler = new MaxAbsScaler() const data = [ [-1, 5], [-0.5, 5], [0, 10], [1, 10] ] const expected = scaler.fitTransform(data) const above = [ [-1, 0.5], [-0.5, 0.5], [0, 1], [1, 1] ] * * ``` */ export declare class MaxAbsScaler extends TransformerMixin { /** The per-feature scale that we see in the dataset. We divide by this number. */ scale: Tensor1D; /** The number of features seen during fit */ nFeaturesIn: number; /** The number of samples processed by the Estimator. Will be reset on new calls to fit */ nSamplesSeen: number; /** Names of features seen during fit. Only stores feature names if input is a DataFrame */ featureNamesIn: Array; /** Useful for pipelines and column transformers to have a default name for transforms */ name: string; constructor(); /** * Fits a MinMaxScaler to the data */ fit(X: Scikit2D): MaxAbsScaler; /** * Transform the data using the fitted scaler */ transform(X: Scikit2D): Tensor2D; /** * Inverse transform the data using the fitted scaler */ inverseTransform(X: Scikit2D): Tensor2D; }