dash使用

In recent years, we have seen an explosion in the usage of Machine Learning (ML) algorithms for automating and supporting human decisions. From helping doctors in diagnosing potential diseases that could render diabetic patients blind, to supporting financial analysts in equity management, the impact of ML is irrefutable. However, as algorithms become more sophisticated, it becomes harder to understand how it makes decisions. As a result, various harmful biases could arise in critical situations, such as when ML is used to determine credit limit for credit cards or applied to facial recognition by law enforcement agencies. In order to identify and mitigate the effect of such biases before the model is deployed, it is important to leverage explainable AI (xAI) to better understand which features and factors have the most impact on the final output of the model. This information can then be utilized to help AI developers understand why a certain model might not be performing well in certain scenarios, or just in general. At the same time, such techniques could help us uncover more insights about a problem than simply using black-box models. Ultimately, such techniques can help both technical and non-technical stakeholders better understand and appreciate AI models.

近年来,我们看到了用于自动执行和支持人工决策的机器学习(ML)算法的爆炸式增长。 从帮助医生诊断可能使糖尿病患者失明的潜在疾病 ,到在股权管理方面为财务分析师提供支持 ,ML的影响是无可辩驳的。 但是,随着算法变得越来越复杂,变得越来越难以理解它如何做出决策。 结果,在紧急情况下可能会出现各种有害的偏见,例如当使用ML确定信用卡的信用额度或由执法机构将其应用于面部识别时 。 为了在部署模型之前识别并减轻此类偏差的影响,重要的是利用可解释的AI(xAI)更好地了解哪些特征和因素对模型的最终输出影响最大。 然后,可以利用此信息来帮助AI开发人员理解为什么某些模型在某些情况下或只是在一般情况下表现不佳。 同时,这些技术可以帮助我们发现更多关于问题的见解,而不仅仅是使用黑匣子模型。 最终,此类技术可以帮助技术和非技术利益相关者更好地理解和欣赏AI模型。

用Shapley值解释黑匣子模型 (Explaining black-box models with Shapley Values)

Many researchers and software developers have been working on the subject of explainable AI systems for many years. One approach, which is called SHapley Additive exPlanations (SHAP), has been increasingly popular in the past few years. It has been used to identify chronic kidney disease, to model US mortality factors and to help anaesthesiologists during surgeries. By applying a game theory concept called Shapley values, you can interpret computer vision models, linear models, tree-based models, and more.

许多研究人员和软件开发人员多年来一直在研究可解释的AI系统。 在过去的几年中,一种称为SHapley Additive ExPlanations(SHAP)的方法越来越受欢迎。 它已被用于识别慢性肾脏疾病 ,模拟美国的死亡率因素并在手术过程中帮助麻醉师 。 通过应用称为Shapley值的博弈论概念,您可以解释计算机视觉模型,线性模型,基于树的模型等。

使用Dash构建可投入生产的xAI应用 (Building a production-ready xAI app with Dash)

The dashboard was fully built in Python and runs SHAP and LightGBM in real-time. Try it out!
该仪表板完全使用Python构建,并 实时 运行 SHAP LightGBM 试试看

Let’s take, as an example, the task of predicting tips received by waiters based on features such as the total bill, the gender of the payer, the day and time, etc. A black-box model that ingests all those features just to predict the tips could be highly biased and might not be useful for business analysts trying to understand the behavior of the customers. However, by applying SHAP, we can gain more insights on the impact of each feature on the final value predicted by the model, which can be useful for understanding how the model perceives factors prone to biases, such as sex, age, race, etc.

让我们以一个示例为例,该任务根据总账单,付款人的性别,日期和时间等功能来预测服务员收到的小费 。一个黑盒模型会吸收所有这些功能,以便进行预测这些提示可能有很大的偏见,可能对试图了解客户行为的业务分析师没有用。 但是,通过应用SHAP ,我们可以深入了解每个功能对模型预测的最终值的影响,这对于理解模型如何感知容易产生偏见的因素(例如性别,年龄,种族等)很有用。 。

In order to make such xAI methods more accessible and interactive, we used Dash to build an end-to-end application that runs an ensemble model called LightGBM on custom inputs. The dashboard and the full model are deployed on our Dash Enterprise Kubernetes servers, and both the black-box model and SHAP are running in real-time.

为了使此类xAI方法更易于访问和交互,我们使用Dash构建了一个端到端应用程序,该应用程序在自定义输入上运行名为LightGBM的集成模型。 仪表板和完整模型已部署在我们的Dash Enterprise Kubernetes服务器上,黑盒模型和SHAP均实时运行。

In the app, you will find controls that let you control the total bill, sex, day of the week, etc. Each one of those controls defines an input feature, and every time you update them, a new sample is given to the trained LightGBM model.

在应用程序中,您将找到控件,可用于控制总账单,性别,星期几等。这些控件中的每个控件都定义了一种输入功能,每次更新时,都会向受训人员提供一个新示例。 LightGBM模型。

However, since LightGBM is a type of gradient boosting method, it is hard to directly interpret it. Therefore, we simulated the controls to allow the app to compute the SHAP values and display them in a waterfall chart.

但是,由于LightGBM是一种梯度增强方法 ,因此很难直接对其进行解释。 因此,我们模拟了控件,以允许该应用计算SHAP值并将其显示在瀑布图中 。

In addition to specifying custom model inputs, you can also select a random example from the training set. Whenever you do this, you will see the real label appear on the right side (as a scatter point). You can then tweak the feature values to see how the various SHAP values change.

除了指定自定义模型输入之外,您还可以从训练集中选择一个随机示例。 每当您执行此操作时,您都会看到实际标签显示在右侧(作为分散点)。 然后,您可以调整要素值以查看各种SHAP值如何变化。

Moreover, you can also decide to make binary predictions (e.g. the sex of the customer) and interact with the graph using the Plotly modebar.

此外,您还可以决定进行二进制预测(例如,客户的性别),并使用Plotly模式栏与图表进行交互 。

缩小Python和高级分析之间的差距 (Bridging the gap between Python and advanced analytics)

The current state-of-the-art ML algorithms (e.g. gradient boosting and neural networks) for modeling continuous and categorical features are usually written in optimized C/C++ codes, but they can be conveniently used through Python. As a result, powerful xAI libraries like SHAP are also interfaced in the same language, which lets us train and explain powerful models in just a few lines of Python code. However, although such models are popular in the ML community, considerable effort needs to be made to port them into traditional BI tools, including having to connect external servers and add third-party extensions. Furthermore, building UIs that lets you train these Python-based ML libraries can quickly become cumbersome if you are using those BI tools.

当前用于建模连续和分类特征的最新ML算法(例如,梯度增强和神经网络)通常以优化的C / C ++代码编写,但是可以通过Python方便地使用它们。 结果,像SHAP这样的功能强大的xAI库也以相同的语言进行接口,这使我们仅用几行Python代码就可以训练和解释功能强大的模型。 但是,尽管这样的模型在ML社区中很流行,但是需要付出很大的努力才能将它们移植到传统的BI工具中,包括必须连接外部服务器并添加第三方扩展。 此外,如果使用那些BI工具,构建可让您训练这些基于Python的ML库的UI很快就会变得很麻烦。

With Dash, you can seamlessly integrate popular and up-to-date ML libraries, which enable Dash app users to quickly answer “what if?” questions, and probe what the ML models have learned from the data. Most of the time, all you need to do is to install and freeze such libraries using pip, which is usually done in a few lines:

借助Dash,您可以无缝集成流行的和最新的ML库,这使Dash应用程序用户可以快速回答“如果...怎么办”。 问题,并探讨ML模型从数据中学到了什么。 大多数时候,您需要做的就是使用pip安装和冻结此类库,通常只需几行即可完成:

pip install dash shap lightgbmpip freeze > requirements.txt

When you are ready to share your dashboard, all the dependencies and deployment are handled by the Dash Enterprise App Manager.

当您准备共享仪表板时,所有依赖项和部署都由Dash Enterprise App Manager处理 。

获得超越黑匣子预测的见解 (Gaining insights beyond black-box predictions)

A classical argument against the use of more advanced models is that, although they can improve the accuracy, the complexity makes them harder to interpret. With linear regression, you can use the coefficients to judge which features weigh more than others for making a prediction; in the case of decision trees, you can visualize how the tree splits and set thresholds for deciding the output. In the case of deep neural networks and ensemble models, you can’t visualize the tree structure nor the coefficients; however, with SHAP, it’s possible to not only explain how features generally affect the model, but also how each feature value influences the output in a specific example. For example, the model might believe that female customers tend to tip more when they are going out with a friend for dinner (on a Saturday) than when they are grabbing lunch alone (on a Thursday).

反对使用更高级的模型的经典论据是,尽管它们可以提高准确性,但其复杂性使其难以解释。 通过线性回归,您可以使用系数来判断哪些特征比其他特征权重更大; 对于决策树,您可以可视化树的拆分方式并设置用于确定输出的阈值 。 在深度神经网络和集成模型的情况下,您无法可视化树结构或系数。 但是,使用SHAP,不仅可以说明要素通常如何影响模型,还可以在特定示例中说明每个要素值如何影响输出。 例如,该模型可能认为,女性顾客与朋友外出吃饭(星期六)时比他们单身午餐(星期四)时要多付小费。

Left: Thursday lunch alone. Right: Saturday Dinner with friends.
左:仅星期四午餐。 右:与朋友共进晚餐。

Such insight could either lead to a stronger understanding of customer behavior if it is backed by additional studies, or it could reveal some degree of systematic bias that would not have been otherwise uncovered without SHAP. With Dash, we make it easier to build and deploy custom dashboards that let you interpret all sorts of ML models, whether they are trained on predicting tips, or other types of data.

如果有其他研究的支持,则这种洞察力可能导致对客户行为的更深入了解,或者可能揭示某种程度的系统偏差,而如果没有SHAP,这是无法发现的。 借助Dash,我们可以更轻松地构建和部署自定义仪表板,使您可以解释各种ML模型,无论它们是根据预测技巧还是其他类型的数据进行训练的 。

将Python的力量掌握在业务用户手中 (Putting the power of Python in the hands of business users)

At Plotly, we are working on keeping Dash flexible, yet easy-to-use for building ML apps and dashboards. For this reason, we built our app with components from the Dash Enterprise Design Kit, which makes it easy to tailor apps to meet style guidelines without delving into HTML and CSS. For example, if you don’t like the color of the bars in the default waterfall charts, you can easily change it with the Design Kit Theme Editor.

在Plotly,我们致力于保持Dash的灵活性,但易于使用,用于构建ML应用程序和仪表板。 因此,我们使用Dash Enterprise Design Kit中的组件构建了应用程序,从而可以轻松定制应用程序以满足样式准则,而无需研究HTML和CSS。 例如,如果您不喜欢默认瀑布图中的条形颜色,则可以使用设计工具包主题编辑器轻松更改它。

Furthermore, new features in Dash like pattern-matching callbacks let you simplify the process of creating callbacks. As a result, you can create very complex callbacks between components with very little effort. As an example, there are six controls in our app (one for each input feature), but we only need to specify one Input and one State to our callback to control all the components at the same time:

此外,Dash中的新功能(例如模式匹配回调)使您可以简化创建回调的过程。 结果,您可以毫不费力地在组件之间创建非常复杂的回调。 例如,我们的应用程序中有六个控件(每个输入功能一个),但是我们只需为回调指定一个Input和一个State即可同时控制所有组件:

Then, in one line, we were able to construct a dictionary where the keys are the feature names and the values are what we will input to the model. From then on, it’s easy to process the dictionary in the input format most suitable to your model.

然后,我们可以在一行中构造一个字典,其中的键是要素名称,而值是我们将输入到模型的值。 从那时起,很容易以最适合您的模型的输入格式处理字典。

Are you interested in creating similar apps using state-of-the-art models and xAI algorithms? Contact us to learn more about how Dash Enterprise can help you build, design, and deploy ML dashboards — with no compromise.

您是否对使用最新模型和xAI算法创建类似应用感兴趣? 请与我们联系,以了解有关Dash Enterprise如何能够帮助您构建,设计和部署ML仪表板的更多信息,而不会做出任何妥协。

翻译自: https://medium.com/plotly/building-and-deploying-explainable-ai-dashboards-using-dash-and-shap-8e0a0a45beb6

dash使用


http://www.taodudu.cc/news/show-863773.html

相关文章:

  • 面向表开发 面向服务开发_面向繁忙开发人员的计算机视觉
  • 可视化 nltk_词嵌入:具有Genism,NLTK和t-SNE可视化的Word2Vec
  • fitbit手表中文说明书_使用机器学习预测Fitbit睡眠分数
  • redis生产环境持久化_在SageMaker上安装持久性Julia环境
  • alexnet vgg_从零开始:建立著名的分类网2(AlexNet / VGG)
  • 垃圾邮件分类 python_在python中创建SMS垃圾邮件分类器
  • 脑电波之父:汉斯·贝格尔_深度学习,认识聪明的汉斯
  • PyCaret 2.0在这里-新增功能?
  • 特征选择 回归_如何执行回归问题的特征选择
  • 建立神经网络来预测贷款风险
  • redshift教程_分析和可视化Amazon Redshift数据—教程
  • 白雪小町_町
  • 机器学习术语_机器学习术语神秘化。
  • centos有趣软件包_这5个软件包使学习R变得有趣
  • 求解决方法_解决方法
  • xml格式是什么示例_什么是对抗示例?
  • mlflow_在生产中设置MLflow
  • 神秘实体ALIMA
  • mnist数据集彩色图像_使用MNIST数据集构建多类图像分类模型。
  • bert使用做文本分类_使用BERT进行深度学习的多类文本分类
  • 垃圾邮件分类器_如何在10个步骤中构建垃圾邮件分类器
  • ai 图灵测试_适用于现代AI系统的“视觉图灵测试”
  • pytorch图像分类_使用PyTorch和Streamlit创建图像分类Web应用
  • 深度学习之对象检测_深度学习时代您应该阅读的12篇文章,以了解对象检测
  • python 梯度下降_Python解释的闭合形式和梯度下降回归
  • 内容管理系统_内容
  • opencv图像深度-1_OpenCV空间AI竞赛之旅(第1部分-初始设置+深度)
  • 概率编程编程_概率编程语言的温和介绍
  • TensorFlow 2.X中的动手NLP深度学习模型准备
  • 时间序列 线性回归 区别_时间序列分析的完整介绍(带R)::线性过程I

dash使用_使用Dash和SHAP构建和部署可解释的AI仪表盘相关推荐

  1. 构建指定仓库_使用Travis CI自动构建和部署你的GitBook

    本文,博主将会介绍利用Travis CI持续集成服务自动化构建和部署GitBook. 首先介绍一下TravisCI,下文摘自维基百科-Travis CI Travis CI是在软件开发领域中的一个在线 ...

  2. 初创公司如何搭建开发框架_我帮助初创企业构建和部署数据科学的框架

    初创公司如何搭建开发框架 I help startups go from "product" to "product+machine learning". 我帮 ...

  3. python dash教程_开发者必备神器Dash使用教程

    Dash是什么,为什么说对于开发者是必备工具?今天就让我们一起来认识一下这款程序员必备神器Dash.作为一名死coder,每天最常见的动作就是查看各种API文档,你一定有过同时打开N个窗口(HTML. ...

  4. 普元部署包部署找不到构建_让我们在5分钟内构建和部署AutoML解决方案

    普元部署包部署找不到构建 Practical machine learning used to be hard - and still is in some specialized areas. Av ...

  5. figma设计_如何在Figma中构建设计入门套件(第1部分)

    figma设计 Figma教程 (Figma Tutorial) Do you like staring at a blank canvas every time you start a new pr ...

  6. netcore 内存限制_.NET Core 和 Serverless 构建飞速发展的架构

    (给DotNet加星标,提升.Net技能) 英文:samueleresca.net 译文:cnblogs.com/Rwing/p/fast-growing 译者:Rwing 本篇文章的第一部分介绍了有 ...

  7. webflow如何使用_如何使用Webflow构建和部署动态投资组合网站

    webflow如何使用 Welcome back to the series, 'How to Build and Deploy a Dynamic Portfolio Website with We ...

  8. gitlab ci 自动化部署_前端gitLab加jenkins自动化构建和部署,以及服务器常用的linux命令行操作,免密登录...

    常用的linux命令行操作 将项目部署到服务器后,需要查看文件是否已经部署成功,已经对文件进行增删改查操作,就需要用到命令行操作,常用操作如下: ll 罗列出当前文件或目录的详细信息,含有时间.读写权 ...

  9. 构建服务器_如何使用无服务器构建完整的后端系统

    构建服务器 This article will teach you how to build and deploy everything you need to be able to build a ...

最新文章

  1. 爱上MVC3系列~开发一个站点地图(俗称面包屑)
  2. lvm自动扩容到固定分区脚本
  3. 导出对象_从代数几何到导出代数几何:形变与逼近
  4. 使用接口改变已经装箱的值类型的字段
  5. 关于规则引擎一些基本理论的积累
  6. Tornado学习笔记(四)
  7. oracle右连接失效,oracle 右连接
  8. Android开发:shape和selector和layer-list的(详细说明)
  9. 安卓内边距padding与外边距magrin
  10. python纵向数据分析_python数据分析三个重要方法之:numpy和pandas
  11. Fedora/RedHat安装Mysql8.0
  12. 【计算机视觉】期刊整理
  13. 【英语学习】【WOTD】hoodwink 释义/词源/示例
  14. 有哪些 Java 源代码看了后让你收获很多,代码思维和能力有较大的提升?...
  15. 浅析桌面虚拟化给企业带来的价值
  16. Android8.1 framework 微信付款码显示不出来
  17. 计步器 c语言,ADXL345单片机计步器程序
  18. Android神笔之Paint
  19. 苹果手机计算机隐藏照片app,‎App Store 上的“秘密计算器 - 隐藏私人照片和视频”...
  20. File Storage:文件存储

热门文章

  1. Redis的几个认识误区
  2. Java异常处理-----java异常体系
  3. dubbo源码分析(3)
  4. 2011-09-07 00:16 ubuntu 如何修改当前用户名
  5. 网络工程师需要具备哪些素质或专业技术
  6. 熊猫烧香病毒企业局域网网完整解决方案
  7. html5 选择列表,Html5添加基于列表的选择美化插件教程
  8. c++制表符_在Linux命令行中将制表符(tab)转换为空格
  9. java加密工作模式None_java加解密算法--对称加密工作模式
  10. Common Number(奇偶二分+找规律)