#!/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支持向量機
"""
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()
# 隨即抽取訓練集和驗證集--8:2
shuffle(data)
data_train = data[:int(0.8 * len(data)), :]
data_test = data[int(0.8 * len(data)):, :]
# 訓練集/驗證集的訓練數據和結果數據的抽取
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)
# 訓練支持向量機的SVC
model = svm.SVC()
model.fit(x_tra