Skip to content

Instantly share code, notes, and snippets.

@jinhangjiang
Last active November 15, 2021 00:53
Show Gist options
  • Save jinhangjiang/040985a2c9f246197eaabbf74921e048 to your computer and use it in GitHub Desktop.
Save jinhangjiang/040985a2c9f246197eaabbf74921e048 to your computer and use it in GitHub Desktop.
WeightedAverageEnsemble3
##### AVERAGE
average_pred = (XGB_pred+
KNN_pred+
MLPC_pred+
RandomForest_pred+
DecisionTree_pred)/5
#make submission table
FiveModelAveragePrediction = pd.DataFrame(
{'QuoteNumber':df,
'QuoteConversion_Flag':average_pred})
FiveModelAveragePrediction.to_csv('FiveModelAveragePrediction1.csv',
index=False)
##### WEIGHTED AVERAGE
weighted_average = (0.3*XGB_pred+
0.2*DecisionTree_pred+
0.2*RandomForest_pred+
0.15*MLPC_pred+
0.15*KNN_pred)
#make submission table
WeightedAveragePrediction = pd.DataFrame(
{'QuoteNumber':df,
'QuoteConversion_Flag':weighted_average})
WeightedAveragePrediction.to_csv('WeightedAveragePrediction1.csv',
index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment