Kaggle competition: Natural Language Processing with Disaster Tweets
X = train[input_cols]
Y1 = train[output_cols[0]]
Y2 = train[output_cols[1]]
X_test = test[input_cols]
E1 = train[extra_feat[0]]
E2 = train[extra_feat[1]]
XE = train[input_cols+extra_feat]<train_model>
import nltk
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer, TfidfVectorizer
from sklearn.multioutput import MultiOutputClassifier
from sklearn.metrics import classification_report, accuracy_score, precision_score, recall_score, plot_confusion_matrix
from sklearn.svm import LinearSVC, SVC, NuSVC
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.naive_bayes import MultinomialNB, BernoulliNB
import random
model= xgb.XGBRegressor(n_estimators=1000)
 model.fit(X,E1)
 ep1 = model.predict(X_test)
 model.fit(X,E2)
 ep2 = model.predict(X_test)
<train_model>
rand_state = random.seed(12 )
model= xgb.XGBRegressor(n_estimators=1000)
 model.fit(X,E1)
 ep1 = model.predict(X_test)
 preds = np.array(ep1)
 preds[preds < 0] = 0
preds = np.round(preds, 0)
 model.fit(X,E2)
 ep2 = model.predict(X_test)
 prds = np.array(ep2)
 prds[prds < 0] = 0
prds = np.round(prds, 0 )<feature_engineering>
train = pd.read_csv('/kaggle/input/nlp-getting-started/train.csv')
 test = pd.read_csv('/kaggle/input/nlp-getting-started/test.csv' )
test['ConfirmedCases_today'] = preds
test['Fatalities_today'] = prds<prepare_x_and_y>
X = train['text']
XE_test = test[input_cols+extra_feat]<save_to_csv>
y = train['target']
tree_reg= xgb.XGBRegressor(n_estimators=1000)
 tree_reg.fit(XE,Y1)
 prd = tree_reg.predict(XE_test)
 tree_reg.fit(XE,Y2)
 prd_2 = tree_reg.predict(XE_test)
 output_tree_reg = pd.DataFrame({ 'ForecastId' : ids, 'ConfirmedCases': prd,'Fatalities':prd_2 })
 output_tree_reg.to_csv('submission.csv', index=False)
 
<load_from_csv>
test_x = test['text']
train = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-1/train.csv')
 test = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-1/test.csv')
 submission = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-1/submission.csv' )<set_options>
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state = rand_state, shuffle = True )
pio.templates.default = "plotly_dark"
py.init_notebook_mode(connected=True )<groupby>
count_vectorizer = CountVectorizer(stop_words='english')
 count_train = count_vectorizer.fit_transform(X_train)
 count_test = count_vectorizer.transform(X_test)
 count_train_sub = count_vectorizer.transform(X)
 count_sub = count_vectorizer.transform(test_x)
latest_grouped = train.groupby('Country/Region')['ConfirmedCases', 'Fatalities'].sum().reset_index()<drop_column>
count_nb = MultinomialNB()
count_nb.fit(count_train ,y_train)
 count_nb_pred = count_nb.predict(count_test)
 count_nb_score = accuracy_score(y_test,count_nb_pred)
 print('MultinomialNaiveBayes Count Score: ', count_nb_score)
 count_nb_cm = confusion_matrix(y_test, count_nb_pred)
 count_nb_cm
europe = list(['Austria','Belgium','Bulgaria','Croatia','Cyprus','Czechia','Denmark','Estonia','Finland','France','Germany','Greece','Hungary','Ireland',
'Italy', 'Latvia','Luxembourg','Lithuania','Malta','Norway','Netherlands','Poland','Portugal','Romania','Slovakia','Slovenia',
'Spain', 'Sweden', 'United Kingdom', 'Iceland', 'Russia', 'Switzerland', 'Serbia', 'Ukraine', 'Belarus',
'Albania', 'Bosnia and Herzegovina', 'Kosovo', 'Moldova', 'Montenegro', 'North Macedonia'])
 europe_grouped_latest = latest_grouped[latest_grouped['Country/Region'].isin(europe)]<feature_engineering>
count_bnb = BernoulliNB()
count_bnb.fit(count_train ,y_train)
 count_bnb_pred = count_bnb.predict(count_test)
 count_bnb_score = accuracy_score(y_test,count_bnb_pred)
 print('BernoulliNaiveBayes Count Score: ', count_bnb_score)
 count_bnb_cm = confusion_matrix(y_test, count_bnb_pred)
 count_bnb_cm
train['province_encoded'] = train['Province/State'].apply(lambda x: province_encoded[x])
 train.head()<feature_engineering>
count_lsvc = LinearSVC()
count_lsvc.fit(count_train ,y_train)
 count_lsvc_pred = count_lsvc.predict(count_test)
 count_lsvc_score = accuracy_score(y_test,count_lsvc_pred)
 print('LinearSVC Count Score: ', count_lsvc_score)
 count_lsvc_cm = confusion_matrix(y_test, count_lsvc_pred)
 count_lsvc_cm
train['country_encoded'] = train['Country/Region'].apply(lambda x: country_encoded[x])
 train.head()<import_modules>
count_svc = SVC()
count_svc.fit(count_train ,y_train)
 count_svc_pred = count_svc.predict(count_test)
 count_svc_score = accuracy_score(y_test,count_svc_pred)
 print('SVC Count Score: ', count_svc_score)
 count_svc_cm = confusion_matrix(y_test, count_svc_pred)
 count_svc_cm
from datetime import datetime
import time<feature_engineering>
count_nusvc = NuSVC(0.4)
 count_nusvc.fit(count_train ,y_train)
 count_nusvc_pred = count_nusvc.predict(count_test)
 count_nusvc_score = accuracy_score(y_test,count_nusvc_pred)
 print('NuSVC Count Score: ', count_nusvc_score)
 count_nusvc_cm = confusion_matrix(y_test, count_nusvc_pred)
 count_nusvc_cm
<feature_engineering>
<feature_engineering>
train['Mon'] = train['Date'].apply(lambda x: int(x.split('-')[1]))
train['Day'] = train['Date'].apply(lambda x: int(x.split('-')[2]))<feature_engineering>
count_sgd = SGDClassifier()
count_sgd.fit(count_train ,y_train)
 count_sgd_pred = count_sgd.predict(count_test)
 count_sgd_score = accuracy_score(y_test,count_sgd_pred)
 print('SGD Count Score: ', count_sgd_score)
 count_sgd_cm = confusion_matrix(y_test, count_sgd_pred)
 count_sgd_cm
train['serial'] = train['Mon'] * 30 + train['Day']
train.head()<feature_engineering>
count_lr = LogisticRegression()
count_lr.fit(count_train ,y_train)
 count_lr_pred = count_lr.predict(count_test)
 count_lr_score = accuracy_score(y_test,count_lr_pred)
 print('LogisticRegression Count Score: ', count_lr_score)
 count_lr_cm = confusion_matrix(y_test, count_lr_pred)
 count_lr_cm
train['serial'] = train['serial'] - train['serial'].min()<load_from_csv>
tfidf_vectorizer = TfidfVectorizer(stop_words='english')
 tfidf_train = tfidf_vectorizer.fit_transform(X_train)
 tfidf_test = tfidf_vectorizer.transform(X_test)
 tfidf_train_sub = tfidf_vectorizer.transform(X)
 tfidf_sub = tfidf_vectorizer.transform(test_x )
gdp2020 = pd.read_csv('/kaggle/input/gdp2020/GDP2020.csv')
 population2020 = pd.read_csv('/kaggle/input/population2020/population2020.csv' )<define_variables>
tfidf_nb = MultinomialNB()
tfidf_nb.fit(tfidf_train, y_train)
 tfidf_nb_pred = tfidf_nb.predict(tfidf_test)
 tfidf_nb_score = accuracy_score(y_test,tfidf_nb_pred)
 print('MultinomialNaiveBayes Tfidf Score: ', tfidf_nb_score)
 tfidf_nb_cm = confusion_matrix(y_test, tfidf_nb_pred)
 tfidf_nb_cm
gdp2020 = gdp2020.rename(columns={"rank":"rank_gdp"})
 gdp2020_numeric_list = [list(gdp2020)[0]] + list(gdp2020)[2:-1]
gdp2020.head()<define_variables>
tfidf_svc = LinearSVC()
tfidf_svc.fit(tfidf_train, y_train)
 tfidf_svc_pred = tfidf_svc.predict(tfidf_test)
 tfidf_svc_score = accuracy_score(y_test,tfidf_svc_pred)
 print("LinearSVC Score: %0.3f" % tfidf_svc_score)
 svc_cm = confusion_matrix(y_test, tfidf_svc_pred)
 svc_cm
map_state = {'US':'United States',
'Korea, South':'South Korea',
'Cote d'Ivoire':'Ivory Coast',
'Czechia':'Czech Republic',
'Eswatini':'Swaziland',
'Holy See':'Vatican City',
'Jersey':'United Kingdom',
'North Macedonia':'Macedonia',
'Taiwan*':'Taiwan',
'occupied Palestinian territory':'Palestine'
}
map_state_rev = {v: k for k, v in map_state.items() }<feature_engineering>
tfidf_svc0 = SVC()
tfidf_svc0.fit(tfidf_train, y_train)
 tfidf_svc_pred0 = tfidf_svc.predict(tfidf_test)
 tfidf_svc_score0 = accuracy_score(y_test,tfidf_svc_pred0)
 print("SVC Score: %0.3f" % tfidf_svc_score0)
 svc_cm0 = confusion_matrix(y_test, tfidf_svc_pred0)
 classification_report(y_test, tfidf_svc_pred0)
 svc_cm0
population2020['name'] = population2020['name'].apply(lambda x: map_state_rev[x] if x in map_state_rev else x)
 gdp2020['country'] = gdp2020['country'].apply(lambda x: map_state_rev[x] if x in map_state_rev else x )<rename_columns>
tfidf_nusvc = NuSVC()
tfidf_nusvc.fit(tfidf_train, y_train)
 tfidf_nusvc_pred = tfidf_nusvc.predict(tfidf_test)
 tfidf_nusvc_score = accuracy_score(y_test,tfidf_nusvc_pred)
 print("NuSVC Score: %0.3f" % tfidf_nusvc_score)
 nusvc_cm = confusion_matrix(y_test, tfidf_nusvc_pred)
 classification_report(y_test, tfidf_nusvc_pred)
 nusvc_cm
population2020 = population2020.rename(columns={"rank":"rank_pop"})
 population2020_numeric_list = [list(population2020)[0]] + list(gdp2020)[2:]
population2020.head()<merge>
tfidf_bnb = BernoulliNB()
tfidf_bnb.fit(tfidf_train, y_train)
 tfidf_bnb_pred = tfidf_bnb.predict(tfidf_test)
 tfidf_bnb_score = accuracy_score(y_test,tfidf_bnb_pred)
 print('BernoulliNaiveBayes Tfidf Score: %0.3f' % tfidf_bnb_score)
 tfidf_bnb_cm = confusion_matrix(y_test, tfidf_bnb_pred)
 tfidf_bnb_cm
train = pd.merge(train, population2020, how='left', left_on = 'Country/Region', right_on = 'name')
 train = pd.merge(train, gdp2020, how='left', left_on = 'Country/Region', right_on = 'country' )<count_missing_values>
tfidf_sgd = SGDClassifier()
tfidf_sgd.fit(tfidf_train, y_train)
 tfidf_sgd_pred = tfidf_sgd.predict(tfidf_test)
 tfidf_sgd_score = accuracy_score(y_test,tfidf_sgd_pred)
 print("SGD Score: %0.3f" % tfidf_sgd_score)
 sgd_cm = confusion_matrix(y_test, tfidf_sgd_pred)
 sgd_cm
train.isnull().sum()<count_missing_values>
tfidf_lr = LogisticRegression()
tfidf_lr.fit(tfidf_train, y_train)
 tfidf_lr_pred = tfidf_lr.predict(tfidf_test)
 tfidf_lr_score = accuracy_score(y_test,tfidf_lr_pred)
 print("LogisticRegression Score: %0.3f" % tfidf_lr_score)
 lr_cm = confusion_matrix(y_test, tfidf_lr_pred)
 lr_cm
train.isnull().sum()<data_type_conversions>
sample_sub=pd.read_csv('/kaggle/input/nlp-getting-started/sample_submission.csv')
train = train.fillna(0 )<prepare_x_and_y>
count_nusvc.fit(count_train_sub ,y)
 count_nusvc_sub = count_nusvc.predict(count_sub)
numeric_features_X = ['Lat','Long', 'province_encoded' ,'country_encoded','Mon','Day'] + population2020_numeric_list + gdp2020_numeric_list
numeric_features_Y = ['ConfirmedCases', 'Fatalities']
train_numeric_X = train[numeric_features_X]
train_numeric_Y = train[numeric_features_Y]<feature_engineering>
sub=pd.DataFrame({'id':sample_sub['id'].values.tolist() ,'target':count_nusvc_sub} )
test['province_encoded'] = test['Province/State'].apply(lambda x: province_encoded[x] if x in province_encoded else max(province_encoded.values())+1 )<feature_engineering>
sub.to_csv('submission.csv',index=False )
test['country_encoded'] = test['Country/Region'].apply(lambda x: country_encoded[x] if x in country_encoded else max(country_encoded.values())+1 )<feature_engineering>
import nltk
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer, TfidfVectorizer
from sklearn.multioutput import MultiOutputClassifier
from sklearn.metrics import classification_report, accuracy_score, precision_score, recall_score, plot_confusion_matrix
from sklearn.svm import LinearSVC, SVC, NuSVC
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.naive_bayes import MultinomialNB, BernoulliNB
import random
test['Mon'] = test['Date'].apply(lambda x: int(x.split('-')[1]))
test['Day'] = test['Date'].apply(lambda x: int(x.split('-')[2]))<feature_engineering>
rand_state = random.seed(12 )
test['serial'] = test['Mon'] * 30 + test['Day']
test['serial'] = test['serial'] - test['serial'].min()<merge>
train = pd.read_csv('/kaggle/input/nlp-getting-started/train.csv')
 test = pd.read_csv('/kaggle/input/nlp-getting-started/test.csv' )
test = pd.merge(test, population2020, how='left', left_on = 'Country/Region', right_on = 'name')
 test = pd.merge(test, gdp2020, how='left', left_on = 'Country/Region', right_on = 'country' )<feature_engineering>
X = train['text']
<count_missing_values>
y = train['target']
test_numeric_X = test[numeric_features_X]
test_numeric_X.isnull().sum()<correct_missing_values>
test_x = test['text']
test_numeric_X = test_numeric_X.fillna(-1 )<import_modules>
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state = rand_state, shuffle = True )
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression<train_model>
count_vectorizer = CountVectorizer(stop_words='english')
 count_train = count_vectorizer.fit_transform(X_train)
 count_test = count_vectorizer.transform(X_test)
 count_train_sub = count_vectorizer.transform(X)
 count_sub = count_vectorizer.transform(test_x)
pipeline = Pipeline([('scaler', StandardScaler()),('estimator', LinearRegression())])
 pipeline.fit(train_numeric_X, train_numeric_Y )<predict_on_test>
count_nb = MultinomialNB()
count_nb.fit(count_train ,y_train)
 count_nb_pred = count_nb.predict(count_test)
 count_nb_score = accuracy_score(y_test,count_nb_pred)
 print('MultinomialNaiveBayes Count Score: ', count_nb_score)
 count_nb_cm = confusion_matrix(y_test, count_nb_pred)
 count_nb_cm
predicted = pipeline.predict(test_numeric_X )<import_modules>
count_bnb = BernoulliNB()
count_bnb.fit(count_train ,y_train)
 count_bnb_pred = count_bnb.predict(count_test)
 count_bnb_score = accuracy_score(y_test,count_bnb_pred)
 print('BernoulliNaiveBayes Count Score: ', count_bnb_score)
 count_bnb_cm = confusion_matrix(y_test, count_bnb_pred)
 count_bnb_cm
from sklearn.svm import SVR<train_model>
count_lsvc = LinearSVC()
count_lsvc.fit(count_train ,y_train)
 count_lsvc_pred = count_lsvc.predict(count_test)
 count_lsvc_score = accuracy_score(y_test,count_lsvc_pred)
 print('LinearSVC Count Score: ', count_lsvc_score)
 count_lsvc_cm = confusion_matrix(y_test, count_lsvc_pred)
 count_lsvc_cm
pipeline = Pipeline([('scaler', StandardScaler()),('estimator', SVR())])
 pipeline.fit(train_numeric_X, train_numeric_Y.values[:,0])
 pipeline2 = Pipeline([('scaler', StandardScaler()),('estimator', SVR())])
 pipeline2.fit(train_numeric_X, train_numeric_Y.values[:,1])
 discovered, fatal = pipeline.predict(test_numeric_X), pipeline2.predict(test_numeric_X )<save_to_csv>
count_svc = SVC()
count_svc.fit(count_train ,y_train)
 count_svc_pred = count_svc.predict(count_test)
 count_svc_score = accuracy_score(y_test,count_svc_pred)
 print('SVC Count Score: ', count_svc_score)
 count_svc_cm = confusion_matrix(y_test, count_svc_pred)
 count_svc_cm
<import_modules>
count_nusvc = NuSVC(0.4)
 count_nusvc.fit(count_train ,y_train)
 count_nusvc_pred = count_nusvc.predict(count_test)
 count_nusvc_score = accuracy_score(y_test,count_nusvc_pred)
 print('NuSVC Count Score: ', count_nusvc_score)
 count_nusvc_cm = confusion_matrix(y_test, count_nusvc_pred)
 count_nusvc_cm
from sklearn.neighbors import KNeighborsClassifier<import_modules>
from sklearn.neighbors import KNeighborsClassifier<import_modules>
from sklearn.neighbors import KNeighborsClassifier<train_model>
count_sgd = SGDClassifier()
count_sgd.fit(count_train ,y_train)
 count_sgd_pred = count_sgd.predict(count_test)
 count_sgd_score = accuracy_score(y_test,count_sgd_pred)
 print('SGD Count Score: ', count_sgd_score)
 count_sgd_cm = confusion_matrix(y_test, count_sgd_pred)
 count_sgd_cm
pipeline = Pipeline([('scaler', StandardScaler()),('estimator', KNeighborsClassifier(n_jobs=4)) ])
 pipeline.fit(train_numeric_X, train_numeric_Y )<import_modules>
count_lr = LogisticRegression()
count_lr.fit(count_train ,y_train)
 count_lr_pred = count_lr.predict(count_test)
 count_lr_score = accuracy_score(y_test,count_lr_pred)
 print('LogisticRegression Count Score: ', count_lr_score)
 count_lr_cm = confusion_matrix(y_test, count_lr_pred)
 count_lr_cm
from sklearn.ensemble import RandomForestClassifier<train_model>
tfidf_vectorizer = TfidfVectorizer(stop_words='english')
 tfidf_train = tfidf_vectorizer.fit_transform(X_train)
 tfidf_test = tfidf_vectorizer.transform(X_test)
 tfidf_train_sub = tfidf_vectorizer.transform(X)
 tfidf_sub = tfidf_vectorizer.transform(test_x )
RF_model = RandomForestClassifier(n_estimators=50,n_jobs=4,verbose=True)
 RF_model.fit(train_numeric_X, train_numeric_Y )<save_to_csv>
tfidf_nb = MultinomialNB()
tfidf_nb.fit(tfidf_train, y_train)
 tfidf_nb_pred = tfidf_nb.predict(tfidf_test)
 tfidf_nb_score = accuracy_score(y_test,tfidf_nb_pred)
 print('MultinomialNaiveBayes Tfidf Score: ', tfidf_nb_score)
 tfidf_nb_cm = confusion_matrix(y_test, tfidf_nb_pred)
 tfidf_nb_cm
<import_modules>
tfidf_svc = LinearSVC()
tfidf_svc.fit(tfidf_train, y_train)
 tfidf_svc_pred = tfidf_svc.predict(tfidf_test)
 tfidf_svc_score = accuracy_score(y_test,tfidf_svc_pred)
 print("LinearSVC Score: %0.3f" % tfidf_svc_score)
 svc_cm = confusion_matrix(y_test, tfidf_svc_pred)
 svc_cm
from sklearn.ensemble import AdaBoostClassifier<train_model>
tfidf_svc0 = SVC()
tfidf_svc0.fit(tfidf_train, y_train)
 tfidf_svc_pred0 = tfidf_svc.predict(tfidf_test)
 tfidf_svc_score0 = accuracy_score(y_test,tfidf_svc_pred0)
 print("SVC Score: %0.3f" % tfidf_svc_score0)
 svc_cm0 = confusion_matrix(y_test, tfidf_svc_pred0)
 classification_report(y_test, tfidf_svc_pred0)
 svc_cm0
adaboost_model_for_ConfirmedCases = AdaBoostClassifier(n_estimators=15)
 adaboost_model_for_ConfirmedCases.fit(train_numeric_X, train_numeric_Y[numeric_features_Y[0]])
 adaboost_model_for_Fatalities = AdaBoostClassifier(n_estimators=15)
 adaboost_model_for_Fatalities.fit(train_numeric_X, train_numeric_Y[numeric_features_Y[1]] )<create_dataframe>
tfidf_nusvc = NuSVC()
tfidf_nusvc.fit(tfidf_train, y_train)
 tfidf_nusvc_pred = tfidf_nusvc.predict(tfidf_test)
 tfidf_nusvc_score = accuracy_score(y_test,tfidf_nusvc_pred)
 print("NuSVC Score: %0.3f" % tfidf_nusvc_score)
 nusvc_cm = confusion_matrix(y_test, tfidf_nusvc_pred)
 classification_report(y_test, tfidf_nusvc_pred)
 nusvc_cm
<create_dataframe>
tfidf_bnb = BernoulliNB()
tfidf_bnb.fit(tfidf_train, y_train)
 tfidf_bnb_pred = tfidf_bnb.predict(tfidf_test)
 tfidf_bnb_score = accuracy_score(y_test,tfidf_bnb_pred)
 print('BernoulliNaiveBayes Tfidf Score: %0.3f' % tfidf_bnb_score)
 tfidf_bnb_cm = confusion_matrix(y_test, tfidf_bnb_pred)
 tfidf_bnb_cm
<import_modules>
tfidf_sgd = SGDClassifier()
tfidf_sgd.fit(tfidf_train, y_train)
 tfidf_sgd_pred = tfidf_sgd.predict(tfidf_test)
 tfidf_sgd_score = accuracy_score(y_test,tfidf_sgd_pred)
 print("SGD Score: %0.3f" % tfidf_sgd_score)
 sgd_cm = confusion_matrix(y_test, tfidf_sgd_pred)
 sgd_cm
from sklearn.neighbors import KNeighborsClassifier
from sklearn.naive_bayes import GaussianNB
from sklearn.linear_model import LogisticRegression
from sklearn import model_selection
from mlxtend.classifier import StackingCVClassifier<choose_model_class>
tfidf_lr = LogisticRegression()
tfidf_lr.fit(tfidf_train, y_train)
 tfidf_lr_pred = tfidf_lr.predict(tfidf_test)
 tfidf_lr_score = accuracy_score(y_test,tfidf_lr_pred)
 print("LogisticRegression Score: %0.3f" % tfidf_lr_score)
 lr_cm = confusion_matrix(y_test, tfidf_lr_pred)
 lr_cm
clf1 = KNeighborsClassifier(n_neighbors=100)
 clf2 = RandomForestClassifier(n_estimators=10)
 clf3 = GaussianNB()
lr = LogisticRegression(solver='lbfgs')
 sclf = StackingCVClassifier(classifiers=[clf1, clf2], meta_classifier=lr, use_probas=True, cv=3)
 for clf, label in zip([clf1, clf2, clf3, sclf],
['KNN',
'Random Forest',
'Naive Bayes',
'StackingClassifier']):
scores = model_selection.cross_val_score(clf, train_numeric_X.values, train_numeric_Y[numeric_features_Y[0]].values, cv=3, scoring='neg_mean_squared_log_error')
 print("Avg_rmse: %0.2f(+/- %0.2f)[%s]" %(scores.mean() , scores.std() , label))<predict_on_test>
sample_sub=pd.read_csv('/kaggle/input/nlp-getting-started/sample_submission.csv')
train_y_pred = RF_model.predict(train_numeric_X )<compute_train_metric>
count_nusvc.fit(count_train_sub ,y)
 count_nusvc_sub = count_nusvc.predict(count_sub)
error = np.sqrt(( train_y_pred - train_numeric_Y)**2)
 error = error.cumsum()<compute_test_metric>
sub=pd.DataFrame({'id':sample_sub['id'].values.tolist() ,'target':count_nusvc_sub} )
<choose_model_class><EOS> 
sub.to_csv('submission.csv',index=False )