首页 \ 问答 \ 平滑粗糙的地块(Smoothing out of rough plots)

平滑粗糙的地块(Smoothing out of rough plots)

我想在Matlab中绘制一些图。

细节:对于1类, p(x | c1)对于[2,4]之间的x是均匀的,参数a = 1b = 4 。 对于类2p(x | c2)是指数的,参数lambda = 1 。 除了p(c1)= p(c2)= 0.5之外,我想绘制两个类密度的草图,分别乘以P(c1)P(c2) ,作为x的函数,清楚地显示最优决策边界(或边界)。

我有解决这个问题的方法,这就是作者所做的( 我想得到 ),但是没有Matlab代码,所以我想自己做。

图片1

这就是我画的。

图片2

这是我写的MATLAB代码。

x=0:1:8;

pc1 = 0.5;
px_given_c1 = exppdf(x,1);
px_given_c2 = unifpdf(x,2,4);

figure;
plot(x,px_given_c1,'g','linewidth',3);
hold on;
plot(x,px_given_c2,'r','linewidth',3);
axis([0 8 0 0.5]);
legend('P(x|c_1)','P(x|c_2)');

figure;
plot(x,px_given_c1.*pc1,'g','linewidth',3);
hold on;
plot(x,px_given_c2.*(1-pc1),'r','linewidth',3);
axis([0 8 0 0.5]);
legend('P(x|c_1)P(c_1)','P(x|c_2)P(c_2)');

正如你所看到的,它们几乎是熟悉的,但我对这种均匀分布有问题,这是用红色绘制的。 我该怎么改变它?


I want to draw some plots in Matlab.

Details: For class 1, p(x|c1) is uniform for x between [2, 4] with the parameters a = 1 and b = 4. For class 2, p(x|c2) is exponential with parameter lambda = 1. Besides p(c1) = p(c2) = 0.5 I would like to draw a sketch of the two class densities multiplied by P(c1) and P(c2) respectively, as a function of x, clearly showing the optimal decision boundary (or boundaries).

I have the solution for this problem, this is what the writer did (and I want to get), but there's no Matlab code, so I want to do it all by myself.

IMAGE 1

And this is what I drew.

IMAGE 2

And this is the MATLAB code I wrote.

x=0:1:8;

pc1 = 0.5;
px_given_c1 = exppdf(x,1);
px_given_c2 = unifpdf(x,2,4);

figure;
plot(x,px_given_c1,'g','linewidth',3);
hold on;
plot(x,px_given_c2,'r','linewidth',3);
axis([0 8 0 0.5]);
legend('P(x|c_1)','P(x|c_2)');

figure;
plot(x,px_given_c1.*pc1,'g','linewidth',3);
hold on;
plot(x,px_given_c2.*(1-pc1),'r','linewidth',3);
axis([0 8 0 0.5]);
legend('P(x|c_1)P(c_1)','P(x|c_2)P(c_2)');

As you can see, they are almost smiliar, but I am having problem with this uniform distribution, which is drawn in red. How can I change it?


原文:https://stackoverflow.com/questions/13309089
更新时间:2023-11-18 09:11

最满意答案

根据用户运行Web服务(我不记得IIS6的默认值是什么,但怀疑它本质上是“NETWORK SERVICE”),如果它们受到保护,它将无法读取网络共享。 您最好的办法是为Web服务创建一个域帐户,然后使用“Internet信息服务(IIS)管理器”将应用程序池配置为以所述用户身份运行(注意:对于IIS 6,您还需要添加用户到LOCAL用户组“IIS_WPG”)。

一个小小的提示,你在整个问题中提到“网络驱动器”; 您的服务不会共享任何映射的网络驱动器,因此您需要为其提供完整的UNC路径(即\\server\share而不是m:\ )才能使其正常工作。


Depending on the user the web service is being run as (I can't remember what the default for IIS6 is but suspect it's essentially "NETWORK SERVICE"), it won't be able to read network shares if they're secured. Your best bet is to create a domain account for the web service to run under and use "Internet Information Services (IIS) Manager" to configure the application pool to run as said user (NOTE: For IIS 6 youy'll also need to add the user to the LOCAL user group "IIS_WPG").

One small note, you mention "network drives" throughout your question; your service will not share any of your mapped network drives, so you'll need to provide it with full UNC paths (i.e. \\server\share rather than m:\) for it to work.

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)