|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.m5.M5Utils
Class for some small methods used in M5Java
Constructor Summary | |
M5Utils()
|
Method Summary | |
static double |
absDev(int attr,
Instances inst)
Returns the absolute deviation value of the instances values of an attribute |
static double |
correlation(double[] y1,
double[] y2,
int n)
Returns the correlation coefficient of two double vectors |
static java.lang.StringBuffer |
deleteTrailingZerosAndDot(java.lang.StringBuffer stringBuffer)
Deletes the trailing zeros and decimal point in a stringBuffer |
static java.lang.String |
doubleToStringF(double value,
int width,
int afterDecimalPoint)
Rounds a double and converts it into a formatted right-justified String. |
static java.lang.String |
doubleToStringG(double value,
int width,
int precision)
Rounds a double and converts it into a formatted right-justified String. |
static boolean |
eqDouble(double a,
double b)
Tests if two double values are equal to each other |
static void |
errorMsg(java.lang.String err)
Prints error message and exits |
static long |
floorDouble(double value)
Returns the largest (closest to positive infinity) long integer value that is not greater than the argument. |
static boolean |
hasEnumAttr(Instances inst)
Tests if enumerated attribute(s) exists in the instances |
static boolean |
hasMissing(Instances inst)
Tests if missing value(s) exists in the instances |
static java.lang.String |
headToString()
Prints the head lines of the output |
static long |
roundDouble(double value)
Rounds a double |
static java.lang.String |
separatorToString()
Prints sepearating line |
static double |
smoothenValue(double p,
double q,
int n,
int k)
Returns the smoothed values according to the smoothing formula (np+kq)/(n+k) |
static double |
sqrSum(int attr,
Instances inst)
Returns the squared sum of the instances values of an attribute |
static double |
stdDev(int attr,
Instances inst)
Returns the standard deviation value of the instances values of an attribute |
static double |
sum(int attr,
Instances inst)
Returns the sum of the instances values of an attribute |
static double |
variance(int attr,
Instances inst)
Returns the variance value of the instances values of an attribute |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public M5Utils()
Method Detail |
public static final boolean hasEnumAttr(Instances inst)
inst
- instancespublic static final boolean hasMissing(Instances inst)
inst
- instancespublic static final double sum(int attr, Instances inst)
attr
- an attributeinst
- instancespublic static final double sqrSum(int attr, Instances inst)
attr
- an attributeinst
- instancespublic static final double stdDev(int attr, Instances inst)
attr
- an attributeinst
- instancespublic static final double absDev(int attr, Instances inst)
attr
- an attributeinst
- instancespublic static final double variance(int attr, Instances inst)
attr
- an attributeinst
- instancespublic static final long roundDouble(double value)
value
- the double valuepublic static final long floorDouble(double value)
value
- the double valuepublic static final java.lang.String doubleToStringF(double value, int width, int afterDecimalPoint)
value
- the double valuewidth
- the width of the stringafterDecimalPoint
- the number of digits after the decimal pointpublic static final java.lang.String doubleToStringG(double value, int width, int precision)
value
- the double valuewidth
- the width of the stringprecision
- the number of valid digitspublic static final java.lang.StringBuffer deleteTrailingZerosAndDot(java.lang.StringBuffer stringBuffer)
stringBuffer
- string buffer
return string buffer with deleted trailing zeros and decimal pointpublic static final double smoothenValue(double p, double q, int n, int k)
p
- a double, normally is the prediction of the model at the current nodeq
- a double, normally is the prediction of the model at the up noden
- the number of instances at the up nodek
- the smoothing constance, default =15public static final double correlation(double[] y1, double[] y2, int n)
y1
- double vector 1y2
- double vector 2n
- the length of two double vectorspublic static final boolean eqDouble(double a, double b)
a
- double 1b
- double 2public static final void errorMsg(java.lang.String err)
err
- error messagepublic static final java.lang.String separatorToString()
public static final java.lang.String headToString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |