Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
train(X, y) {
if (!Matrix.isMatrix(X)) X = new Matrix(X);
if (!Matrix.isMatrix(y)) y = Matrix.columnVector(y);
if (y.rows !== X.rows) {
y = y.transpose();
}
if (X.columns !== 2) {
throw new RangeError(
`You give X with ${X.columns} columns and it must be 2`
);
}
if (X.rows !== y.rows) {
throw new RangeError('X and y must have the same rows');
}
var examples = X.rows;
var coefficients = ((this.order + 2) * (this.order + 1)) / 2;
train(X, y) {
if (!Matrix.isMatrix(X)) X = new Matrix(X);
if (!Matrix.isMatrix(y)) y = Matrix.columnVector(y);
if (y.rows !== X.rows) {
y = y.transpose();
}
if (X.columns !== 2) {
throw new RangeError(
`You give X with ${X.columns} columns and it must be 2`
);
}
if (X.rows !== y.rows) {
throw new RangeError('X and y must have the same rows');
}
var examples = X.rows;