Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
ml-logistic-regression
Advanced tools
This is an implementation of the logistic regression. When there are more than 2 classes, the method used is the One VS All.
$ npm i ml-logistic-regression
const { Matrix } = require('ml-matrix');
// Our training set (X,Y).
const X = new Matrix([[0, -1], [1, 0], [1, 1], [1, -1], [2, 0], [2, 1], [2, -1], [3, 2], [0, 4], [1, 3], [1, 4], [1, 5], [2, 3], [2, 4], [2, 5], [3, 4], [1, 10], [1, 12], [2, 10], [2, 11], [2, 14], [3, 11]]);
const Y = Matrix.columnVector([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2]);
// The test set (Xtest, Ytest).
const Xtest = new Matrix([
[0, -2],
[1, 0.5],
[1.5, -1],
[1, 2.5],
[2, 3.5],
[1.5, 4],
[1, 10.5],
[2.5, 10.5],
[2, 11.5],
]);
const Ytest = Matrix.columnVector([0, 0, 0, 1, 1, 1, 2, 2, 2]);
// We will train our model.
const logreg = new LogisticRegression({ numSteps: 1000, learningRate: 5e-3 });
logreg.train(X, Y);
// We try to predict the test set.
const finalResults = logreg.predict(Xtest);
// Now, you can compare finalResults with the Ytest, which is what you wanted to have.
FAQs
Logistic regression
We found that ml-logistic-regression demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.