亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? network.java

?? java neural networkin
?? JAVA
字號:
/**
 * Network
 * Copyright 2005 by Jeff Heaton(jeff@jeffheaton.com)
 *
 * Example program from Chapter 3
 * Programming Neural Networks in Java
 * http://www.heatonresearch.com/articles/series/1/
 *
 * This software is copyrighted. You may use it in programs
 * of your own, without restriction, but you may not
 * publish the source code without the author's permission.
 * For more information on distributing this code, please
 * visit:
 *    http://www.heatonresearch.com/hr_legal.php
 *
 * @author Jeff Heaton
 * @version 1.1
 */

public class Network {

  /**
   * The global error for the training.
   */
  protected double globalError;


  /**
   * The number of input neurons.
   */
  protected int inputCount;

  /**
   * The number of hidden neurons.
   */
  protected int hiddenCount;

  /**
   * The number of output neurons
   */
  protected int outputCount;

  /**
   * The total number of neurons in the network.
   */
  protected int neuronCount;

  /**
   * The number of weights in the network.
   */
  protected int weightCount;

  /**
   * The learning rate.
   */
  protected double learnRate;

  /**
   * The outputs from the various levels.
   */
  protected double fire[];

  /**
   * The weight matrix this, along with the thresholds can be
   * thought of as the "memory" of the neural network.
   */
  protected double matrix[];

  /**
   * The errors from the last calculation.
   */
  protected double error[];

  /**
   * Accumulates matrix delta's for training.
   */
  protected double accMatrixDelta[];

  /**
   * The thresholds, this value, along with the weight matrix
   * can be thought of as the memory of the neural network.
   */
  protected double thresholds[];

  /**
   * The changes that should be applied to the weight
   * matrix.
   */
  protected double matrixDelta[];

  /**
   * The accumulation of the threshold deltas.
   */
  protected double accThresholdDelta[];

  /**
   * The threshold deltas.
   */
  protected double thresholdDelta[];

  /**
   * The momentum for training.
   */
  protected double momentum;

  /**
   * The changes in the errors.
   */
  protected double errorDelta[];


  /**
   * Construct the neural network.
   *
   * @param inputCount The number of input neurons.
   * @param hiddenCount The number of hidden neurons
   * @param outputCount The number of output neurons
   * @param learnRate The learning rate to be used when training.
   * @param momentum The momentum to be used when training.
   */
  public Network(int inputCount,
                 int hiddenCount,
                 int outputCount,
                 double learnRate,
                 double momentum) {

    this.learnRate = learnRate;
    this.momentum = momentum;

    this.inputCount = inputCount;
    this.hiddenCount = hiddenCount;
    this.outputCount = outputCount;
    neuronCount = inputCount + hiddenCount + outputCount;
    weightCount = (inputCount * hiddenCount) + (hiddenCount * outputCount);

    fire        = new double[neuronCount];
    matrix      = new double[weightCount];
    matrixDelta = new double[weightCount];
    thresholds  = new double[neuronCount];
    errorDelta  = new double[neuronCount];
    error       = new double[neuronCount];
    accThresholdDelta = new double[neuronCount];
    accMatrixDelta = new double[weightCount];
    thresholdDelta = new double[neuronCount];

    reset();
  }



  /**
   * Returns the root mean square error for a complet training set.
   *
   * @param len The length of a complete training set.
   * @return The current error for the neural network.
   */
  public double getError(int len) {
    double err = Math.sqrt(globalError / (len * outputCount));
    globalError = 0;  // clear the accumulator
    return err;

  }

  /**
   * The threshold method. You may wish to override this class to provide other
   * threshold methods.
   *
   * @param sum The activation from the neuron.
   * @return The activation applied to the threshold method.
   */
  public double threshold(double sum) {
    return 1.0 / (1 + Math.exp(-1.0 * sum));
  }

  /**
   * Compute the output for a given input to the neural network.
   *
   * @param input The input provide to the neural network.
   * @return The results from the output neurons.
   */
  public double []computeOutputs(double input[]) {
    int i, j;
    final int hiddenIndex = inputCount;
    final int outIndex = inputCount + hiddenCount;

    for (i = 0; i < inputCount; i++) {
      fire[i] = input[i];
    }

    // first layer
    int inx = 0;

    for (i = hiddenIndex; i < outIndex; i++) {
      double sum = thresholds[i];

      for (j = 0; j < inputCount; j++) {
        sum += fire[j] * matrix[inx++];
      }
      fire[i] = threshold(sum);
    }

    // hidden layer

    double result[] = new double[outputCount];

    for (i = outIndex; i < neuronCount; i++) {
      double sum = thresholds[i];

      for (j = hiddenIndex; j < outIndex; j++) {
        sum += fire[j] * matrix[inx++];
      }
      fire[i] = threshold(sum);
      result[i-outIndex] = fire[i];
    }

    return result;
  }


  /**
   * Calculate the error for the recogntion just done.
   *
   * @param ideal What the output neurons should have yielded.
   */
  public void calcError(double ideal[]) {
    int i, j;
    final int hiddenIndex = inputCount;
    final int outputIndex = inputCount + hiddenCount;

    // clear hidden layer errors
    for (i = inputCount; i < neuronCount; i++) {
      error[i] = 0;
    }

    // layer errors and deltas for output layer
    for (i = outputIndex; i < neuronCount; i++) {
      error[i] = ideal[i - outputIndex] - fire[i];
      globalError += error[i] * error[i];
      errorDelta[i] = error[i] * fire[i] * (1 - fire[i]);
    }

    // hidden layer errors
    int winx = inputCount * hiddenCount;

    for (i = outputIndex; i < neuronCount; i++) {
      for (j = hiddenIndex; j < outputIndex; j++) {
        accMatrixDelta[winx] += errorDelta[i] * fire[j];
        error[j] += matrix[winx] * errorDelta[i];
        winx++;
      }
      accThresholdDelta[i] += errorDelta[i];
    }

    // hidden layer deltas
    for (i = hiddenIndex; i < outputIndex; i++) {
      errorDelta[i] = error[i] * fire[i] * (1 - fire[i]);
    }

    // input layer errors
    winx = 0;  // offset into weight array
    for (i = hiddenIndex; i < outputIndex; i++) {
      for (j = 0; j < hiddenIndex; j++) {
        accMatrixDelta[winx] += errorDelta[i] * fire[j];
        error[j] += matrix[winx] * errorDelta[i];
        winx++;
      }
      accThresholdDelta[i] += errorDelta[i];
    }
  }

  /**
   * Modify the weight matrix and thresholds based on the last call to
   * calcError.
   */
  public void learn() {
    int i;

    // process the matrix
    for (i = 0; i < matrix.length; i++) {
      matrixDelta[i] = (learnRate * accMatrixDelta[i]) + (momentum * matrixDelta[i]);
      matrix[i] += matrixDelta[i];
      accMatrixDelta[i] = 0;
    }

    // process the thresholds
    for (i = inputCount; i < neuronCount; i++) {
      thresholdDelta[i] = learnRate * accThresholdDelta[i] + (momentum * thresholdDelta[i]);
      thresholds[i] += thresholdDelta[i];
      accThresholdDelta[i] = 0;
    }
  }

  /**
   * Reset the weight matrix and the thresholds.
   */
  public void reset() {
    int i;

    for (i = 0; i < neuronCount; i++) {
      thresholds[i] = 0.5 - (Math.random());
      thresholdDelta[i] = 0;
      accThresholdDelta[i] = 0;
    }
    for (i = 0; i < matrix.length; i++) {
      matrix[i] = 0.5 - (Math.random());
      matrixDelta[i] = 0;
      accMatrixDelta[i] = 0;
    }
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费人成在线不卡| 一本久久a久久免费精品不卡| 国产aⅴ精品一区二区三区色成熟| 东方aⅴ免费观看久久av| 在线国产电影不卡| 国产精品欧美一级免费| 日本怡春院一区二区| 97久久久精品综合88久久| 久久亚洲捆绑美女| 亚洲18色成人| 日本高清不卡aⅴ免费网站| 久久久一区二区| 日韩二区三区四区| 欧美伊人久久久久久午夜久久久久| 2017欧美狠狠色| 日韩不卡在线观看日韩不卡视频| 色噜噜狠狠色综合中国| 欧美国产日韩在线观看| 精品一区二区三区久久| 欧美美女一区二区三区| 玉米视频成人免费看| 成人av影视在线观看| 久久久亚洲精品石原莉奈| 日韩福利电影在线观看| 欧美精品在线视频| 亚洲在线中文字幕| 91久久精品一区二区| 亚洲欧美综合另类在线卡通| 国产黄色91视频| 久久综合九色综合97婷婷 | 久久欧美一区二区| 日韩一区精品视频| 欧美一区国产二区| 日韩国产在线一| 欧美日韩视频一区二区| 亚洲国产综合色| 2020日本不卡一区二区视频| 久久99久久久欧美国产| 精品成人a区在线观看| 日韩av成人高清| 日韩你懂的电影在线观看| 天天亚洲美女在线视频| 日韩视频123| 久久超碰97中文字幕| 日韩欧美的一区| 国产在线国偷精品产拍免费yy| 欧美一级爆毛片| 韩国成人福利片在线播放| 久久久久久久精| 不卡一区二区三区四区| 亚洲男女一区二区三区| 欧美日韩免费在线视频| 日日欢夜夜爽一区| 日韩亚洲欧美中文三级| 国产在线一区观看| 国产女人水真多18毛片18精品视频 | 波多野结衣在线一区| ...xxx性欧美| 欧美日韩国产一级| 久88久久88久久久| 中文字幕亚洲区| 欧美日韩一区二区三区视频| 麻豆精品视频在线观看| 久久精品视频在线免费观看 | 国产精品久久久久aaaa樱花 | 久久福利资源站| 欧美激情在线一区二区| 日本乱人伦aⅴ精品| 男人的天堂久久精品| 久久精子c满五个校花| 色婷婷久久久综合中文字幕| 美女爽到高潮91| 日韩美女视频一区二区| 欧美一区二区黄| 国产99一区视频免费 | 欧美日韩精品久久久| 国产制服丝袜一区| 亚洲一区在线观看视频| 精品国产一区二区三区久久久蜜月| 国产乱色国产精品免费视频| 亚洲一区二区欧美激情| 久久久777精品电影网影网 | 精品欧美一区二区久久| 99久久伊人网影院| 奇米色一区二区三区四区| 日本一区二区视频在线| 91精品国产综合久久福利| 91亚洲国产成人精品一区二区三| 免费成人你懂的| 亚洲激情在线激情| 久久久99免费| 欧美电视剧免费观看| 91网上在线视频| 高清在线成人网| 麻豆高清免费国产一区| 一区二区三区欧美日韩| 日本一区二区在线不卡| 精品国一区二区三区| 欧美亚洲日本国产| 色偷偷成人一区二区三区91| 成人一区在线看| 极品美女销魂一区二区三区免费| 天天综合网天天综合色| 18成人在线观看| 国产精品你懂的| 久久精品视频一区二区| 欧美白人最猛性xxxxx69交| 欧美久久久久久蜜桃| 色天使色偷偷av一区二区| 成av人片一区二区| 一本久久a久久免费精品不卡| 国产精品亚洲一区二区三区在线| 麻豆国产欧美一区二区三区| 亚洲成av人片| 亚洲成年人网站在线观看| 亚洲国产中文字幕在线视频综合| 亚洲精选一二三| 亚洲精品国产无套在线观| 亚洲女人的天堂| 亚洲制服丝袜av| 亚洲第一在线综合网站| 亚洲第一狼人社区| 日韩av午夜在线观看| 久久精品国产精品青草| 国内外成人在线视频| 国产精品一二三| 国产激情一区二区三区桃花岛亚洲| 国产精品18久久久久久久久 | 色国产综合视频| 欧美调教femdomvk| 日韩视频中午一区| 久久久亚洲精品石原莉奈| 欧美国产一区在线| 亚洲六月丁香色婷婷综合久久 | 亚洲欧美在线高清| 亚洲欧美日韩国产综合| 亚洲成人综合在线| 美女视频一区二区三区| 国产成人精品www牛牛影视| 北条麻妃国产九九精品视频| 欧美在线free| 日韩欧美专区在线| 欧美激情一区不卡| 亚洲一区二区不卡免费| 免费在线看一区| 国产精品一区二区在线播放| 成人av在线播放网站| 9191国产精品| 国产亚洲欧美日韩日本| 亚洲欧美激情视频在线观看一区二区三区 | 亚洲一区二区美女| 麻豆视频一区二区| 成年人国产精品| 69久久夜色精品国产69蝌蚪网| 久久久九九九九| 一区二区三区91| 经典三级视频一区| 91成人网在线| 国产欧美精品一区二区色综合 | 欧美日韩免费观看一区三区| 日韩欧美一级特黄在线播放| 亚洲欧洲精品成人久久奇米网| 天天操天天色综合| 成人手机电影网| 91麻豆精品国产自产在线观看一区 | 一区二区三区在线高清| 韩国精品主播一区二区在线观看| 色婷婷国产精品综合在线观看| 欧美tickling网站挠脚心| 亚洲精品视频在线| 国产精品一级二级三级| 91精品国产黑色紧身裤美女| 亚洲欧美另类久久久精品2019 | 男人的天堂亚洲一区| 色综合久久天天| 欧美高清在线一区二区| 日韩av高清在线观看| 欧美在线一二三| 中文字幕成人av| 国内精品伊人久久久久av一坑| 欧美日韩国产片| 夜夜嗨av一区二区三区中文字幕 | 天堂在线一区二区| 91免费观看在线| 欧美国产精品中文字幕| 美国三级日本三级久久99| 欧美偷拍一区二区| 亚洲精品视频一区二区| 99精品国产99久久久久久白柏| 欧美精品一区二区久久婷婷| 蜜芽一区二区三区| 67194成人在线观看| 亚洲成人一二三| 99久久精品情趣| 亚洲日本丝袜连裤袜办公室| 成人高清av在线| 日本一区二区三区电影| 国产成人在线看| 国产欧美一区二区三区鸳鸯浴| 国产真实乱对白精彩久久|