Package ann4j

Class NN


public class NN extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    static double
    It takes an ArrayList of Doubles as input, and returns the average of the elements in the ArrayList
    static double
    This function returns a random number between 0 and 1.
    static double
    It returns a random number between -0.5 and 0.5
    static double
    leakyrelu(double numToBeRectified)
    If the number is greater than 0, return the number, else return 0.1 times the number
    static double
    relu(double numToBeRectified)
    If the number is greater than 0, return the number.
    static double
    This function returns a random number between 0 and 0.1
    static double
    sigmoid(double numToBeRectified)
    The sigmoid function takes a number and returns a number between 0 and 1
    static double
    softplus(double numToBeRectified)
    The softplus function is a smooth approximation of the rectifier function
    static double
    tanh(double numToBeRectified)
    The tanh function takes a number and returns the hyperbolic tangent of that number

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static double average(ArrayList<Double> input)
      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.