Class MultiLayerPerceptronFunctionND

java.lang.Object
edu.cmu.tetrad.search.utils.MultiLayerPerceptronFunctionND

public class MultiLayerPerceptronFunctionND extends Object
Represents a random Multi-layer Perceptron (MLP) function from R^n to R.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MultiLayerPerceptronFunctionND(int inputDim, int hiddenDimension, Function<Double,Double> activation, double inputScale, long seed)
    Constructor to initialize a random function.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    evaluate(double[] x)
    Evaluates the random function for a given input vector.
    evaluateAdjusted(double[] doubles)
    Evaluates the adjusted output of the function for a given input vector.
    static void
    main(String[] args)
    The main method demonstrating the creation and evaluation of a multi-layer perceptron function with random initialization and specific parameters.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MultiLayerPerceptronFunctionND

      public MultiLayerPerceptronFunctionND(int inputDim, int hiddenDimension, Function<Double,Double> activation, double inputScale, long seed)
      Constructor to initialize a random function.
      Parameters:
      inputDim - Number of input dimensions (R^n).
      hiddenDimension - Number of neurons in the hidden layer.
      activation - Activation function (e.g., Math::sin or Math::tanh).
      inputScale - Scaling factor for the input to create bumpiness.
      seed - Random seed for reproducibility.
  • Method Details

    • main

      public static void main(String[] args)
      The main method demonstrating the creation and evaluation of a multi-layer perceptron function with random initialization and specific parameters. It defines the function, evaluates the function on given sample inputs, and prints the results to the console.
      Parameters:
      args - Command-line arguments passed to the program.
    • evaluate

      public double evaluate(double[] x)
      Evaluates the random function for a given input vector.
      Parameters:
      x - Input vector in R^n.
      Returns:
      Output value in R.
    • evaluateAdjusted

      public Double evaluateAdjusted(double[] doubles)
      Evaluates the adjusted output of the function for a given input vector. The adjustment involves subtracting the output when the input is a zero-filled vector.
      Parameters:
      doubles - Input vector in R^n.
      Returns:
      The adjusted output value in R, calculated by subtracting the output of the zero-filled vector from the output of the provided input vector.