Package edu.cmu.tetrad.search.utils
Class MultiLayerPerceptronFunctionND
java.lang.Object
edu.cmu.tetrad.search.utils.MultiLayerPerceptronFunctionND
Represents a random Multi-layer Perceptron (MLP) function from R^n to R.
-
Constructor Summary
ConstructorsConstructorDescriptionMultiLayerPerceptronFunctionND(int inputDim, int hiddenDimension, Function<Double, Double> activation, double inputScale, long seed) Constructor to initialize a random function. -
Method Summary
Modifier and TypeMethodDescriptiondoubleevaluate(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 voidThe main method demonstrating the creation and evaluation of a multi-layer perceptron function with random initialization and specific parameters.
-
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
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
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.
-