Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
classifi
Advanced tools
Readme
Original Author: Yandong Liu. Email: yandongl @ cs.cmu.edu
Revised Author: Matthew Young. Email: mashu.daishi @ gmail.com
Javascript implementation of several machine learning algorithms including Decision Tree and Logistic Regression this far.
Input files need to be in CSV-format with 1st line being feature names. E.g.
outlook, temp, humidity, wind, label text, real, text, text, feature_type 'Sunny',80,'High', 'Weak', 'No' 'Sunny',82,'High', 'Strong', 'No' 'Overcast',73,'High', 'Weak', 'Yes'
npm install classifi
Data loading: learningjs.data_util provides two methods:
loadTextFile
: the csv-format file will be loaded from disk and columns are parsed as strings unless 2nd line specifies feature types.loadRealFile
: the csv-format file will be loaded from disk and columns are parsed as real numbers.In the loading callback function you will obtain a data object D on which you can apply the learning methods. Note that only Decision Tree supports both real and categorical features. Logistic Regression works on real features only.
let learningjs = require( 'learningjs' );
let data_util = learning.dataUtil;
let tree = new learningjs.tree();
data_util.loadRealFile( '${ path-to-csv }', function( D ) {
//normalize data
data_util.normalize( D.data, D.nfeatures );
//logistic regression. following params are optional
D.optimizer = 'sgd'; //default choice. other choice is 'gd'
D.learning_rate = 0.005;
D.l2_weight = 0.0;
D.iterations = 1000; //increase number of iterations for better performance
new learningjs.logistic().train( D )
.then( model => {
let trainAccuracy = model.calcAccuracy( D.data, D.targets );
console.log( 'training: got ' + trainAccuracy.n_correct + ' correct out of ' + trainAccuracy.n_samples+ ' examples. accuracy:' + ( trainAccuracy.accuracy * 100.0 ).toFixed( 2 ) + '%' );
data_util.loadRealFile( fn_test, function( T ) {
let testAccuracy = model.calcAccuracy( T.data, T.targets );
console.log(' test: got ' + testAccuracy.n_correct + ' correct out of ' + testAccuracy.n_samples + ' examples. accuracy:' + ( trainAccuracy.accuracy * 100.0 ).toFixed( 2 ) + '%' );
} );
} )
} );
} );
MIT
FAQs
This is a fork of https://github.com/yandongliu/learningjs. Designed to update coding and patterns. Uses the C4.5 classifing algorithm
The npm package classifi receives a total of 2 weekly downloads. As such, classifi popularity was classified as not popular.
We found that classifi 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.