Skip to content

Instantly share code, notes, and snippets.

@olinguyen
Created June 15, 2017 22:26
Show Gist options
  • Save olinguyen/ade8e2bd0899b2ec9bee00d03fbb5172 to your computer and use it in GitHub Desktop.
Save olinguyen/ade8e2bd0899b2ec9bee00d03fbb5172 to your computer and use it in GitHub Desktop.
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