首页 > 编程知识 正文

matlab机器学习工具箱,机器人研究性学习

时间:2023-05-06 15:51:32 阅读:216266 作者:4856

http://blog.itpub.net/29829936/viewspace-2600454/

 

XAI是Github上的一个机器学习可解释性工具箱。XAI包含多种分析和评价数据和模型的工具。XAI在开发时遵循负责的机器学习的8个原则。

XAI是Github上的一个机器学习可解释性工具箱,地址为:

https://github.com/EthicalML/xai

安装及一些简单的用例如下:

安装

pip install xai

简单用例

XAI可以识别数据不平衡。我们先载入census数据集:

import xai.datadf = xai.data.load_census()df.head()

 

查看多列类别不平衡:

protected_cols = ["gender", "ethnicity", "age"]ims = xai.show_imbalances(df, protected_cols)

 

查看一列类别不平衡:

im = xai.show_imbalance(df, "gender")

 

查看一列与另一列相交的不平衡:

im = xai.show_imbalance(df, "gender", cross=["loan"])

 

利用上采样或下采样进行平衡:

bal_df = xai.balance(df, "gender", cross=["loan"], upsample=1.0)

 

创建一个平衡的测试-训练划分:

# Balanced train-test split with minimum 300 examples of # the cross of the target y and the column genderx_train, y_train, x_test, y_test = xai.balanced_train_test_split( x, y, cross=["gender"],  categorical_cols=categorical_cols, min_per_class=300)# Visualise the imbalances of gender and the target df_test = x_test.copy()df_test["loan"] = y_test_= xai.show_imbalance(df_test, "gender", cross=["loan"], categorical_cols=categorical_cols)

 

更多用例可以参考Github项目链接:

https://github.com/EthicalML/xai

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。