特征中重要的Python插件

本文探讨了三种用于评估特征重要性的Python工具:Permutation Importance、Partial Dependence Plots和SHAP。Permutation Importance通过改变单个特征值观察模型预测结果的变化;Partial Dependence Plots展示特征对模型输出的影响;而SHAP则提供了解释单个预测的深入理解。这些方法在机器学习和深度学习模型解释性方面发挥关键作用。
摘要由CSDN通过智能技术生成

1.Permutation Importance

import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split #分割训练集
from sklearn.ensemble import RandomForestClassifier #集成算法对解释模型效果是很好的

import warnings
warnings.filterwarnings("ignore")

data = pd.read_csv('C:/Users/lb/Desktop/test//FIFA Statistics.csv')
print(data.head(5) )

#Man of the Match 最佳球员作为y值
y = (data['Man of the Match'] == "Yes") # 转换标签
print(y[:5])

print('*'*80)
print(data.columns) #会把所有的列字段打印出来

print('*'*80)
a = [i for i in data.columns]
print(a)


feature_names = [i for i in data.columns if data[i].dtype in [np.int64]
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值