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

ensemble.BaggingClassifier

Usage

const classifier = new BaggingClassifier({
 baseEstimator: LogisticRegression,
 maxSamples: 1.0,
});
const X = [[1], [2], [3], [4], [5]];
const y = [1, 1, 1, 1, 1];
classifier.fit(X, y);
classifier.predict(X);

Constructors

  • constructor

Methods

  • fit

  • fromJSON

  • predict

  • toJSON

Constructors


constructor

⊕ BaggingClassifier(__namedParameters: `object`)

Defined in ensemble/bagging.ts:58

Parameters:

ParamTypeDefaultDescription
options.baseEstimatoranyDecisionTreeClassifier
options.bootstrapFeaturesbooleanfalse
options.bootstrapSamplesbooleanfalse
options.estimatorOptionsany{}
options.maxFeaturesnumber1.0
options.maxFeaturesIsFloatingbooleantrue
options.maxSamplesnumber1.0
options.maxSamplesIsFloatingbooleantrue
options.numEstimatorsnumber10

Returns: BaggingClassifier

Methods


λ fit

Builds an ensemble of base classifier from the training set (X, y).

Defined in ensemble/bagging.ts:108

Parameters:

ParamTypeDefaultDescription
Xnumber[][]nullarray-like or sparse matrix of shape = [n_samples, n_features]
ynumber[]nullarray-like, shape = [n_samples]

Returns:

void

λ fromJSON

Restore the model from a checkpoint

Defined in ensemble/bagging.ts:193

Parameters:

ParamTypeDefaultDescription
options.baseEstimatorany
options.bootstrapFeaturesboolean
options.bootstrapSamplesboolean
options.estimatorOptionsany
options.estimatorsany[]
options.estimatorsFeaturesnumber[][]
options.maxFeaturesnumber
options.maxFeaturesIsFloatingboolean
options.maxSamplesnumber
options.maxSamplesIsFloatingboolean
options.numEstimatorsnumber

Returns:

void

λ predict

Predict class for each row in X.

Predictions are formed using the majority voting.

Defined in ensemble/bagging.ts:137

Parameters:

ParamTypeDefaultDescription
Xnumber[][]nullarray-like or sparse matrix of shape = [n_samples, n_features]

Returns:

number[]

λ toJSON

Get the model details in JSON format

Defined in ensemble/bagging.ts:161

Returns:

ParamTypeDescription
baseEstimatoranyundefined
bootstrapFeaturesbooleanundefined
bootstrapSamplesbooleanundefined
estimatorOptionsanyundefined
estimatorsany[]undefined
estimatorsFeaturesnumber[][]undefined
maxFeaturesnumberundefined
maxFeaturesIsFloatingbooleanundefined
maxSamplesnumberundefined
maxSamplesIsFloatingbooleanundefined
numEstimatorsnumberundefined
Next
RandomForestClassifier