Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierciest authored Oct 6, 2024
1 parent 646afff commit 66cc651
Show file tree
Hide file tree
Showing 12 changed files with 33,373 additions and 0 deletions.
Binary file added Exoplanet detection and generation/RF_model.sav
Binary file not shown.
Binary file added Exoplanet detection and generation/SVC_model.sav
Binary file not shown.
Binary file not shown.
24 changes: 24 additions & 0 deletions Exoplanet detection and generation/ensemble_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ensemble_model.py

def ensemble_predictions(pred_RF, pred_SVC):
"""
Perform ensemble prediction using majority voting between two models.
Parameters:
pred_RF (list or np.array): Predictions from Random Forest model.
pred_SVC (list or np.array): Predictions from SVC model.
Returns:
list: Ensemble predictions based on majority voting logic.
"""
ensembled_predictions = []

for i in range(len(pred_RF)):
if pred_RF[i] == pred_SVC[i]:
ensembled_predictions.append(pred_RF[i]) # Append when predictions agree
elif pred_RF[i] == 1 and pred_SVC[i] == 0:
ensembled_predictions.append(pred_RF[i]) # Prefer RF prediction if it's 1
else:
ensembled_predictions.append(pred_SVC[i]) # Otherwise, take SVC prediction

return ensembled_predictions
Loading

0 comments on commit 66cc651

Please sign in to comment.