Last active
January 9, 2021 12:14
-
-
Save davidzhaodz/e06f4cb66b936a694430967622412816 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
# Get features at event dates | |
X = data.loc[labels.index, :] | |
y = labels['bin'] | |
# Split data | |
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, shuffle=False) | |
# Setting random forest parameters | |
n_estimator = 1000 | |
depth = 2 | |
RANDOM_STATE = 0 | |
rf = RandomForestClassifier(max_depth=depth, n_estimators=n_estimator, | |
criterion='entropy', class_weight='balanced_subsample', | |
random_state=RANDOM_STATE) | |
# Fitting our model | |
rf.fit(X_train, y_train) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment