Home
API
Examples
Github
Home
API
Examples
Github
  • API

    • cluster

      • KMeans
    • datasets

      • Boston
      • HeartDisease
      • Iris
    • decomposition

      • PCA
    • ensemble

      • BaggingClassifier
      • RandomForestClassifier
    • feature_extraction

      • CountVectorizer
    • linear_model

      • Lasso
      • LinearRegression
      • LogisticRegression
      • Ridge
      • SGDClassifier
      • SGDRegressor
    • metrics

      • accuracyScore
      • confusion_matrix
      • mean_absolute_error
      • mean_squared_error
      • mean_squared_log_error
      • zeroOneLoss
    • model_selection

      • KFold
      • train_test_split
    • naive_bayes

      • GaussianNB
      • MultinomialNB
    • neighbors

      • KNeighborsClassifier
    • preprocessing

      • Binarizer
      • Imputer
      • LabelEncoder
      • MinMaxScaler
      • OneHotEncoder
      • PolynomialFeatures
      • add_dummy_feature
      • normalize
    • svm

      • BaseSVM
      • NuSVC
      • NuSVR
      • OneClassSVM
      • SVC
      • SVR
    • tree

      • DecisionTreeClassifier

preprocessing.Binarizer

Usage

import { Binarizer } from 'machinelearn/preprocessing';

const binX = [[1, -1, 2], [2, 0, 0], [0, 1, -1]];
const binarizer = new Binarizer({ threshold: 0 });
const result = binarizer.transform(binX);
// [ [ 1, 0, 1 ], [ 1, 0, 0 ], [ 0, 1, 0 ] ]

Constructors

  • constructor

Methods

  • fit

  • transform

Constructors


constructor

⊕ Binarizer(__namedParameters: `object`)

Defined in preprocessing/data.ts:520

Parameters:

ParamTypeDefaultDescription
options.copybooleantrue
options.thresholdnumber0

Returns: Binarizer

Methods


λ fit

Currently fit does nothing

Defined in preprocessing/data.ts:543

Parameters:

ParamTypeDefaultDescription
Xnumber[][]nullDoes nothing

Returns:

void

λ transform

Transforms matrix into binarized form X = [[ 1., -1., 2.], [ 2., 0., 0.], [ 0., 1., -1.]] becomes array([[ 1., 0., 1.], [ 1., 0., 0.], [ 0., 1., 0.]])

Defined in preprocessing/data.ts:562

Parameters:

ParamTypeDefaultDescription
Xnumber[][]nullThe data to binarize.

Returns:

any[]

Next
Imputer