Skip to content

Instantly share code, notes, and snippets.

@kusal1990
Created June 2, 2022 18:33
Show Gist options
  • Save kusal1990/0356d984121eed8e9e9c01b171ed2e7e to your computer and use it in GitHub Desktop.
Save kusal1990/0356d984121eed8e9e9c01b171ed2e7e to your computer and use it in GitHub Desktop.
y_test_probas = np.empty((X_test.shape[0], 5))
model= xgb.XGBClassifier(learning_rate=0.5,max_depth=4,n_estimators=10,reg_alpha=0.01,reg_lambda=1.0,random_state=42)
model=model.fit(X_train,y_train)
for i in range(5):
y_test_probas[:,i] = model.predict_proba(X_test)[:,1]
#taking mean of all the predicted
y_test_proba = np.mean(y_test_probas, axis=1)
# Converting to 0 1 with a threshold 0.25, then replicating 3 copies for 3 phases
y_predict = np.repeat(y_test_proba > 0.25, 3)
results_df = pd.DataFrame()
signal_id = list(range(len(y_predict)))
signal_id = [i+8712 for i in signal_id]
results_df['signal_id'] = signal_id
results_df['target'] = y_predict
@kusal1990
Copy link
Author

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment