code: private static LinearModel trainNaivePerceptron(Instance[] instanceList, FeatureMap featureMap, int maxIteration)
      {
          LinearModel model = new LinearModel(featureMap, new float[featureMap.size()]);
          for (int it = 0; it < maxIteration; ++it)
          {
              Utility.shuffleArray(instanceList);
              for (Instance instance : instanceList)
              {
                  int y = model.decode(instance.x);
                  if (y != instance.y) // 误差反馈
                      model.update(instance.x, instance.y);
              }
          }
          return model;
      }
docs: 朴素感知机训练算法
  @param instanceList 训练实例
  @param featureMap   特征函数
  @param maxIteration 训练迭代次数