- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在缩放的输入数据上安装了 SVM,现在我正试图找到一种方法,将从缩放的数据中学到的决策边界转移到原始数据(非缩放的数据)。我该怎么做?
我使用以下内容来绘制决策边界:
svc0.fit(Xs, y)
plot_decision_regions(X=Xs, y=y ,clf=svc0,legend=2)
Xs_scaledback=scaler.inverse_transform(Xs)
plot_decision_regions(X=Xs_scaledback,y=y,clf=svc0,legend=2)
最佳答案
您是否尝试将数据缩放合并到估算器中?
像这样的东西
import numpy as np
import matplotlib.pyplot as plt
from sklearn.svm import SVC
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import load_iris
data_dict = load_iris()
X, y = data_dict['data'][:, :2], data_dict['target']
model = make_pipeline(StandardScaler(), SVC())
model.fit(X,y) # You should do a train test split
def plot_decision_boundary(pred_func, X, y):
# Set min and max values and give it some padding
x_min, x_max = X[:, 0].min() - .5, X[:, 0].max() + .5
y_min, y_max = X[:, 1].min() - .5, X[:, 1].max() + .5
h = 0.01
# Generate a grid of points with distance h between them
xx, yy = np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h))
# Predict the function value for the whole gid
Z = pred_func(np.c_[xx.ravel(), yy.ravel()])
Z = Z.reshape(xx.shape)
# Plot the contour and training examples
plt.contourf(xx, yy, Z, cmap=plt.cm.Spectral)
plt.scatter(X[:, 0], X[:, 1], c=y, cmap=plt.cm.Spectral)
plot_decision_boundary(model.predict, X, y)
Partly adapted from https://scikit-learn.org/stable/auto_examples/ensemble/plot_voting_decision_regions.html
关于python - 如何将从缩放数据中学到的决策边界转移到原始数据(缩放后的数据)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64530179/
是否有显示测试用例数量以提供决策/条件覆盖率的工具? 例如: if(x>0) if(x0) 3 个案例足以覆盖决策/条件。 if(x>0) if(x0) 4 个案例足以覆盖决策/条件。 这是真的吗?
我正在尝试找到一种优雅的方式来实现易于维护的决策算法,因为决策的条件可能经常变化。 我将尝试更具体地举一个例子: 假设我正在尝试管理一家餐厅厨房的 cooking 厨师团队。 每个厨师都知道如何 co
我需要一个 Android Activity ,它应该显示一个字段,如带有图像的标题和其下方的几个动态生成的项目(我认为是 1 到 100)。如果我不想让 headsection 滚动,我会使用 Li
我正在编写函数以从值列表中提供最大值(value)。我的问题是如果所有值都相同怎么办?例如, 30,29,34,45 简单。最大值为 45。现在, 20,20,20,20 这里的最大值是20吗?或者没
我需要知道哪个检索事件日志的速度更快,但我在比较中找不到:假设需要查找的所有列都有btree索引,需要查找的json对象中的所有键都有GIN索引。 case 1: ActivityID (in
我需要在我的 iPhone 应用程序中显示一个表格: neither the number of cells nor the contents are known at compile time, b
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 9 年前。 Improve this ques
这是针对在 MinGW/Windows 上使用 SDL 的小型游戏项目。 我正在研究一个物理引擎,我的想法是拥有一个Physics::Object,所有物理对象都应该派生自它,并且它会在全局 Phys
我有一个小的 LINQ 查询来填充下拉控件(WinForms Telerik 应用程序),其中的数据行显示两个值(ITNBR 和描述): var query = from i in db.ItemMa
我正在尝试使用 antlr 3 为我的语法生成词法分析器和解析器。有人可以解释这个错误是什么意思吗? error(211): T.g:14:6: [fatal] rule stmt has non-L
partykit包很好地表示了决策树。我遇到的唯一问题是标签很长然后它们重叠。是否可以移动这些标签以防止它(见下图中的蓝色箭头)? library("rpart") library("partykit
所以我环顾四周,似乎找不到合适的解决方案来解决我的问题。 问题 在我的布局中,我希望能够根据数据库中的内容选择在运行时是否存在导航项: 当前布局(导航栏) @Html.Acti
我目前正在创建一个机器学习 jupyter 笔记本作为一个小项目,并希望显示我的决策树。但是,我能找到的所有选项都是导出图形然后加载图片,这相当复杂。 所以想问问有没有办法不用导出加载图形,直接显示我
grammar AdifyMapReducePredicate; PREDICATE : PREDICATE_BRANCH | EXPRESSION ; PREDICA
我是一名优秀的程序员,十分优秀!