/** * @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 { Scikit2D, Tensor1D, Tensor2D } from '../types'; import { TransformerMixin } from '../mixins'; export interface RobustScalerParams { /**Quantile range used to calculate scale_. By default this is equal to the IQR, i.e., * q_min is the first quantile and q_max is the third quantile. * Numbers must be between 0, and 100. **default [25.0, 75.0]** */ quantileRange?: [number, number]; /** Whether or not we should scale the data. **default = true** */ withScaling?: boolean; /** Whether or not we should center the data. **default = true** */ withCentering?: boolean; } /** * Scales the data but is robust to outliers. While StandardScaler will subtract the mean, and * divide by the variance, both of those measures are not robust to outliers. So instead of the mean * we use the median, and instead of the variance we use the Interquartile Range (which is the distance * between the quantile .25, and quantile .75). * * @example * ```js * import { RobustScaler } from 'scikitjs' * const X = [ [1, -2, 2], [-2, 1, 3], [4, 1, -2] ] const scaler = new RobustScaler() scaler.fitTransform(X) const result = [ [0, -2, 0], [-1, 0, 0.4], [1, 0, -1.6] ] * ``` */ export declare class RobustScaler extends TransformerMixin { /** The per-feature scale that we see in the dataset. We divide by this number. */ scale: Tensor1D; /** The per-feature median that we see in the dataset. We subtrace this number. */ center: Tensor1D; /** The number of features seen during fit */ nFeaturesIn: number; /** Names of features seen during fit. Only stores feature names if input is a DataFrame */ featureNamesIn: Array; quantileRange: [number, number]; withScaling: boolean; withCentering: boolean; /** Useful for pipelines and column transformers to have a default name for transforms */ name: string; constructor({ quantileRange, withCentering, withScaling }?: RobustScalerParams); isNumber(value: any): boolean; fit(X: Scikit2D): RobustScaler; transform(X: Scikit2D): Tensor2D; inverseTransform(X: Scikit2D): Tensor2D; }