集成学习,xgboost.plot_importance 特征重要性(示例)

文章目录

  • 集成学习,xgboost.plot_importance 特征重要性
    • 源代码

集成学习,xgboost.plot_importance 特征重要性

源代码

# -*- coding:utf-8 -*-
# /usr/bin/python
'''
@Author  :  Errol 
@Describe:  
@Evn     :  
@Date    :   - 
'''
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from xgboost import XGBClassifier
from xgboost import plot_importance

### load datasets
digits = datasets.load_digits()

### data analysis
print(digits.data.shape)
print(digits.target.shape)

### data split
x_train, x_test, y_train, y_test = train_test_split(digits.data,
                                                    digits.target,
                

你可能感兴趣的:(机器学习原理讲解与代码实现,机器学习,深度学习实战讲解与分析)