Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
scikit-learn
Advanced tools
Node.js wrapper of scikit-learn
npm install scikit-learn
var scikit = require('scikit-learn')
var inspect = require('inspect-stream');
var arrayify = require('arrayify-merge.s');
var slice = require('slice-flow.s');
var scikit = require('scikit-learn');
var features = scikit.dataset('load_digits.data'); //stream of features
var labels = scikit.dataset('load_digits.target'); //stream of labels
// arrayify is transform stream that turns two input streams
// into one stream by wraping packets of inputs in array.
// So trainingSet outputs arrays [<feature>, <label>]
var trainingSet = arrayify();
features.pipe(trainingSet);
labels.pipe(trainingSet);
var clf = scikit.svm('SVC', {
gamma: 0.001,
C: 100
});
trainingSet
.pipe(slice([0, -1])) //passes all packets except last one
.pipe(clf)
.on('error', function (err) {
console.log(err);
})
.on('end', function () {
// now we have trained model
var predict = clf.predict();
var features = scikit.dataset('load_digits.data');
features.pipe(slice(-1)) //passes only last packet
.pipe(predict)
.pipe(inspect());
});
String
Name of method of sklearn.datasets
on python side
concatenated by dot with name of dataset's subset
Ex: 'load_digits.target'Object
Options of methodReturns readable stream of dataset
All fit streams are transform streams that acts like writable.
So you must listen on end
event instead of finish
to be sure that training finished
Accepts flow of arrays like [features, label] where 'features' is array of features and label is... label
Also fit stream have event 'model' that emits with trained model.
Model is Buffer
containing pickled object
Fit stream have method predict
that returns Predict stream
String
Name of method of sklearn.svm
Object
Options for estimatorPredict stream is transform stream that accepts flow of arrays of features and outputs predictions
FAQs
Node.js wrapper of scikit-learn
The npm package scikit-learn receives a total of 101 weekly downloads. As such, scikit-learn popularity was classified as not popular.
We found that scikit-learn demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.