python处理grd格式文件_python sklearn中,GBDT模型训练之后,可以查看模型中树的分裂路径吗?...

这篇博客展示了如何使用Python进行GBDT(梯度提升决策树)模型训练,包括特征重要性计算、模型保存和加载,以及通过sklearn库可视化单棵决策树的过程。
摘要由CSDN通过智能技术生成

最近也在做这个,核心代码给你,如下:

import matplotlib.pyplot as plt

import numpy as np

from sklearn.datasets import make_classification

from sklearn.linear_model import LogisticRegression

from sklearn.ensemble import (RandomTreesEmbedding, RandomForestClassifier, GradientBoostingClassifier)

from sklearn.preprocessing import OneHotEncoder

from sklearn.model_selection import train_test_split

from sklearn.metrics import roc_curve,auc

from sklearn.externals import joblib

from sklearn.externals.six import StringIO

from sklearn import tree

import pydotplus

n_estimator = 4 # the number of base trees

X, y = make_classification(n_samples=100,n_features=4)

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3,random_state=0)

X_train, X_train_lr, y_train, y_train_lr = train_

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值