Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combining our models (model ensembling/stacking) #583

Open
Peco602 opened this issue Sep 13, 2023 · 0 comments
Open

Combining our models (model ensembling/stacking) #583

Peco602 opened this issue Sep 13, 2023 · 0 comments

Comments

@Peco602
Copy link

Peco602 commented Sep 13, 2023

I reviewed the section about model combination in NLP notebook. I think the calculation of baseline_pred_probs is wrong:

# Get mean pred probs for 3 models
baseline_pred_probs = np.max(model_0.predict_proba(val_sentences), axis=1) # get the prediction probabilities from baseline model
combined_pred_probs = baseline_pred_probs + tf.squeeze(model_2_pred_probs, axis=1) + tf.squeeze(model_6_pred_probs)
combined_preds = tf.round(combined_pred_probs/3) # average and round the prediction probabilities to get prediction classes
combined_preds[:20]

It should not be the max value, but simply the second column of the matrix. Hereafter, the version I propose:

# Get mean pred probs for 3 models
baseline_pred_probs = model_0.predict_proba(val_sentences)[:, 1] # get the prediction probabilities from baseline model
combined_pred_probs = baseline_pred_probs + tf.squeeze(model_2_pred_probs, axis=1) + tf.squeeze(model_6_pred_probs)
combined_preds = tf.round(combined_pred_probs/3) # average and round the prediction probabilities to get prediction classes
combined_preds[:20]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant