Samples.zip 示例压缩文件夹包含:
要重现问题,请执行以下步骤:
lin2 =joblib.load('model.pkl')加载线性回归模型x_test_2 = pd.read_csv('x_test.csv').drop(['Unnamed: 0'],axis=1)加载x_test_2explainer_test = shap.Explainer(lin2.predict, x_test_2)
shap_values_test = explainer_test(x_test_2)
Run Code Online (Sandbox Code Playgroud)
partial_dependence_plot查看错误信息:ValueError:x 和 y 不能大于二维,但具有形状 (2,) 和 (2, 1, 1)
sample_ind = 3
shap.partial_dependence_plot(
"new_personal_projection_delta",
lin.predict,
x_test, model_expected_value=True,
feature_expected_value=True, ice=False,
shap_values=shap_values_test[sample_ind:sample_ind+1,:]
)
Run Code Online (Sandbox Code Playgroud)
例外:waterfall_plot 需要模型输出的标量 base_values 作为第一个参数,但您已传递一个数组作为第一个参数!尝试 shap.waterfall_plot(explainer.base_values[0], value[0], X[0]) 或对于多输出模型尝试 shap.waterfall_plot(explainer.base_values[0], value[0][0], X[ 0])。
shap.plots.waterfall(shap_values_test[sample_ind], max_display=14)
partial_dependence_plot& shap.plots.waterfall?我尝试运行位于 shell 文件中的 dotnet 命令,该命令将在 docker 构建过程中由 dockerfile 调用。
\n\n这是 dockerfile 片段:
\n\nFROM ubuntu:16.04\nFROM microsoft/dotnet:2.2-sdk as build-env\n\n# .net core \nRUN apt-get update -y && apt-get install -y wget apt-transport-https\nRUN wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && dpkg -i packages-microsoft-prod.deb\nRUN apt-get update -y && apt-get install -y aspnetcore-runtime-2.2=2.2.1-1\n\n# dotnet tool command\nRUN apt-get update -y && apt-get install dotnet-sdk-2.2 -y\n# for dot net tool #/sf/ask/3638423211/\nENV PATH="${PATH}:/root/.dotnet/tools"\n\n# Supervisor\nRUN apt-get update -y && apt-get install -y supervisor && mkdir -p /etc/supervisor\n\n# main script …Run Code Online (Sandbox Code Playgroud) 我正在使用 VB.NET,我有:
Start按钮Stop按钮While循环当Start按下按钮时,While循环开始。我想在Stop按下按钮时停止循环。
我曾尝试使用Applications.DoEvents,但当Stop按下按钮两次时循环停止。
下面是我的代码使用 Applications.DoEvents
Dim stopclick As Boolean = False
Private Sub btnPlay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPlay.Click
btnForward.Enabled = False
btnStop.Enabled = True
While
' Perform the while statements
If stopclick = True Then
stopclick = False
Application.DoEvents()
Exit While
End If
End While
End Sub
Private Sub btnStop_Click(ByVal sender As Object, …Run Code Online (Sandbox Code Playgroud) 我可以使用以下代码执行子菜单列表:
Dim cm As GoContextMenu = New GoContextMenu(view) 'GoContextMenu Inherits System.Windows.Forms.ContextMenu
Dim subTop(1) As MenuItem ' if you have 2 submenu, then the array count is 2-1 = 1; subm(1)
Dim orMenu As New MenuItem("OR", New EventHandler(AddressOf Me.OrTopGateItem_Click))
Dim andMenu As New MenuItem("AND", New EventHandler(AddressOf Me.AndTopGateItem_Click))
cm.MenuItems.Add(New MenuItem("Type", subTop))
Run Code Online (Sandbox Code Playgroud)
从上面的例子中,我设法创建一个子菜单,如下图所示: 我的子菜单结果的屏幕截图
如何在运行时动态添加更多子菜单?
谢谢.