Skip to content

KuiWei004/random-forest-classifier

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

random-forest-classifier

A random forest classifier written in python.

Usage

from sklearn.datasets import load_digits
from sklearn import cross_validation
import numpy as np
from randomforest import RandomForestClassifier

digits = load_digits(n_class = 2)
X = digits.data
y = digits.target
X_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y)

forest = RandomForestClassifier()
forest.fit(X_train, y_train)

accuracy = forest.score(X_test, y_test)
print 'The accuracy was', 100*accuracy, '% on the test data.'

classifications = forest.predict(X_test)
print 'The digit at index 0 of X_test was classified as a', classifications[0], '.'

About

A random forest classifier written in python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%