【问题标题】:How to plot the line that separates 2 classes,using output of perceptron MATLAB如何使用感知器 MATLAB 的输出绘制分隔 2 个类的线
【发布时间】:2011-06-22 03:54:59
【问题描述】:

运行perceptron code in Matlab 后,我得到以下权重:

result=
    2.5799
    2.8557
    4.4244
   -4.3156
    1.6835
   -4.0208
   26.5955
  -12.5730
   11.5000

如果我从这些权重开始:

w = [ 1 1 1 1 1 1 1 1 1]'; 

如何绘制分隔 2 个类的线。 有必要求解线性系统,但如何求解?

Line = [result,w] 

% solve the linear system, am I correct doing this?
rref(Line')
  • 用于绘图的值的计算方法是否正确?
  • 如何绘制线? 有什么例子???

【问题讨论】:

  • 您是在问如何计算这条线(即它的所有系数),还是在知道它之后如何绘制它。?跨度>
  • 两者。如何计算它,好吧,一旦我有了权重,我就尝试使用 rref(Line'),但是想知道这种方法是否是最好的,另一方面要绘制它,我知道正在使用 plot(... 但是什么)

标签: matlab artificial-intelligence plot perceptron


【解决方案1】:
Yaux = sign(w'*X);  % w is the result of calling perceptron
scatter(X(1,:),X(2,:),100,Yaux);
hold on;
plot([0 w(1)], [0 w(2)]); 
hold off; 

似乎适用于二维

【讨论】:

  • 你能更详细地解释一下那些不使用matlab的人吗?你的分隔线是如何获得分数的?
猜你喜欢
  • 2017-02-07
  • 2015-07-20
  • 2016-10-27
  • 2020-07-20
  • 1970-01-01
  • 2014-04-13
  • 2015-09-26
相关资源
最近更新 更多