Artificial intelligence 简单感知器可以执行哪些任务?

Artificial intelligence 简单感知器可以执行哪些任务?,artificial-intelligence,perceptron,Artificial Intelligence,Perceptron,我试图教简单的单神经元感知器识别1的重复序列 以下是我用来教授它的数据: learning_signals = [ [[1, 1, 0, 0], 1], [[1, 1, 0, 1], 1], [[1, 1, 1, 0], 1], [[0, 1, 1, 0], 1], [[0, 1, 1, 1], 1], [[0, 0, 1, 1], 1], [[1, 0, 1, 1], 1], [[0, 0, 0, 0], 0], [[1, 0, 0, 0], 0],

我试图教简单的单神经元感知器识别
1
的重复序列

以下是我用来教授它的数据:

learning_signals = [
  [[1, 1, 0, 0], 1],
  [[1, 1, 0, 1], 1],
  [[1, 1, 1, 0], 1],

  [[0, 1, 1, 0], 1],
  [[0, 1, 1, 1], 1],


  [[0, 0, 1, 1], 1],
  [[1, 0, 1, 1], 1],

  [[0, 0, 0, 0], 0],
  [[1, 0, 0, 0], 0],
  [[0, 1, 0, 0], 0],
  [[0, 0, 1, 0], 0],
  [[0, 0, 0, 1], 0],

  [[1, 0, 1, 0], 0],
  [[1, 0, 0, 1], 0],
  # [[0, 1, 0, 1], 0],
这是一组学习模板,每个模板都是一组数据,并且都是该数据的正确结果

如你所见。最后一行已注释-如果我取消注释-感知器将无法学习。如果没有它,感知器就不能在“0101”的情况下正常工作。所以问题是:

  • 这个任务是可以用单神经元感知器解决的,还是应该用几个分层感知器
  • 我如何确定哪些任务可以用这样一个简单的感知器来解决?有什么规则可以应用到我的任务中,并说它可以用简单的感知器来完成吗
  • 以下是Percepton的代码


    你的特征是什么?我不确定我是否理解你……感知机是直接为每一位分配权重,还是有其他事情发生?是的,它是直接分配权重。把它的代码贴出来。把你的感知机的输入想象成n维空间中的点。感知器算法试图找到一个超平面,该超平面将空间分成两个面,其中一面包含一个类别中的所有元素,另一面包含另一个类别中的所有元素。因此,只有当空间能够以这种方式实际分割时,它才会起作用。问题的输入不能以这种方式划分。
    class window.Perceptron
      weights: []
      calc: (signal) ->
        @neuron.calc signal
      adjust: ->
      foo: 0.1
      calc: (signal) ->
        sum = 0
        for s, i in signal
          sum += s*@weights[i]
        if sum>0.5 then return 1 else return 0
        sum
      learn: (templates) ->
        @weights = []
        for i in [1..templates[0][0].length]
          @weights.push Math.random()
    
        li = 0
        max_li = 50000
        console.log @weights
        while true
          gerror = 0
          li++
          for template, i in templates
            res = @calc template[0]
            # console.log "result: #{res}"
            error = template[1] - res
            gerror += Math.abs error
            for weight, i in @weights
              @weights[i] += @foo*error*template[0][i]
          if ((gerror == 0) || li > max_li) then break
        if gerror == 0
          console.log "Learned in #{li} iterations"
        else
          console.log "Learning failed after #{max_li} iterations"
        console.log @weights