Tabnine Logo
MathUtils.maxIndex
Code IndexAdd Tabnine to your IDE (free)

How to use
maxIndex
method
in
org.canova.api.util.MathUtils

Best Java code snippets using org.canova.api.util.MathUtils.maxIndex (Showing top 2 results out of 315)

origin: org.nd4j/canova-api

/**
 * Converts an array containing the natural logarithms of
 * probabilities stored in a vector back into probabilities.
 * The probabilities are assumed to sum to one.
 *
 * @param a an array holding the natural logarithms of the probabilities
 * @return the converted array
 */
public static double[] logs2probs(double[] a) {
 double max = a[maxIndex(a)];
 double sum = 0.0;
 double[] result = new double[a.length];
 for (int i = 0; i < a.length; i++) {
  result[i] = Math.exp(a[i] - max);
  sum += result[i];
 }
 normalize(result, sum);
 return result;
}//end logs2probs
origin: jpatanooga/Canova

/**
 * Converts an array containing the natural logarithms of
 * probabilities stored in a vector back into probabilities.
 * The probabilities are assumed to sum to one.
 *
 * @param a an array holding the natural logarithms of the probabilities
 * @return the converted array
 */
public static double[] logs2probs(double[] a) {
  double max = a[maxIndex(a)];
  double sum = 0.0;
  double[] result = new double[a.length];
  for(int i = 0; i < a.length; i++) {
    result[i] = Math.exp(a[i] - max);
    sum += result[i];
  }
  normalize(result, sum);
  return result;
}//end logs2probs
/**
org.canova.api.utilMathUtilsmaxIndex

Javadoc

Returns index of maximum element in a given array of doubles. First maximum is returned.

Popular methods of MathUtils

  • clamp
    Clamps the value to a discrete value
  • column
    This returns the given column over an n arrays
  • combination
    This returns the combination of n choose r
  • coordSplit
    This returns the coordinate split in a list of coordinates such that the values for ret[0] are the x
  • correlation
    Returns the correlation coefficient of two double vectors.
  • factorial
    This will return the factorial of the given number n.
  • gr
    Tests if a is greater than b.
  • idf
    Inverse document frequency: the total docs divided by the number of times the word appeared in a doc
  • log2
    Returns the logarithm of a for base 2.
  • normalize
    Normalizes the doubles in the array using the given value.
  • randomNumberBetween
    Generates a random integer between the specified numbers
  • sm
    Tests if a is smaller than b.
  • randomNumberBetween,
  • sm,
  • ssError,
  • ssReg,
  • ssTotal,
  • sum,
  • sumOfMeanDifferences,
  • sumOfMeanDifferencesOnePoint,
  • sumOfProducts

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
  • onCreateOptionsMenu (Activity)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • JButton (javax.swing)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now