|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jdmf.util.MathCalculator
public class MathCalculator
A utility class that simplifies some calculations required in data mining algorithms, e.g. Bayes Classifier.
Constructor Summary | |
---|---|
MathCalculator()
|
Method Summary | |
---|---|
java.util.Vector<java.lang.Double> |
calculateCentroid(java.util.List<java.util.Vector<java.lang.Double>> points)
Calculates the centroid of all given points in a nD space (assumes that all points have n coordinates). |
java.lang.Double |
calculateDistance(java.util.Vector<java.lang.Double> firstPoint,
java.util.Vector<java.lang.Double> secondPoint)
Calculates the distance between two points in a nD space (assumes that n = firstPoint.size() = secondPoint.size()). |
java.lang.Double |
calculateMean(java.lang.Comparable[] attributeValues)
Calculates the mean of all attribute values. |
java.lang.Double |
calculateNormalDistribution(java.lang.Comparable[] attributeValues,
java.lang.Double x)
Calculates the normal distribution for the attribute value of the instance being classified. |
java.lang.Double |
calculateStandardDeviation(java.lang.Comparable[] attributeValues,
java.lang.Double mean)
Calculates the standard deviation of all attribute values. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MathCalculator()
Method Detail |
---|
public java.lang.Double calculateNormalDistribution(java.lang.Comparable[] attributeValues, java.lang.Double x)
1 ( -(x-m)^2 ) f(x) = ------------- * exp( -------- ) sd*sqrt(2*PI) ( 2*(sd)^2 )
m
- mean, sd
- standard deviation
attributeValues
- all values of the attribute (for m and sd)x
- the attribute value of the instance being classified
public java.lang.Double calculateMean(java.lang.Comparable[] attributeValues)
attributeValues
- attribute values
public java.lang.Double calculateStandardDeviation(java.lang.Comparable[] attributeValues, java.lang.Double mean)
attributeValues
- attribute values
public java.lang.Double calculateDistance(java.util.Vector<java.lang.Double> firstPoint, java.util.Vector<java.lang.Double> secondPoint)
firstPoint
- the first pointsecondPoint
- the second point
public java.util.Vector<java.lang.Double> calculateCentroid(java.util.List<java.util.Vector<java.lang.Double>> points)
points
- all points
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |