-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
33,373 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.17 KB
Exoplanet detection and generation/__pycache__/ensemble_model.cpython-311.pyc
Binary file not shown.
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
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 |
Oops, something went wrong.