Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
JianWenJun committed May 4, 2018
1 parent e1f4494 commit 36df7d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ML/DecisionTree/xgboost_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pandas as pd
import numpy as np
import re
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import LabelBinarizer
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import GridSearchCV
Expand Down Expand Up @@ -124,7 +125,6 @@ def set_default_age(age):
# 后者是根据取值范围的各个取值的频率来换分,划分后的某个区间的频率数相同
# print(dataset.tail())
dataset['CategoricalAge'] = pd.cut(dataset['Age'], 5,labels=[0,1,2,3,4])

return full_data
def data_feature_select(full_data):
"""
Expand Down Expand Up @@ -279,13 +279,14 @@ def xgboost_change_param(train_X,train_y):
# XGBoost调参
# xgboost_change_param(train_X,train_y)

xgb = XGBClassifier(learning_rate=0.1,n_estimators=59,
xgb1 = XGBClassifier(learning_rate=0.1,n_estimators=59,
max_depth=7,min_child_weight=3,
gamma=0.3,subsample=0.8,
colsample_bytree=0.6,objective='binary:logistic',
nthread=2,scale_pos_weight=1,seed=10)
xgb.fit(train_X,train_y)
xgb1.fit(train_X,train_y)

y_test_pre = xgb.predict(test_X)
y_test_pre = xgb1.predict(test_X)
y_test_true = np.array(test_y['Survived'])
print ("the xgboost model Accuracy : %.4g" % metrics.accuracy_score(y_pred=y_test_pre, y_true=y_test_true))

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ HEXO个人博客地址:[小简铺子](https://jianwenjun.xyz)
[决策树相关算法——Boosting之Adaboost&GBDT详细分析与实现](https://jianwenjun.xyz/2018/04/12/%E5%86%B3%E7%AD%96%E6%A0%91%E7%9B%B8%E5%85%B3%E7%AE%97%E6%B3%95%E2%80%94%E2%80%94Boosting%E4%B9%8BAdaboost-GBDT%E8%AF%A6%E7%BB%86%E5%88%86%E6%9E%90%E4%B8%8E%E5%AE%9E%E7%8E%B0/)
>本篇博客主要记录的是集成学习中的Boosting提升算法的相关实现,主要分为以下四个部分,Boosting的提出,Boosting经典算法Adaboost的分析与实现,Adaboost算法的特例提升树的分析,梯度提升算法GBDT的提出原因及分析。
[决策树相关算法——XGBoost原理分析及实例实现(一)](https://jianwenjun.xyz/2018/05/02/%E5%86%B3%E7%AD%96%E6%A0%91%E7%9B%B8%E5%85%B3%E7%AE%97%E6%B3%95%E2%80%94%E2%80%94XGBoost%E5%8E%9F%E7%90%86%E5%88%86%E6%9E%90%E5%8F%8A%E5%AE%9E%E4%BE%8B%E5%AE%9E%E7%8E%B0-%E4%B8%89/)
[决策树相关算法——XGBoost原理分析及实例实现(二)](https://jianwenjun.xyz/2018/04/27/%E5%86%B3%E7%AD%96%E6%A0%91%E7%9B%B8%E5%85%B3%E7%AE%97%E6%B3%95%E2%80%94%E2%80%94XGBoost%E5%8E%9F%E7%90%86%E5%88%86%E6%9E%90%E5%8F%8A%E5%AE%9E%E4%BE%8B%E5%AE%9E%E7%8E%B0-%E4%BA%8C/)
[决策树相关算法——XGBoost原理分析及实例实现(三)](https://jianwenjun.xyz/2018/05/02/%E5%86%B3%E7%AD%96%E6%A0%91%E7%9B%B8%E5%85%B3%E7%AE%97%E6%B3%95%E2%80%94%E2%80%94XGBoost%E5%8E%9F%E7%90%86%E5%88%86%E6%9E%90%E5%8F%8A%E5%AE%9E%E4%BE%8B%E5%AE%9E%E7%8E%B0-%E4%B8%89/)
>上述3篇博客主要记录的是XGBoost的代价函数的优化过程,XGBoost在构建决策树结构时,知道如何评定划分点的好坏的情况下,如何遍历查找出该树结构的切分点。最后,使用XGBoost对kaggle中的初级赛题Titanic: Machine Learning from Disaster进行预测的实例。
#### 1.2神经网络
[TensorFlow实现多层感知机及可视化训练过程中的数据记录](http://blog.csdn.net/u014732537/article/details/79412672) —— [代码地址](https://github.com/JianWenJun/MLDemo/blob/master/ML/TensorDemo/NN_tf.py)
>本篇博客主要有2个目的,第一,记录学习使用TensorFlow的操作流程;第二,将TensorFlow训练数据模型过程中的参数数据进行可视化记录。
Expand Down

0 comments on commit 36df7d5

Please sign in to comment.