Socket
Book a DemoInstallSign in
Socket

github.com/xlvector/hector

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/xlvector/hector

Source
Go Modules
Version
v0.0.0-20160325151706-a9da960a44ab
Version published
Created
Source

hector

Golang machine learning lib. Currently, it can be used to solve binary classification problems.

Supported Algorithms

  • Logistic Regression
  • Factorized Machine
  • CART, Random Forest, Random Decision Tree, Gradient Boosting Decision Tree
  • Neural Network

Dataset Format

Hector support libsvm-like data format. Following is an sample dataset

1 	1:0.7 3:0.1 9:0.4
0	2:0.3 4:0.9 7:0.5
0	2:0.7 5:0.3
...

How to Run

Run as tools

hector-cv.go will help you test one algorithm by cross validation in some dataset, you can run it by following steps:

go get github.com/xlvector/hector
go install github.com/xlvector/hector/hectorcv
hectorcv --method [Method] --train [Data Path] --cv 10

Here, Method include

  • lr : logistic regression with SGD and L2 regularization.
  • ftrl : FTRL-proximal logistic regreesion with L1 regularization. Please review this paper for more details "Ad Click Prediction: a View from the Trenches".
  • ep : bayesian logistic regression with expectation propagation. Please review this paper for more details "Web-Scale Bayesian Click-Through Rate Prediction for Sponsored Search Advertising in Microsoft’s Bing Search Engine"
  • fm : factorization machine
  • cart : classifiaction tree
  • cart-regression : regression tree
  • rf : random forest
  • rdt : random decision trees
  • gbdt : gradient boosting decisio tree
  • linear-svm : linear svm with L1 regularization
  • svm : svm optimizaed by SMO (current, its linear svm)
  • l1vm : vector machine with L1 regularization by RBF kernel
  • knn : k-nearest neighbor classification

hector-run.go will help you train one algorithm on train dataset and test it on test dataset, you can run it by following steps:

cd src
go build hector-run.go
./hector-run --method [Method] --train [Data Path] --test [Data Path]

Above methods will direct train algorithm on train dataset and then test on test dataset. If you want to train algorithm and get the model file, you can run it by following steps:

./hector-run --method [Method] --action train --train [Data Path] --model [Model Path]

Then, you can use model file to test any test dataset:

./hector-run --method [Method] --action test --test [Data Path] --model [Model Path]

Benchmark

Binary Classification

Following are datasets used in benchmarks, You can find them from UCI Machine Learning Repository

  • heart
  • fourclass

I will do 5-fold cross validation on the dataset, and use AUC as evaluation metric. Following are the results:

DataSetMethodAUC
heartFTRL-LR0.9109
heartEP-LR0.8982
heartCART0.8231
heartRDT0.9155
heartRF0.9019
heartGBDT0.9061
fourclassFTRL-LR0.8281
fourclassEP-LR0.7986
fourclassCART0.9832
fourclassRDT0.9925
fourclassRF0.9947
fourclassGBDT0.9958

FAQs

Package last updated on 25 Mar 2016

Did you know?

Socket

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.

Install

Related posts