Created
December 14, 2015 22:26
-
-
Save Akramz/beccd19ac521265c44fa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import pandas as pd | |
| import numpy as np | |
| from sys import exit | |
| from sklearn import cross_validation | |
| from sklearn import datasets | |
| from sklearn import svm | |
| from sklearn.naive_bayes import GaussianNB | |
| data = pd.read_csv('../../data/improv/train1.csv') | |
| # | |
| X = np.array(data[['Pclass', 'Sex', 'Embarked']]) | |
| Y = np.array(data[['Survived']]) | |
| X_train, X_test, y_train, y_test = cross_validation.train_test_split( | |
| X, Y, test_size=0.4, random_state=0) | |
| # SVM | |
| clf = svm.SVC(kernel='linear', C=1).fit(X_train, y_train) | |
| print clf.score(X_test, y_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment