#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 3 13:10:35 2017
@author: lu
"""
import pickle
from numpy.random import shuffle
import pandas as pd
from sklearn import metrics, svm
"""
programmer_1-->svm Support vector machine
"""
def programmer_1():
inputfile = "data/moment.csv"
outputfile1 = "tmp/cm_train.xls"
outputfile2 = "tmp/cm_test.xls"
data = pd.read_csv(inputfile, encoding="gbk")
data = data.as_matrix()
# Then extract training set and verification set --8:2
shuffle(data)
data_train = data[:int(0.8 * len(data)), :]
data_test = data[int(0.8 * len(data)):, :]
# Training set / Extraction of training data and result data of verification set
x_train = data_train[:, 2:] * 30
y_train = data_train[:, 0].astype(int)
x_test = data_test[:, 2:] * 30
y_test = data_test[:, 0].astype(int)
# Training support vector machine SVC
model = svm.SVC()
model.fit(x_tra
The procedure is as follows ,