Package ann4j
Class NN
java.lang.Object
ann4j.NN
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleaverage(double[] sum) It takes an array of doubles, adds them all together, divides by the length of the array, and returns the resultstatic doubleIt takes an ArrayList of Doubles as input, and returns the average of the elements in the ArrayListstatic doubleThis function returns a random number between 0 and 1.static doubleIt returns a random number between -0.5 and 0.5static doubleleakyrelu(double numToBeRectified) If the number is greater than 0, return the number, else return 0.1 times the numberstatic doublerelu(double numToBeRectified) If the number is greater than 0, return the number.static doublesetBias()This function returns a random number between 0 and 0.1static doublesigmoid(double numToBeRectified) The sigmoid function takes a number and returns a number between 0 and 1static doublesoftplus(double numToBeRectified) The softplus function is a smooth approximation of the rectifier functionstatic doubletanh(double numToBeRectified) The tanh function takes a number and returns the hyperbolic tangent of that number
-
Method Details
-
getRandom
public static double getRandom()This function returns a random number between 0 and 1.- Returns:
- A random number between 0 and 1.
-
getSmallSignedRandom
public static double getSmallSignedRandom()It returns a random number between -0.5 and 0.5- Returns:
- A random number between -0.5 and 0.5
-
tanh
public static double tanh(double numToBeRectified) The tanh function takes a number and returns the hyperbolic tangent of that number- Parameters:
numToBeRectified- The number to be rectified.- Returns:
- The hyperbolic tangent of the number.
-
softplus
public static double softplus(double numToBeRectified) The softplus function is a smooth approximation of the rectifier function- Parameters:
numToBeRectified- The number to be rectified.- Returns:
- The softplus function is being returned.
-
sigmoid
public static double sigmoid(double numToBeRectified) The sigmoid function takes a number and returns a number between 0 and 1- Parameters:
numToBeRectified- The number to be rectified.- Returns:
- The sigmoid function is being returned.
-
relu
public static double relu(double numToBeRectified) If the number is greater than 0, return the number. Otherwise, return 0- Parameters:
numToBeRectified- The number to be rectified.- Returns:
- The return value is the number that is passed in if it is greater than 0, otherwise it returns 0.
-
leakyrelu
public static double leakyrelu(double numToBeRectified) If the number is greater than 0, return the number, else return 0.1 times the number- Parameters:
numToBeRectified- The number to be rectified.- Returns:
- the value of the number to be rectified if it is greater than 0, and if it is less than 0, it is returning 0.1 times the number to be rectified.
-
average
public static double average(double[] sum) It takes an array of doubles, adds them all together, divides by the length of the array, and returns the result- Parameters:
sum- an array of doubles- Returns:
- The average of the array.
-
setBias
public static double setBias()This function returns a random number between 0 and 0.1- Returns:
- A random number between 0 and 0.1
-
average
It takes an ArrayList of Doubles as input, and returns the average of the elements in the ArrayList- Parameters:
input- an ArrayList of Double values- Returns:
- The average of the numbers in the array.
-