<jupyter_start><jupyter_text>读取数据今天要做的事情：&emsp;&emsp;    1 先直接用LR,GBDT 出一版baseline结果。&emsp;&emsp;    2 分别采用bagging, boosting, stacking 出结果    下一步&emsp;&emsp;    1 研究每个字段数值特征：是否需要归一化，中心化，标准化 &emsp;&emsp;    2 尝试特征筛选&emsp;&emsp;    3 特征工程PCA、LDA、SVD 降维&emsp;&emsp;    4 尝试特征升维？？神经网络？？&emsp;&emsp;    5 加入深度学习方法&emsp;&emsp;    6 考虑时序怎么用、、<jupyter_code>import pandas as pd
train_df = pd.read_csv('./train.csv', index_col='ID')
train_df.head()
train_feature = train_df[['V1','V2','V3','V4','V5','V6','V7','V8','V9','V10','V11','V12','V13','V14','V15','V16','V17','V18','V19','V20','V21','V22','V23','V24','V25','V26','V27','V28','V29','V30']]
train_label = train_df['Label']

print train_feature.head()
print train_label.head()
print train_label.value_counts()
pred_df = pd.read_csv('./pred.csv', index_col='ID')
del pred_df['V_Time']
pred_df.head()<jupyter_output><empty_output><jupyter_text>LR  模型<jupyter_code>from sklearn import linear_model
import time

start = time.time()
# fit到RandomForestRegressor之中
clf = linear_model.LogisticRegression(C=1.0, penalty='l1', tol=1e-6)
clf.fit(train_feature, train_label)

print "运行时间：", time.time()-start<jupyter_output>运行时间： 3.40825891495<jupyter_text>评估<jupyter_code>from sklearn.metrics import accuracy_score
lr_pred_label = pd.Series(clf.predict(pred_df))
lr_pred_label.value_counts()<jupyter_output><empty_output><jupyter_text>RF<jupyter_code>from sklearn.ensemble import RandomForestClassifier
import time

start = time.time()
aliRC_RFC = RandomForestClassifier()
aliRC_RFC = aliRC_RFC.fit(train_feature, train_label)
print "训练时间：", time.time()-start
rf_pred_label = pd.Series(aliRC_RFC.predict(pred_df))
rf_pred_label.value_counts()<jupyter_output><empty_output><jupyter_text>GBDT<jupyter_code>from sklearn.ensemble import GradientBoostingClassifier
import time

start = time.time()
aliRC_gdbt = GradientBoostingClassifier()
aliRC_gdbt = aliRC_gdbt.fit(train_feature, train_label)
print "训练时间：", time.time()-start
gbdt_pred_label = pd.Series(aliRC_gdbt.predict(pred_df))
gbdt_pred_label.value_counts()<jupyter_output><empty_output><jupyter_text>GXBOOST<jupyter_code>from xgboost import XGBClassifier
import time

start = time.time()
xgbc = XGBClassifier()
xgbc.fit(train_feature, train_label)
print "训练时间：", time.time()-start
xgbc_pred_lable = pd.Series(xgbc.predict(pred_df))
gbdt_pred_label.value_counts()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1570109151973132, 'fraction_numerical': 0.03190596137699412, 'mean_word_length': 9.544247787610619, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '497964', 'license': 'Apache-2.0', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1100, 'n_words': 125, 'path': 'jupyter_file/risk_control/AliRiskControl.ipynb', 'repo_name': 'caserwin/daily-learning-python', 'size': '2382'}