【发布时间】:2018-10-04 05:10:55
【问题描述】:
我正在自己研究机器学习,我发现了以下感知器的签名:
def ClassicPerceptron(W,X,Y,maxiter=1000,reorder=True):
"""ClassicPerceptron function implements the most basic perceptron.
This algorithm starts by reordering the training samples and their labels
if reorder is equal to True. Then, it iterates for all the samples, as many
times as it takes, to correctly classify all the samples, or until the number
of iterations reaches maxiter.
Parameters
----------
W : numpy array of floats
The initial set of weights for the perceptron classificator.
X : numpy array of floats
The dataset with the bias (first column is equal to 1.0).
Y : numpy array of floats
The labels (-1.0, ou 1.0) for each line of X.
maxiter : integer
The maximum number of iterations allowed before stopping.
reorder : boolean
reorder the training samples and their labels.
Returns
-------
W : numpy array of floats
The last set of weights for the perceptron classificator.
niter : integer
The current number of iterations until success, or maxiter.
This is just to have an idea on how many iterations it took
to converge.
"""
我觉得很好奇,因为该算法不尊重权重的更新,因为到目前为止我们都看到了使用权重的更新,实际上我不太理解这个定义,我以为这种重新排序会打乱训练例子,不过我有点迷茫,想轻看这个算法怎么顶。 PS:请不要用代码回复,只是喜欢一个解释。
【问题讨论】:
标签: machine-learning perceptron