与Xgboost使用方法详解一的不同是:
1,数据为DataFrame模式(需转换为Dmatrix)
注意:整个方法的流程:读取数据pd.read_csv()----->切分数据train_test_split()---------》数据转换成Dmatrix格式xgb.DMatrix()------》参数设定------》设定watchlist用于查看模型状态,train训练模型-------》使用模型预测predict------》判断准确率--------》模型存储
'''配合pandas DataFrame格式数据建模'''
import pandas as pd
import numpy as np
import pickle
import xgboost as xgb
from sklearn.model_selection import train_test_split
#基本例子,从csv文件中读取数据,做二分类
#用pandas读入数据
data