from sklearn.svm import SVC
from sklearn.cross_validation import train_test_split
from sklearn.metrics import classification_report
from sklearn.preprocessing import LabelEncoder
from analyze.dimension_reduction import get_data_for_linear_regression


def run():
    clf = SVC()
    label_encoder = LabelEncoder()
    X_all, y_all = get_data_for_linear_regression()
    y_all = label_encoder.fit_transform(y_all)

    num_all = len(X_all)
    num_train = num_all * 0.25
    X_train, X_test, y_train, y_test = train_test_split(X_all, y_all, train_size=(num_train / float(num_all)))
    clf.fit(X_train, y_train)

    print "Training set size: {}".format(len(X_train))
    print "Accuracy for training set:"
    print classification_report(
            y_train,
            clf.predict(X_train),
            target_names=label_encoder.classes_)
    print "Accuracy for test set:"
    print classification_report(
            y_test,
            clf.predict(X_test),
            target_names=label_encoder.classes_)

if __name__ == "__main__":
    run()

@@ -249,19 +249,38 @@
 n%0A%0A%0Adef 
+_
 run
+_svc_on_file_stats
 ():%0A    
@@ -759,20 +759,16 @@
         
-    
 y_train,
@@ -768,20 +768,16 @@
 _train,%0A
-    
         
@@ -798,20 +798,16 @@
 train),%0A
-    
         
@@ -919,20 +919,16 @@
         
-    
 y_test,%0A
@@ -931,28 +931,24 @@
 st,%0A        
- 
-   
 clf.predict(
@@ -956,20 +956,16 @@
 _test),%0A
-    
         
@@ -1002,16 +1002,58 @@
 sses_)%0A%0A
+%0Adef run():%0A    _run_svc_on_file_stats()%0A%0A
 if __nam

Move SVC prediction to it's own function