Пример #1
0
LocalDeepnet.prototype.predictList = function (inputArray) {
  /**
   * Computes the prediction with a list of networks.
   *
   * @param {array} inputArray Input data array prepared according to
   *                           the input fields description.
   */

  var inputArrayTrees, youts, model, index, len;
  if (typeof this.network.trees !== 'undefined' && this.network.trees != null) {
    inputArrayTrees = pp.treeTransform(inputArray, this.network.trees);
    youts = [];
    for (index = 0, len = this.networks.length; index < len; index++) {
      model = this.networks[index];
      if (typeof model.trees !== 'undefined' && model.trees != null
          && model.trees) {
        // so far, model.tress = false when empty, but just in case
        youts.push(this.modelPredict(inputArrayTrees, model));
      } else {
        youts.push(this.modelPredict(inputArray, model));
      }
    }
    return this.toPrediction(net.sumAndNormalize(youts, this.regression));
  }
}
Пример #2
0
LocalDeepnet.prototype.predictSingle = function (inputArray) {
  /**
   * Computes the prediction with a single network.
   *
   * @param {array} inputArray Input data array prepared according to
   *                           the input fields description.
   */
  if (typeof this.network.trees !== 'undefined' &&
      this.network.trees) {
    inputArray = pp.treeTransform(inputArray, this.network.trees);
  }
  return this.toPrediction(this.modelPredict(inputArray, this.network));
}