Created
June 15, 2017 22:26
-
-
Save olinguyen/ade8e2bd0899b2ec9bee00d03fbb5172 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from modshogun import * | |
features_train = RealFeatures(np.random.random_sample((10, 5))) | |
features_test = RealFeatures(np.random.random_sample((10, 5))) | |
labels_train = MulticlassLabels(np.array([np.random.randint(3) for i in range(5)]).astype(np.float)) | |
labels_test = MulticlassLabels(np.array([np.random.randint(3) for i in range(5)]).astype(np.float)) | |
m_vote = MajorityVote() | |
rand_forest = RandomForest(features_train, labels_train, 100) | |
rand_forest.set_combination_rule(m_vote) | |
rand_forest.train() | |
labels_predict = rand_forest.apply_multiclass(features_test) | |
labels_predict.get_values() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment