Package opennlp.tools.ml
Class ArrayMath
- java.lang.Object
- 
- opennlp.tools.ml.ArrayMath
 
- 
- 
Constructor SummaryConstructors Constructor Description ArrayMath()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static intargmax(double[] x)Find index of maximum element in the vector xstatic doubleinnerProduct(double[] vecA, double[] vecB)static doubleinvL2norm(double[] v)Inverse L2-normstatic doublel1norm(double[] v)L1-normstatic doublel2norm(double[] v)L2-normstatic doublelogSumOfExps(double[] x)Computes \log(\sum_{i=1}^n e^{x_i}) using a maximum-element trick to avoid arithmetic overflow.static doublemax(double[] x)static voidsumFeatures(Context[] context, float[] values, double[] prior)static double[]toDoubleArray(List<Double> list)Convert a list of Double objects into an array of primitive doublesstatic int[]toIntArray(List<Integer> list)Convert a list of Integer objects into an array of primitive integers
 
- 
- 
- 
Method Detail- 
innerProductpublic static double innerProduct(double[] vecA, double[] vecB)
 - 
l1normpublic static double l1norm(double[] v) L1-norm
 - 
l2normpublic static double l2norm(double[] v) L2-norm
 - 
invL2normpublic static double invL2norm(double[] v) Inverse L2-norm
 - 
logSumOfExpspublic static double logSumOfExps(double[] x) Computes \log(\sum_{i=1}^n e^{x_i}) using a maximum-element trick to avoid arithmetic overflow.- Parameters:
- x- input vector
- Returns:
- log-sum of exponentials of vector elements
 
 - 
maxpublic static double max(double[] x) 
 - 
argmaxpublic static int argmax(double[] x) Find index of maximum element in the vector x- Parameters:
- x- input vector
- Returns:
- index of the maximum element. Index of the first maximum element is returned if multiple maximums are found.
 
 - 
sumFeaturespublic static void sumFeatures(Context[] context, float[] values, double[] prior) 
 - 
toDoubleArraypublic static double[] toDoubleArray(List<Double> list) Convert a list of Double objects into an array of primitive doubles
 
- 
 
-