Last active
November 15, 2021 00:55
-
-
Save jinhangjiang/487169ff7b5cac5b5294ea9e1004bbc7 to your computer and use it in GitHub Desktop.
WeightedAverageEnsemble2
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
##### Decision Tree | |
DecisionTree = DecisionTreeClassifier() | |
DecisionTree.fit(data, label) | |
DecisionTree_pred = DecisionTree.predict(Test) | |
#make submission table | |
DecisionTreePrediction = pd.DataFrame( | |
{'QuoteNumber':df, | |
'QuoteConversion_Flag':DecisionTree_pred}) | |
#save file | |
DecisionTreePrediction.to_csv('DecisionTree1.csv', | |
index = False) | |
##### KNN | |
KNN = KNeighborsClassifier(n_neighbors=2) | |
KNN.fit(data, label) | |
KNN_pred = KNN.predict(Test) | |
#make submission table | |
KNNPrediction = pd.DataFrame( | |
{'QuoteNumber':df, | |
'QuoteConversion_Flag':KNN_pred}) | |
#save file | |
KNNPrediction.to_csv('KNN1.csv', | |
index = False) | |
##### MLPC | |
MLPC = MLPClassifier(random_state=1, max_iter=300) | |
MLPC.fit(data, label) | |
MLPC_pred = MLPC.predict(Test) | |
#make submission table | |
MLPCPrediction = pd.DataFrame( | |
{'QuoteNumber':df, | |
'QuoteConversion_Flag':MLPC_pred}) | |
#save file | |
MLPCPrediction.to_csv('MLPC1.csv', | |
index=False) | |
##### Random Forest | |
RandomForest = RandomForestClassifier() | |
RandomForest.fit(data,label) | |
RandomForest_pred = RandomForest.predict(Test) | |
#make submission table | |
RandomForestPrediction = pd.DataFrame( | |
{'QuoteNumber':df, | |
'QuoteConversion_Flag':RandomForest_pred}) | |
#save file | |
RandomForestPrediction.to_csv('RandomForest1.csv', | |
index=False) | |
##### XGB Classifier | |
XGB = XGBClassifier() | |
XGB.fit(data,label) | |
XGB_pred = XGB.predict(Test) | |
#make submission table | |
XGBPrediction = pd.DataFrame( | |
{'QuoteNumber':df, | |
'QuoteConversion_Flag':XGB_pred}) | |
#save file | |
XGBPrediction.to_csv('XGB1.csv', | |
index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment