# TensorFlow Model Remediation
TensorFlow Model Remediation is a library that provides solutions for machine
learning practitioners working to create and train models in a way that reduces
or eliminates user harm resulting from underlying performance biases.
[![PyPI version](https://badge.fury.io/py/tensorflow-model-remediation.svg)](https://badge.fury.io/py/tensorflow-model-remediation)
[![Tutorial](https://img.shields.io/badge/doc-tutorial-blue.svg)](https://www.tensorflow.org/responsible_ai/model_remediation/min_diff/tutorials/min_diff_keras)
[![Overview](https://img.shields.io/badge/doc-overview-blue.svg)](https://www.tensorflow.org/responsible_ai/model_remediation)
## Installation
You can install the package from `pip`:
```shell
$ pip install tensorflow-model-remediation
```
Note: Make sure you are using TensorFlow 2.x.
## Documentation
This library contains a collection of machine learning remediation techniques
for addressing potential bias in a model.
Currently TensorFlow Model Remediation contains the below techniques:
* MinDiff technique: Typically used to ensure that a model predicts the
preferred label equally well for all values of a sensitive attribute.
Helpful when trying to achieve (equality of
opportunity)[https://developers.google.com/machine-learning/glossary/fairness#equality-of-opportunity].
* Counterfactual Logit Pairing technique: Typically used to ensure that a
model’s prediction does not change between “counterfactual pairs”, where the
sensitive attribute referenced in a feature is different. Helpful when
trying to achieve
[counterfactual fairness](https://developers.google.com/machine-learning/glossary/fairness#counterfactual-fairness).
We recommend starting with the
[overview guide](https://www.tensorflow.org/responsible_ai/model_remediation) to
get an idea of TensorFlow Model Remediation. Next try one of our interactive
guides like the
[MinDiff tutorial notebook](https://www.tensorflow.org/responsible_ai/model_remediation/min_diff/tutorials/min_diff_keras).
[Counterfactual tutorial notebook](https://www.tensorflow.org/responsible_ai/model_remediation/counterfactual/guide/counterfactual_keras).
```python
import tensorflow_model_remediation as tfmr
import tensorflow as tf
# Start by defining a Keras model.
original_model = ...
# Next pick the remediation technique you'd like to use. For example, a
# MinDiff implementation might look like the below:
# Set the MinDiff weight and choose a loss.
min_diff_loss = tfmr.min_diff.losses.MMDLoss()
min_diff_weight = 1.0 # Hyperparamater to be tuned.
# Create a MinDiff model.
min_diff_model = tfmr.min_diff.keras.MinDiffModel(
original_model, min_diff_loss, min_diff_weight)
# Compile the MinDiff model as you normally would do with the original model.
min_diff_model.compile(...)
# Create a MinDiff Dataset and train the min_diff_model on it.
min_diff_model.fit(min_diff_dataset, ...)
```
#### *Disclaimers*
*If you're interested in learning more about responsible AI practices, including*
*fairness, please see Google AI's [Responsible AI Practices](https://ai.google/education/responsible-ai-practices).*
*`tensorflow/model_remediation` is Apache 2.0 licensed. See the
[`LICENSE`](LICENSE) file.*
没有合适的资源?快使用搜索试试~ 我知道了~
tensorflow_model_remediation-0.1.7.tar.gz
0 下载量 90 浏览量
2024-03-28
23:51:45
上传
评论
收藏 88KB GZ 举报
温馨提示
共77个文件
py:67个
txt:4个
pkg-info:2个
Python库是一组预先编写的代码模块,旨在帮助开发者实现特定的编程任务,无需从零开始编写代码。这些库可以包括各种功能,如数学运算、文件操作、数据分析和网络编程等。Python社区提供了大量的第三方库,如NumPy、Pandas和Requests,极大地丰富了Python的应用领域,从数据科学到Web开发。Python库的丰富性是Python成为最受欢迎的编程语言之一的关键原因之一。这些库不仅为初学者提供了快速入门的途径,而且为经验丰富的开发者提供了强大的工具,以高效率、高质量地完成复杂任务。例如,Matplotlib和Seaborn库在数据可视化领域内非常受欢迎,它们提供了广泛的工具和技术,可以创建高度定制化的图表和图形,帮助数据科学家和分析师在数据探索和结果展示中更有效地传达信息。
资源推荐
资源详情
资源评论
收起资源包目录
tensorflow_model_remediation-0.1.7.tar.gz (77个子文件)
tensorflow_model_remediation-0.1.7
tensorflow_model_remediation
__init__.py 2KB
tools
__init__.py 705B
tutorials_utils
__init__.py 802B
min_diff_keras_utils.py 3KB
min_diff_keras_utils_test.py 4KB
uci
utils.py 12KB
__init__.py 1KB
utils_test.py 12KB
build_api_docs.py 3KB
version.py 669B
min_diff
__init__.py 740B
api_test.py 2KB
keras
__init__.py 797B
utils
__init__.py 1KB
input_utils_test.py 36KB
input_utils.py 18KB
structure_utils.py 9KB
structure_utils_test.py 10KB
models
__init__.py 779B
min_diff_model.py 33KB
min_diff_model_test.py 49KB
losses
base_loss.py 16KB
__init__.py 1KB
mmd_loss_test.py 12KB
mmd_loss.py 6KB
base_loss_test.py 10KB
loss_utils_test.py 4KB
adjusted_mmd_loss.py 6KB
loss_utils.py 3KB
absolute_correlation_loss_test.py 6KB
kernels
__init__.py 920B
gaussian_kernel.py 3KB
gaussian_kernel_test.py 4KB
base_kernel.py 4KB
laplacian_kernel.py 3KB
kernel_utils_test.py 3KB
base_kernel_test.py 2KB
kernel_utils.py 3KB
laplacian_kernel_test.py 4KB
adjusted_mmd_loss_test.py 6KB
absolute_correlation_loss.py 3KB
common
__init__.py 675B
types.py 1KB
docs.py 1KB
counterfactual
__init__.py 759B
api_test.py 2KB
keras
__init__.py 830B
utils
__init__.py 1KB
input_utils_test.py 13KB
input_utils.py 10KB
structure_utils.py 5KB
structure_utils_test.py 5KB
models
__init__.py 805B
counterfactual_model.py 25KB
counterfactual_model_test.py 30KB
losses
base_loss.py 9KB
__init__.py 1KB
pairwise_cosine_loss.py 2KB
pairwise_cosine_loss_test.py 5KB
pairwise_mse_loss_test.py 6KB
pairwise_absolute_difference_loss_test.py 7KB
base_loss_test.py 2KB
loss_utils_test.py 3KB
loss_utils.py 3KB
pairwise_absolute_difference_loss.py 2KB
pairwise_mse_loss.py 2KB
setup.py 3KB
AUTHORS 321B
LICENSE 11KB
PKG-INFO 5KB
tensorflow_model_remediation.egg-info
SOURCES.txt 5KB
top_level.txt 29B
PKG-INFO 5KB
requires.txt 50B
dependency_links.txt 1B
setup.cfg 38B
README.md 3KB
共 77 条
- 1
资源评论
程序员Chino的日记
- 粉丝: 2815
- 资源: 3万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 卡方数据.sav
- Python实现基于Django框架的二手物品购物网站设计源码+数据库.zip
- 基于Python和Django的二手物品购物网站设计源码+数据库脚本.zip
- 【计算机毕业设计】基于h5的移动网赚项目小程序【源码+lw+部署文档+讲解】
- 【计算机毕业设计】基于ssm-vue的oa系统设计与实现【源码+lw+部署文档+讲解】
- 基于pytorch实现的YOLOV5+SORT的车辆行人目标识别及追踪系统源码.zip
- 【计算机毕业设计】基于servlet+jdbc的在线选房系统设计与实现【源码+lw+部署文档+讲解】
- 投身科技创新,勇担时代先锋.pptx
- 【计算机毕业设计】基于SSM的仿微博系统的设计与实现【源码+lw+部署文档+讲解】
- 使用 Web Components 实现,遵循 Material You 设计规范的 Web 前端组件库
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功