Last active
August 4, 2017 17:53
-
-
Save olinguyen/d93cd4222b404d26dc859f100d700be6 to your computer and use it in GitHub Desktop.
Shogun unit test toy data generation for random forest
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
# Generates data for y = (x1 v x2) > 5 | |
import numpy as np | |
from sklearn.ensemble import RandomForestClassifier | |
X1 = np.random.randint(5, 10, size=(5, 2)) | |
X2 = np.random.randint(0, 5, size=(5, 2)) | |
X = np.concatenate((X1, X2)) | |
y = [1.0 if i > 5 else 0.0 for i in range(10)] | |
y_random = np.random.randint(0, 2, size=(10)) | |
X1_test = np.random.randint(0, 2, size=(5, 2)) | |
X2_test = np.random.randint(6, 10, size=(5, 2)) | |
X_test = np.concatenate((X1_test, X2_test)) | |
print(X) | |
print(y) | |
print(X_test) | |
print(y_random) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment