首页 \ 问答 \ R中的SVM分类图(SVM Classification Plot in R)

R中的SVM分类图(SVM Classification Plot in R)

我是R的初学者。当在R中拟合支持向量机模型时,我得到如下的分类:其中决策边界是曲线:

在这里输入图像描述

但我宁愿有一个如下的决定边界是平稳的线。

在这里输入图像描述


I am a beginner in R. When fit an SVM model in R, I get a classification as below Where the decision boundary is a curve:

enter image description here

But I would rather have one as below Where the decision boundary is a smooth line.

enter image description here


原文:https://stackoverflow.com/questions/37408673
更新时间:2022-03-09 18:03

最满意答案

我认为你得到[]是因为你在启动时发布了数据,当还没有准备好时,让那个订阅被动反应。

Tracker.autorun(function(){
   Meteor.subscribe("states", function(){
      console.log(states, states.find(), states.find().fetch());
   });
});

可选的

没有理由在isServer/isClient if语句中声明集合

由于您从良好实践开始(删除insecure/autopublish包)

让我们来做。

首先创建文件夹结构。 (检查meteor / structuringyourapp和这个SO )。

appName/lib/collection.js放了这段代码。

states = new Meteor.Collection("states");
//optional you can place this subscribe inside the appName/client/main.js
if(Meteor.isClient){
   Meteor.subscribe("states", function(){
      console.log(states, states.find(), states.find().fetch());
   });
}

并在appName/server/publish.js

Meteor.publish("states", function () {
    return states.find();
  });

I think you are getting [] because you are publishing the data on the startup, when isn't ready, lets make that subscribe reactive.

Tracker.autorun(function(){
   Meteor.subscribe("states", function(){
      console.log(states, states.find(), states.find().fetch());
   });
});

OPTIONAL

There is no reason to declare the collections inside the isServer/isClient if statements

Since you are starting with the Good practices (removing insecure/autopublish packages)

Lets do the follow.

First Create the folder structure. (check meteor/structuringyourapp and this SO).

Inside the appName/lib/collection.js put this code.

states = new Meteor.Collection("states");
//optional you can place this subscribe inside the appName/client/main.js
if(Meteor.isClient){
   Meteor.subscribe("states", function(){
      console.log(states, states.find(), states.find().fetch());
   });
}

and on the appName/server/publish.js

Meteor.publish("states", function () {
    return states.find();
  });

相关问答

更多
  • 我认为你得到[]是因为你在启动时发布了数据,当还没有准备好时,让那个订阅被动反应。 Tracker.autorun(function(){ Meteor.subscribe("states", function(){ console.log(states, states.find(), states.find().fetch()); }); }); 可选的 没有理由在isServer/isClient if语句中声明集合 由于您从良好实践开始(删除insecure/autopubl ...
  • 在您尝试访问收集数据时,您的订阅似乎尚未ready ,这是一个常见问题。 当您通过模板访问收集数据时,很可能是通过使用模板帮助程序,这些帮助程序恰好是被动的,因此当您的收集ready时它们将重新运行,从而显示正确的数据。 但是,在非反应式脚本中访问集合时,如果订阅尚未ready就会显示为空。 您可以尝试在脚本中使用此模式,仅在订阅准备就绪时执行代码: Meteor.subscribe("mySubscription",function(){ // we are inside the ready call ...
  • Meteor使用的Mongo客户端实现称为minimongo 。 它目前仅实现可用Mongo功能的子集。 Minimongo目前不支持基于预测的预测。 来自Meteor API的Field说明符部分: 目前,客户端无法使用$和$ elemMatch等现场操作员。 这是您在客户端和Mongo shell之间获得不同结果的原因之一。 您可以通过将"items.$"更改为"items"来获得与原始查询最接近的结果: Categories.find( { "items.slug": "mc" }, { "i ...
  • 我的问题是我没有以正确的方式保存照片,我正在调用onSuccess(placeHolder.localIdentifier); 在performChanges块内,而不是在completionHandler块内。 这是我现在用来保存照片的代码: __block PHAssetCollection *album = [AuxiliaryFunctions getMyAlbumWithName:@"MyAlbumName" orWithIdentifier:@""]; if(album == nil) ...
  • 你使用autosubscribe吗? 您可能需要确保sbscription已准备就绪。 请参阅Meteor:如何判断数据库何时准备就绪? 并在流星集合加载时显示加载器 。 您确实看到CalEvents.find().fetch()在控制台中返回项目的原因是,当您进行该调用时,订阅已准备就绪。 但在你的events = []; ... events = []; ...代码(我假设它位于client目录下的文件中,您可能认为订阅数据已经到达,而实际上它没有。 一个有用的调试工具是Chrome的设备模式(DevT ...
  • 我想今晚早些时候我的服务器再次打嗝,我会在这里回复一个答案。 原来这是前一组项目数据之间的字符编码问题(我实际上不知道它以前是什么编码)和我们的项目表现在使用的更新的utf-8编码。 PHP正在挂起几个没有很好转换的字符(一些边缘情况和奇数字符),而PHP反过来又返回一个有效的数组,但是json_encode无法处理并且会使脚本崩溃而无声地失败(奇怪的是在我们的jQuery客户端实现和我们自己的错误检查php后端(更奇怪的是,需要更多的调查,但这超出了这个问题的范围)。 我的解决方案是直接从API和项目模式 ...
  • 您必须花时间将搜索结果发布到客户端。 尝试将您的搜索包装在Tracker.autorun ,例如: Tracker.autorun(() => { let userResults = UserIndex.search(input).fetch(); console.log(userResults); }); 在进行一次搜索后观察记录的结果; 它们将开始为空,但随后结果发布到客户端,您将看到记录的正确结果。 You have to give time for your search results ...
  • 您可以将回调结果的值保存到会话变量或反应变量,然后再检索。 import { Links, Nodes } from '../api/main.js'; import './main.html'; Template.viz.rendered = function () { Meteor.call("traverseDocument", 'VALUE001', function (error, results) { if(error) { // handle error } ...
  • 解决您的问题: 在insert函数的回调中得到结果导致insert异步工作。 solution for your problem: get the result in the callback of the insert function cause insert works asynchronously.
  • 根本问题是发布函数应引用Meteor的Mongo.Collection名称FlightCounts ,而不是原始的db.collection名称flightCounts : Meteor.publish('flightCounts', function(){ return FlightCounts.find(); }); 我也同意之前的回答,您的模板应该检查以确保在记录数据之前订阅已准备就绪,否则它可能还没有到达: Template.hello.onRendered(function(){ thi ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)