LearningJS: A Javascript Implementation of Logistic Regression and C4.5 Decision Tree Algorithms
Original Author: Yandong Liu. Email: yandongl @ cs.cmu.edu
Revised Author: Matthew Young. Email: mashu.daishi @ gmail.com
Introduction
Javascript implementation of several machine learning algorithms including Decision Tree and Logistic Regression this far.
Data format
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'
Installing
npm install classifi
Usage
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 = ;let data_util = learningdataUtil;let tree = ; data_util;} );
License
MIT