LogisticRegression
API reference for LogisticRegression
Linear.LogisticRegression
interface LogisticRegressionProps {
learningRate?: number;
maxIter?: number;
}
constructor(props: LogisticRegressionProps = {})
Performs binary logistic regression optimized with gradient descent. The
learningRate
controls the step size during optimization and maxIter
specifies the number of iterations.
Methods
fit(trainX: number[][], trainY: number[]): void
predict(testX: number[][]): number[]
fit
trainX
- Training features with shape[nSamples, nFeatures]
.trainY
- Binary labels for each training sample.
predict
testX
- Feature matrix to classify.
Example
const clf = new LogisticRegression();
clf.fit(trainX, trainY);
const result = clf.predict(testX);