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
Methods
Constructors
constructor
⊕ BaggingClassifier(__namedParameters: `object`)
Defined in ensemble/bagging.ts:58
Parameters:
Param | Type | Default | Description |
---|---|---|---|
options.baseEstimator | any | DecisionTreeClassifier | |
options.bootstrapFeatures | boolean | false | |
options.bootstrapSamples | boolean | false | |
options.estimatorOptions | any | {} | |
options.maxFeatures | number | 1.0 | |
options.maxFeaturesIsFloating | boolean | true | |
options.maxSamples | number | 1.0 | |
options.maxSamplesIsFloating | boolean | true | |
options.numEstimators | number | 10 |
Returns: BaggingClassifier
Methods
λ fit
Builds an ensemble of base classifier from the training set (X, y).
Defined in ensemble/bagging.ts:108
Parameters:
Param | Type | Default | Description |
---|---|---|---|
X | number[][] | null | array-like or sparse matrix of shape = [n_samples, n_features] |
y | number[] | null | array-like, shape = [n_samples] |
Returns:
void
λ fromJSON
Restore the model from a checkpoint
Defined in ensemble/bagging.ts:193
Parameters:
Param | Type | Default | Description |
---|---|---|---|
options.baseEstimator | any | ||
options.bootstrapFeatures | boolean | ||
options.bootstrapSamples | boolean | ||
options.estimatorOptions | any | ||
options.estimators | any[] | ||
options.estimatorsFeatures | number[][] | ||
options.maxFeatures | number | ||
options.maxFeaturesIsFloating | boolean | ||
options.maxSamples | number | ||
options.maxSamplesIsFloating | boolean | ||
options.numEstimators | number |
Returns:
void
λ predict
Predict class for each row in X.
Predictions are formed using the majority voting.
Defined in ensemble/bagging.ts:137
Parameters:
Param | Type | Default | Description |
---|---|---|---|
X | number[][] | null | array-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:
Param | Type | Description |
---|---|---|
baseEstimator | any | undefined |
bootstrapFeatures | boolean | undefined |
bootstrapSamples | boolean | undefined |
estimatorOptions | any | undefined |
estimators | any[] | undefined |
estimatorsFeatures | number[][] | undefined |
maxFeatures | number | undefined |
maxFeaturesIsFloating | boolean | undefined |
maxSamples | number | undefined |
maxSamplesIsFloating | boolean | undefined |
numEstimators | number | undefined |