text_plain_output_1.png
from sklearn.model_selection import GridSearchCV

from sklearn.svm import SVC

import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

train_df = pd.read_csv('../input/train.csv')
test_df = pd.read_csv('../input/test.csv')

train_x = train_df.drop(['Survived'], axis=1)
train_y = train_df['Survived']
test_x = test_df

def predict(train_x, train_y, test_df, algo):
    algo.fit(train_x, train_y)
    pred_y = algo.predict(test_df)
    score = algo.score(train_x, train_y)
    return (pred_y, score)

from sklearn.model_selection import GridSearchCV
param_grid = {'C': [0.1, 1, 10, 100], 'gamma': [1, 0.1, 0.01, 0.001]}
grid = GridSearchCV(SVC(), param_grid, refit=True)
grid_pred_train, score = predict(train_x, train_y, train_x, grid)
grid_pred_test, score = predict(train_x, train_y, test_x, grid)
score