感知器S形

Perceptron Sigmoid

本文关键字:感知      更新时间:2023-10-16

您好,我正在尝试创建一个程序来计算感知器算法的权重。我现在一切都在工作,但最基本的是,它是一个阶跃功能,它是单层的。在我继续使用多层之前,我正在尝试使其最佳和 S 形。

所以这些是我的问题,我对 sigmoid 有一个大致的概念,但我找不到任何关于如何使线最优的信息,所以它与数据点的距离相等。有人知道吗?

net = 0;
for(i=0; i<N; i++)
{
    net = net + (x[i] * w[i]);      //Calculates weighted sum
}
if(net >= threshold) output =  1;     //Finds the output based on the net
if(net <  threshold) output = -1;

这是我当前查找"y"变量的代码,我在这里称之为输出,它使用简单的步进函数找到它,阈值 = 0。如何将其转换为 sigmoid?

以下方法可能有效:

output = 1 / (1 + exp(-net));

您可能还喜欢tanh(net)1 / (1 + abs(net))功能,根据此答案,这些功能要快得多。