preprocessing.add_dummy_feature

add_dummy_feature(X: `object`, value: `object`)

Augment dataset with an additional dummy feature. This is useful for fitting an intercept term with implementations which cannot otherwise fit it directly.

Usage

import { add_dummy_feature } from 'machinelearn/preprocessing';
const dummy = add_dummy_feature([[0, 1, 2], [1, 0, 3]]);
console.log(dummy); // returns: [ [ 1, 0, 1, 2 ], [ 1, 1, 0, 3 ] ]

Defined in preprocessing/data.ts:56

Parameters:

ParamTypeDefaultDescription
Xnumber[][]nullA matrix of data
valuenumber1Value to use for the dummy feature.

Returns:

number[][]