python 机器学习
十分钟搞定pandas
http://www.cnblogs.com/chaosimple/p/4153083.html
dummies 哑变量,将变量重新编码,便于二分类,例如男、女,变为0,1等
将哑变量变换后的新的属性列直接concat到原来的df中即可。
dummies = pd.get_dummies(df[
'key'
], prefix=
'key'
) predix加前缀
http://www.it165.net/pro/html/201405/14269.html
XGBoost模型调参、
http://www.2cto.com/kf/201607/528771.html
xgb和gbdt
http://blog.csdn.net/a819825294/article/details/51206410
http://blog.csdn.net/jasonding1354/article/details/50562513
XGBoost区别于GBDT的一些独特之处以及算法的R实现。
https://zhuanlan.zhihu.com/p/26154587
python,numpy,pandas数据处理之小技巧
http://www.168seo.cn/python/1882.html
pandas 对每一列数据进行标准化
>>> import numpy as np >>> import pandas as pd Backend TkAgg is interactive backend. Turning interactive mode on. >>> np.random.seed(1) >>> df_test = pd.DataFrame(np.random.randn(4,4)* 4 + 3) >>> df_test 0 1 2 3 0 9.497381 0.552974 0.887313 -1.291874 1 6.461631 -6.206155 9.979247 -0.044828 2 4.276156 2.002518 8.848432 -5.240563 3 1.710331 1.463783 7.535078 -1.399565 >>> df_test_1 = df_test >>> df_test.apply(lambda x: (x - np.min(x)) / (np.max(x) - np.min(x))) #方法一 0 1 2 3 0 1.000000 0.823413 0.000000 0.759986 1 0.610154 0.000000 1.000000 1.000000 2 0.329499 1.000000 0.875624 0.000000 3 0.000000 0.934370 0.731172 0.739260 >>> (df_test_1 - df_test_1.min()) / (df_test_1.max() - df_test_1.min())#方法二 0 1 2 3 0 1.000000 0.823413 0.000000 0.759986 1 0.610154 0.000000 1.000000 1.000000 2 0.329499 1.000000 0.875624 0.000000 3 0.000000 0.934370 0.731172 0.739260