Exemplo n.º 1
0
  /** @param decoders New decoding vectors (row per Node) */
  public void setDecoders(float[][] decoders) {
    assert MU.isMatrix(decoders);
    assert myDecoders.length == decoders.length;
    assert myDecoders[0].length == decoders[0].length;

    myDecoders = decoders;
  }
Exemplo n.º 2
0
  /**
   * With this constructor decoding vectors are specified by the caller.
   *
   * @param node The parent Node
   * @param name As in other constructor
   * @param nodes As in other constructor
   * @param nodeOrigin Name of the Origin on each given node from which output is to be decoded
   * @param functions As in other constructor
   * @param decoders Decoding vectors which are scaled by the main output of each Node, and then
   *     summed, to estimate the same function of the ensembles state vector that is defined by the
   *     'functions' arg. The 'functions' arg is still needed, because in DIRECT SimulationMode,
   *     these functions are used directly. The 'decoders' arg allows the caller to provide decoders
   *     that are generated with non-default methods or parameters (eg an unusual number of singular
   *     values). Must be a matrix with one row per Node and one column per function.
   * @throws StructuralException If dimensions.length != neurons.length, decoders is not a matrix
   *     (ie all elements with same length), or if the number of columns in decoders is not equal to
   *     the number of functions
   */
  public DecodedOrigin(
      Node node,
      String name,
      Node[] nodes,
      String nodeOrigin,
      Function[] functions,
      float[][] decoders)
      throws StructuralException {
    checkFunctionDimensions(functions);

    if (!MU.isMatrix(decoders)) {
      throw new StructuralException("Elements of decoders do not all have the same length");
    }

    if (decoders[0].length != functions.length) {
      throw new StructuralException(
          "Number of decoding functions and dimension of decoding vectors must be the same");
    }

    if (decoders.length != nodes.length) {
      throw new StructuralException("Number of decoding vectors and Neurons must be the same");
    }

    myNode = node;
    myName = name;
    myNodes = nodes;
    myNodeOrigin = nodeOrigin;
    myFunctions = functions;
    myDecoders = decoders;
    myMode = SimulationMode.DEFAULT;
    myIntegrator = new EulerIntegrator(.001f);

    reset(false);
  }