text_plain_output_1.png
from sklearn.ensemble import GradientBoostingClassifier

from sklearn.pipeline import make_pipeline

from sklearn.preprocessing import StandardScaler

from sklearn.svm import SVC

import numpy as np

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

train_df = pd.read_csv('/kaggle/input/playground-series-s3e13/train.csv')
test_df = pd.read_csv('/kaggle/input/playground-series-s3e13/test.csv')

def create_ensamble_submission():
    submission_prognosis_list = []
    for i in range(0, len(results_gbc)):
        votes = np.zeros(11)
        sorted = np.argsort(results_gbc[i])
        for ii in range(0, 11):
            votes[sorted[ii]] += ii
        sorted = np.argsort(results_svc[i])
        for ii in range(0, 11):
            votes[sorted[ii]] += ii
        sorted = np.argsort(results_nnc[i])
        for ii in range(0, 11):
            votes[sorted[ii]] += ii
        response = classes[np.argmax(votes)]
        votes[np.argmax(votes)] = 0
        response += ' ' + classes[np.argmax(votes)]
        votes[np.argmax(votes)] = 0
        response += ' ' + classes[np.argmax(votes)]
        submission_prognosis_list += [response]
    submission_df = pd.DataFrame()
    submission_df['id'] = test_df['id']
    submission_df['prognosis'] = submission_prognosis_list
    return submission_df

train_df.columns

X = train_df.to_numpy()[:, 1:-1]
X.shape

y = train_df['prognosis']
classes = sorted(list(train_df['prognosis'].unique()))

X.shape

validate_records = 4
clf_gbc = GradientBoostingClassifier(n_estimators=2500, learning_rate=0.001, max_features=30, max_depth=3, random_state=0, subsample=0.6).fit(X[validate_records:], y[validate_records:])

clf_svc = make_pipeline(StandardScaler(), SVC(gamma='auto', kernel='poly', probability=True))
clf_svc.fit(X, y)
if validate_records > 0:
    print(clf_svc.score(X[:validate_records], y[:validate_records]))