You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by td...@apache.org on 2010/08/13 05:03:43 UTC
svn commit: r985081 - in /mahout/trunk:
core/src/main/java/org/apache/mahout/classifier/bayes/datastore/
core/src/test/java/org/apache/mahout/common/
core/src/test/java/org/apache/mahout/df/data/
math/src/main/java/org/apache/mahout/math/jet/math/ math...
Author: tdunning
Date: Fri Aug 13 03:03:42 2010
New Revision: 985081
URL: http://svn.apache.org/viewvc?rev=985081&view=rev
Log:
MAHOUT-470 small cleanups to lower our warning count
Modified:
mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/InMemoryBayesDatastore.java
mahout/trunk/core/src/test/java/org/apache/mahout/common/MahoutTestCase.java
mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataConverterTest.java
mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java
mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java
mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java
mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Beta.java
mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Binomial.java
mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Fun.java
mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Normal.java
mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Poisson.java
mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Gamma.java
mahout/trunk/math/src/test/java/org/apache/mahout/math/AbstractTestVector.java
mahout/trunk/math/src/test/java/org/apache/mahout/math/MahoutTestCase.java
Modified: mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/InMemoryBayesDatastore.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/InMemoryBayesDatastore.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/InMemoryBayesDatastore.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/InMemoryBayesDatastore.java Fri Aug 13 03:03:42 2010
@@ -45,9 +45,9 @@ public class InMemoryBayesDatastore impl
private final OpenObjectIntHashMap<String> labelDictionary = new OpenObjectIntHashMap<String>();
- private final OpenIntDoubleHashMap sigma_j = new OpenIntDoubleHashMap();
+ private final OpenIntDoubleHashMap sigmaJ = new OpenIntDoubleHashMap();
- private final OpenIntDoubleHashMap sigma_k = new OpenIntDoubleHashMap();
+ private final OpenIntDoubleHashMap sigmaK = new OpenIntDoubleHashMap();
private final OpenIntDoubleHashMap thetaNormalizerPerLabel = new OpenIntDoubleHashMap();
@@ -59,7 +59,7 @@ public class InMemoryBayesDatastore impl
private double alphaI = 1.0;
- private double sigma_jSigma_k = 1.0;
+ private double sigmaJsigmaK = 1.0;
public InMemoryBayesDatastore(Parameters params) {
String basePath = params.get("basePath");
@@ -100,7 +100,7 @@ public class InMemoryBayesDatastore impl
public double getWeight(String matrixName, String row, String column) throws InvalidDatastoreException {
if (matrixName.equals("weight")) {
if (column.equals("sigma_j")) {
- return sigma_j.get(getFeatureID(row));
+ return sigmaJ.get(getFeatureID(row));
} else {
return weightMatrix.getQuick(getFeatureID(row), getLabelID(column));
}
@@ -113,7 +113,7 @@ public class InMemoryBayesDatastore impl
public double getWeight(String vectorName, String index) throws InvalidDatastoreException {
if (vectorName.equals("sumWeight")) {
if (index.equals("sigma_jSigma_k")) {
- return sigma_jSigma_k;
+ return sigmaJsigmaK;
} else if (index.equals("vocabCount")) {
return featureDictionary.size();
} else {
@@ -128,7 +128,7 @@ public class InMemoryBayesDatastore impl
throw new InvalidDatastoreException();
}
} else if (vectorName.equals("labelWeight")) {
- return sigma_k.get(getLabelID(index));
+ return sigmaK.get(getLabelID(index));
} else {
throw new InvalidDatastoreException();
}
@@ -162,12 +162,12 @@ public class InMemoryBayesDatastore impl
public void setSumFeatureWeight(String feature, double weight) {
int fid = getFeatureID(feature);
- sigma_j.put(fid, weight);
+ sigmaJ.put(fid, weight);
}
public void setSumLabelWeight(String label, double weight) {
int lid = getLabelID(label);
- sigma_k.put(lid, weight);
+ sigmaK.put(lid, weight);
}
public void setThetaNormalizer(String label, double weight) {
@@ -177,6 +177,6 @@ public class InMemoryBayesDatastore impl
}
public void setSigmaJSigmaK(double weight) {
- this.sigma_jSigma_k = weight;
+ this.sigmaJsigmaK = weight;
}
}
Modified: mahout/trunk/core/src/test/java/org/apache/mahout/common/MahoutTestCase.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/common/MahoutTestCase.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/common/MahoutTestCase.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/common/MahoutTestCase.java Fri Aug 13 03:03:42 2010
@@ -39,9 +39,13 @@ public abstract class MahoutTestCase ext
}
@Override
- protected void tearDown() throws Exception {
+ protected void tearDown() {
if (testTempDirPath != null) {
- fs.delete(testTempDirPath, true);
+ try {
+ fs.delete(testTempDirPath, true);
+ } catch (IOException e) {
+ throw new IllegalStateException("Test file not found");
+ }
testTempDirPath = null;
fs = null;
}
Modified: mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataConverterTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataConverterTest.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataConverterTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataConverterTest.java Fri Aug 13 03:03:42 2010
@@ -24,15 +24,15 @@ import org.apache.mahout.common.RandomUt
public class DataConverterTest extends MahoutTestCase {
- private static final int nbAttributes = 10;
+ private static final int ATTRIBUTE_COUNT = 10;
- private static final int nbInstances = 100;
+ private static final int INSTANCE_COUNT = 100;
- public void testConvert() throws Exception {
+ public void testConvert() throws DescriptorException {
Random rng = RandomUtils.getRandom();
- String descriptor = Utils.randomDescriptor(rng, nbAttributes);
- double[][] source = Utils.randomDoubles(rng, descriptor, nbInstances);
+ String descriptor = Utils.randomDescriptor(rng, ATTRIBUTE_COUNT);
+ double[][] source = Utils.randomDoubles(rng, descriptor, INSTANCE_COUNT);
String[] sData = Utils.double2String(source);
Dataset dataset = DataLoader.generateDataset(descriptor, sData);
Data data = DataLoader.loadData(dataset, sData);
Modified: mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java Fri Aug 13 03:03:42 2010
@@ -27,9 +27,9 @@ import org.apache.mahout.df.data.conditi
public class DataTest extends MahoutTestCase {
- private static final int nbAttributes = 10;
+ private static final int ATTRIBUTE_COUNT = 10;
- private static final int datasize = 100;
+ private static final int DATA_SIZE = 100;
private Random rng;
@@ -39,7 +39,7 @@ public class DataTest extends MahoutTest
protected void setUp() throws Exception {
super.setUp();
rng = RandomUtils.getRandom();
- data = Utils.randomData(rng, nbAttributes, datasize);
+ data = Utils.randomData(rng, ATTRIBUTE_COUNT, DATA_SIZE);
}
/**
@@ -59,7 +59,7 @@ public class DataTest extends MahoutTest
Data lSubset = data.subset(Condition.lesser(attr, value));
Data gSubset = data.subset(Condition.greaterOrEquals(attr, value));
- for (int index = 0; index < datasize; index++) {
+ for (int index = 0; index < DATA_SIZE; index++) {
Instance instance = data.get(index);
if (instance.get(attr) < value) {
@@ -81,13 +81,13 @@ public class DataTest extends MahoutTest
public void testValues() throws Exception {
- Data data = Utils.randomData(rng, nbAttributes, datasize);
+ Data data = Utils.randomData(rng, ATTRIBUTE_COUNT, DATA_SIZE);
for (int attr = 0; attr < data.getDataset().nbAttributes(); attr++) {
double[] values = data.values(attr);
// each value of the attribute should appear exactly one time in values
- for (int index = 0; index < datasize; index++) {
+ for (int index = 0; index < DATA_SIZE; index++) {
assertEquals(1, count(values, data.get(index).get(attr)));
}
}
@@ -106,16 +106,16 @@ public class DataTest extends MahoutTest
public void testIdenticalTrue() throws Exception {
// generate a small data, only to get the dataset
- Dataset dataset = Utils.randomData(rng, nbAttributes, 1).getDataset();
+ Dataset dataset = Utils.randomData(rng, ATTRIBUTE_COUNT, 1).getDataset();
// test empty data
Data empty = new Data(dataset, new ArrayList<Instance>());
assertTrue(empty.isIdentical());
// test identical data, except for the labels
- Data identical = Utils.randomData(rng, nbAttributes, datasize);
+ Data identical = Utils.randomData(rng, ATTRIBUTE_COUNT, DATA_SIZE);
Instance model = identical.get(0);
- for (int index = 1; index < datasize; index++) {
+ for (int index = 1; index < DATA_SIZE; index++) {
for (int attr = 0; attr < identical.getDataset().nbAttributes(); attr++) {
identical.get(index).set(attr, model.get(attr));
}
@@ -128,10 +128,10 @@ public class DataTest extends MahoutTest
int n = 10;
for (int nloop = 0; nloop < n; nloop++) {
- Data data = Utils.randomData(rng, nbAttributes, datasize);
+ Data data = Utils.randomData(rng, ATTRIBUTE_COUNT, DATA_SIZE);
// choose a random instance
- int index = rng.nextInt(datasize);
+ int index = rng.nextInt(DATA_SIZE);
Instance instance = data.get(index);
// change a random attribute
@@ -144,16 +144,16 @@ public class DataTest extends MahoutTest
public void testIdenticalLabelTrue() throws Exception {
// generate a small data, only to get a dataset
- Dataset dataset = Utils.randomData(rng, nbAttributes, 1).getDataset();
+ Dataset dataset = Utils.randomData(rng, ATTRIBUTE_COUNT, 1).getDataset();
// test empty data
Data empty = new Data(dataset, new ArrayList<Instance>());
assertTrue(empty.identicalLabel());
// test identical labels
- String descriptor = Utils.randomDescriptor(rng, nbAttributes);
+ String descriptor = Utils.randomDescriptor(rng, ATTRIBUTE_COUNT);
double[][] source = Utils.randomDoublesWithSameLabel(rng, descriptor,
- datasize, rng.nextInt());
+ DATA_SIZE, rng.nextInt());
String[] sData = Utils.double2String(source);
dataset = DataLoader.generateDataset(descriptor, sData);
@@ -166,12 +166,12 @@ public class DataTest extends MahoutTest
int n = 10;
for (int nloop = 0; nloop < n; nloop++) {
- String descriptor = Utils.randomDescriptor(rng, nbAttributes);
+ String descriptor = Utils.randomDescriptor(rng, ATTRIBUTE_COUNT);
int label = Utils.findLabel(descriptor);
double[][] source = Utils.randomDoublesWithSameLabel(rng, descriptor,
- datasize, rng.nextInt());
+ DATA_SIZE, rng.nextInt());
// choose a random vector and change its label
- int index = rng.nextInt(datasize);
+ int index = rng.nextInt(DATA_SIZE);
source[index][label]++;
String[] sData = Utils.double2String(source);
@@ -212,24 +212,24 @@ public class DataTest extends MahoutTest
Data source = data.clone();
Data subset = source.rsplit(rng, 0);
assertTrue("subset should be empty", subset.isEmpty());
- assertEquals("source.size is incorrect", datasize, source.size());
+ assertEquals("source.size is incorrect", DATA_SIZE, source.size());
// rsplit should handle full size subsets
source = data.clone();
- subset = source.rsplit(rng, datasize);
- assertEquals("subset.size is incorrect", datasize, subset.size());
+ subset = source.rsplit(rng, DATA_SIZE);
+ assertEquals("subset.size is incorrect", DATA_SIZE, subset.size());
assertTrue("source should be empty", source.isEmpty());
// random case
- int subsize = rng.nextInt(datasize);
+ int subsize = rng.nextInt(DATA_SIZE);
source = data.clone();
subset = source.rsplit(rng, subsize);
assertEquals("subset.size is incorrect", subsize, subset.size());
- assertEquals("source.size is incorrect", datasize - subsize, source.size());
+ assertEquals("source.size is incorrect", DATA_SIZE - subsize, source.size());
}
public void testCountLabel() throws Exception {
- Data data = Utils.randomData(rng, nbAttributes, datasize);
+ Data data = Utils.randomData(rng, ATTRIBUTE_COUNT, DATA_SIZE);
int[] counts = new int[data.getDataset().nblabels()];
int n = 10;
@@ -251,7 +251,7 @@ public class DataTest extends MahoutTest
public void testMajorityLabel() throws Exception {
// all instances have the same label
- String descriptor = Utils.randomDescriptor(rng, nbAttributes);
+ String descriptor = Utils.randomDescriptor(rng, ATTRIBUTE_COUNT);
int label = Utils.findLabel(descriptor);
int label1 = rng.nextInt();
Modified: mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java Fri Aug 13 03:03:42 2010
@@ -44,7 +44,7 @@ public final class Utils {
private static class LogCallback implements PredictionCallback {
- private final Logger log;
+ private static Logger log;
private LogCallback(Logger log) {
this.log = log;
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java Fri Aug 13 03:03:42 2010
@@ -42,35 +42,9 @@ public class Constants {
protected static final double SQRTH = 7.07106781186547524401E-1;
protected static final double LOGPI = 1.14472988584940017414;
- protected static final double big = 4.503599627370496e15;
- protected static final double biginv = 2.22044604925031308085e-16;
+ protected static final double BIG = 4.503599627370496e15;
+ protected static final double BIG_INVERSE = 2.22044604925031308085e-16;
-
- /*
- * MACHEP = 1.38777878078144567553E-17 2**-56
- * MAXLOG = 8.8029691931113054295988E1 log(2**127)
- * MINLOG = -8.872283911167299960540E1 log(2**-128)
- * MAXNUM = 1.701411834604692317316873e38 2**127
- *
- * For IEEE arithmetic (IBMPC):
- * MACHEP = 1.11022302462515654042E-16 2**-53
- * MAXLOG = 7.09782712893383996843E2 log(2**1024)
- * MINLOG = -7.08396418532264106224E2 log(2**-1022)
- * MAXNUM = 1.7976931348623158E308 2**1024
- *
- * The global symbols for mathematical constants are
- * PI = 3.14159265358979323846 pi
- * PIO2 = 1.57079632679489661923 pi/2
- * PIO4 = 7.85398163397448309616E-1 pi/4
- * SQRT2 = 1.41421356237309504880 sqrt(2)
- * SQRTH = 7.07106781186547524401E-1 sqrt(2)/2
- * LOG2E = 1.4426950408889634073599 1/log(2)
- * SQ2OPI = 7.9788456080286535587989E-1 sqrt( 2/pi )
- * LOGE2 = 6.93147180559945309417E-1 log(2)
- * LOGSQ2 = 3.46573590279972654709E-1 log(2)/2
- * THPIO4 = 2.35619449019234492885 3*pi/4
- * TWOOPI = 6.36619772367581343075535E-1 2/pi
- */
protected Constants() {
}
}
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Beta.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Beta.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Beta.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Beta.java Fri Aug 13 03:03:42 2010
@@ -21,8 +21,8 @@ public class Beta extends AbstractContin
private double PDF_CONST; // cache to speed up pdf()
// cached values shared by bXX
- private double a_last = 0.0, b_last = 0.0;
- private double a_, b_, t, fa, fb, p1, p2;
+ private double aLast = 0.0, bLast = 0.0;
+ private double aMinus1, bMinus1, t, fa, fb, p1, p2;
// cached values for b00
@@ -30,12 +30,12 @@ public class Beta extends AbstractContin
private double ml, mu;
// chached values for b1prs
- private double p_last = 0.0, q_last = 0.0;
+ private double pLast = 0.0, qLast = 0.0;
private double a;
private double b;
private double m;
- private double D;
- private double Dl;
+ private double d;
+ private double d1;
private double x1;
private double x2;
private double x4;
@@ -61,20 +61,20 @@ public class Beta extends AbstractContin
*/
protected double b00(double a, double b, RandomEngine randomGenerator) {
- if (a != a_last || b != b_last) {
- a_last = a;
- b_last = b;
-
- a_ = a - 1.0;
- b_ = b - 1.0;
- double c = (b * b_) / (a * a_);
+ if (a != aLast || b != bLast) {
+ aLast = a;
+ bLast = b;
+
+ aMinus1 = a - 1.0;
+ bMinus1 = b - 1.0;
+ double c = (b * bMinus1) / (a * aMinus1);
if (Math.abs(c - 1.0) < 1e-8) {
t = 0.5;
} else {
t = (1.0 - Math.sqrt(c)) / (1.0 - c);
}
- fa = Math.exp(a_ * Math.log(t));
- fb = Math.exp(b_ * Math.log(1.0 - t)); // f(t) = fa * fb
+ fa = Math.exp(aMinus1 * Math.log(t));
+ fb = Math.exp(bMinus1 * Math.log(1.0 - t)); // f(t) = fa * fb
p1 = t / a; // 0 < X < t
p2 = (1.0 - t) / b + p1; // t < X < 1
@@ -89,13 +89,13 @@ public class Beta extends AbstractContin
Z = Math.exp(Math.log(U / p1) / a);
X = t * Z;
// squeeze accept: L(x) = 1 + (1 - b)x
- if ((V = randomGenerator.raw() * fb) <= 1.0 - b_ * X) {
+ if ((V = randomGenerator.raw() * fb) <= 1.0 - bMinus1 * X) {
break;
}
// squeeze reject: U(x) = 1 + ((1 - t)^(b-1) - 1)/t * x
if (V <= 1.0 + (fb - 1.0) * Z) {
// quotient accept: q(x) = (1 - x)^(b-1) / fb
- if (Math.log(V) <= b_ * Math.log(1.0 - X)) {
+ if (Math.log(V) <= bMinus1 * Math.log(1.0 - X)) {
break;
}
}
@@ -103,13 +103,13 @@ public class Beta extends AbstractContin
Z = Math.exp(Math.log((U - p1) / (p2 - p1)) / b);
X = 1.0 - (1.0 - t) * Z;
// squeeze accept: L(x) = 1 + (1 - a)(1 - x)
- if ((V = randomGenerator.raw() * fa) <= 1.0 - a_ * (1.0 - X)) {
+ if ((V = randomGenerator.raw() * fa) <= 1.0 - aMinus1 * (1.0 - X)) {
break;
}
// squeeze reject: U(x) = 1 + (t^(a-1) - 1)/(1 - t) * (1 - x)
if (V <= 1.0 + (fa - 1.0) * Z) {
// quotient accept: q(x) = x^(a-1) / fa
- if (Math.log(V) <= a_ * Math.log(X)) {
+ if (Math.log(V) <= aMinus1 * Math.log(X)) {
break;
}
}
@@ -123,23 +123,23 @@ public class Beta extends AbstractContin
*/
protected double b01(double a, double b, RandomEngine randomGenerator) {
- if (a != a_last || b != b_last) {
- a_last = a;
- b_last = b;
-
- a_ = a - 1.0;
- b_ = b - 1.0;
- t = a_ / (a - b); // one step Newton * start value t
- fb = Math.exp((b_ - 1.0) * Math.log(1.0 - t));
- fa = a - (a + b_) * t;
+ if (a != aLast || b != bLast) {
+ aLast = a;
+ bLast = b;
+
+ aMinus1 = a - 1.0;
+ bMinus1 = b - 1.0;
+ t = aMinus1 / (a - b); // one step Newton * start value t
+ fb = Math.exp((bMinus1 - 1.0) * Math.log(1.0 - t));
+ fa = a - (a + bMinus1) * t;
t -= (t - (1.0 - fa) * (1.0 - t) * fb / b) / (1.0 - fa * fb);
- fa = Math.exp(a_ * Math.log(t));
- fb = Math.exp(b_ * Math.log(1.0 - t)); // f(t) = fa * fb
- if (b_ <= 1.0) {
+ fa = Math.exp(aMinus1 * Math.log(t));
+ fb = Math.exp(bMinus1 * Math.log(1.0 - t)); // f(t) = fa * fb
+ if (bMinus1 <= 1.0) {
ml = (1.0 - fb) / t; // ml = -m1
- mu = b_ * t; // mu = -m2 * t
+ mu = bMinus1 * t; // mu = -m2 * t
} else {
- ml = b_;
+ ml = bMinus1;
mu = 1.0 - fb;
}
p1 = t / a; // 0 < X < t
@@ -161,7 +161,7 @@ public class Beta extends AbstractContin
// squeeze reject: U(x) = 1 + m2*x, mu = -m2 * t
if (V <= 1.0 - mu * Z) {
// quotient accept: q(x) = (1 - x)^(b-1)
- if (Math.log(V) <= b_ * Math.log(1.0 - X)) {
+ if (Math.log(V) <= bMinus1 * Math.log(1.0 - X)) {
break;
}
}
@@ -169,13 +169,13 @@ public class Beta extends AbstractContin
Z = Math.exp(Math.log((U - p1) / (p2 - p1)) / b);
X = 1.0 - (1.0 - t) * Z;
// squeeze accept: L(x) = 1 + (1 - a)(1 - x)
- if ((V = randomGenerator.raw() * fa) <= 1.0 - a_ * (1.0 - X)) {
+ if ((V = randomGenerator.raw() * fa) <= 1.0 - aMinus1 * (1.0 - X)) {
break;
}
// squeeze reject: U(x) = 1 + (t^(a-1) - 1)/(1 - t) * (1 - x)
if (V <= 1.0 + (fa - 1.0) * Z) {
// quotient accept: q(x) = (x)^(a-1) / fa
- if (Math.log(V) <= a_ * Math.log(X)) {
+ if (Math.log(V) <= aMinus1 * Math.log(X)) {
break;
}
}
@@ -189,32 +189,32 @@ public class Beta extends AbstractContin
*/
protected double b1prs(double p, double q, RandomEngine randomGenerator) {
- if (p != p_last || q != q_last) {
- p_last = p;
- q_last = q;
+ if (p != pLast || q != qLast) {
+ pLast = p;
+ qLast = q;
a = p - 1.0;
b = q - 1.0;
double s = a + b;
m = a / s;
if (a > 1.0 || b > 1.0) {
- D = Math.sqrt(m * (1.0 - m) / (s - 1.0));
+ d = Math.sqrt(m * (1.0 - m) / (s - 1.0));
}
if (a <= 1.0) {
- x2 = (Dl = m * 0.5);
+ x2 = (d1 = m * 0.5);
x1 = z2 = 0.0;
f1 = ll = 0.0;
} else {
- x2 = m - D;
- x1 = x2 - D;
- z2 = x2 * (1.0 - (1.0 - x2) / (s * D));
+ x2 = m - d;
+ x1 = x2 - d;
+ z2 = x2 * (1.0 - (1.0 - x2) / (s * d));
if (x1 <= 0.0 || (s - 6.0) * x2 - a + 3.0 > 0.0) {
x1 = z2;
x2 = (x1 + m) * 0.5;
- Dl = m - x2;
+ d1 = m - x2;
} else {
- Dl = D;
+ d1 = d;
}
f1 = f(x1, a, b, m);
ll = x1 * (1.0 - x1) / (s * (m - x1)); // z1 = x1 - ll
@@ -222,25 +222,25 @@ public class Beta extends AbstractContin
f2 = f(x2, a, b, m);
if (b <= 1.0) {
- x4 = 1.0 - (D = (1.0 - m) * 0.5);
+ x4 = 1.0 - (d = (1.0 - m) * 0.5);
x5 = z4 = 1.0;
f5 = lr = 0.0;
} else {
- x4 = m + D;
- x5 = x4 + D;
- z4 = x4 * (1.0 + (1.0 - x4) / (s * D));
+ x4 = m + d;
+ x5 = x4 + d;
+ z4 = x4 * (1.0 + (1.0 - x4) / (s * d));
if (x5 >= 1.0 || (s - 6.0) * x4 - a + 3.0 < 0.0) {
x5 = z4;
x4 = (m + x5) * 0.5;
- D = x4 - m;
+ d = x4 - m;
}
f5 = f(x5, a, b, m);
lr = x5 * (1.0 - x5) / (s * (x5 - m)); // z5 = x5 + lr
}
f4 = f(x4, a, b, m);
- p1 = f2 * (Dl + Dl); // x1 < X < m
- p2 = f4 * (D + D) + p1; // m < X < x5
+ p1 = f2 * (d1 + d1); // x1 < X < m
+ p2 = f4 * (d + d) + p1; // m < X < x5
p3 = f1 * ll + p2; // X < x1
p4 = f5 * lr + p3; // x5 < X
}
@@ -253,15 +253,15 @@ public class Beta extends AbstractContin
double U;
if ((U = randomGenerator.raw() * p4) <= p1) {
// immediate accept: x2 < X < m, - f(x2) < W < 0
- if ((W = U / Dl - f2) <= 0.0) {
+ if ((W = U / d1 - f2) <= 0.0) {
return (m - U / f2);
}
// immediate accept: x1 < X < x2, 0 < W < f(x1)
if (W <= f1) {
- return (x2 - W / f1 * Dl);
+ return (x2 - W / f1 * d1);
}
// candidates for acceptance-rejection-test
- V = Dl * (U = randomGenerator.raw());
+ V = d1 * (U = randomGenerator.raw());
X = x2 - V;
Y = x2 + V;
// squeeze accept: L(x) = f(x2) (x - z2) / (x2 - z2)
@@ -281,15 +281,15 @@ public class Beta extends AbstractContin
} else if (U <= p2) {
U -= p1;
// immediate accept: m < X < x4, - f(x4) < W < 0
- if ((W = U / D - f4) <= 0.0) {
+ if ((W = U / d - f4) <= 0.0) {
return (m + U / f4);
}
// immediate accept: x4 < X < x5, 0 < W < f(x5)
if (W <= f5) {
- return (x4 + W / f5 * D);
+ return (x4 + W / f5 * d);
}
// candidates for acceptance-rejection-test
- V = D * (U = randomGenerator.raw());
+ V = d * (U = randomGenerator.raw());
X = x4 + V;
Y = x4 - V;
// squeeze accept: L(x) = f(x4) (z4 - x) / (z4 - x4)
@@ -433,7 +433,7 @@ public class Beta extends AbstractContin
}
/** Sets the parameters. */
- public void setState(double alpha, double beta) {
+ public final void setState(double alpha, double beta) {
this.alpha = alpha;
this.beta = beta;
this.PDF_CONST = Fun.logGamma(alpha + beta) - Fun.logGamma(alpha) - Fun.logGamma(beta);
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Binomial.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Binomial.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Binomial.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Binomial.java Fri Aug 13 03:03:42 2010
@@ -15,22 +15,22 @@ import org.apache.mahout.math.jet.stat.P
/** @deprecated until unit tests are in place. Until this time, this class/interface is unsupported. */
@Deprecated
public class Binomial extends AbstractDiscreteDistribution {
+ private static final int DMAX_KM = 20;
private int n;
private double p;
// cache vars for method generateBinomial(...)
- private int n_last = -1, n_prev = -1;
- private double par, np, p0, q, p_last = -1.0, p_prev = -1.0;
+ private int nLast = -1, nPrev = -1;
+ private double par, np, p0, q, pLast = -1.0, pPrev = -1.0;
private int b, m, nm;
private double pq, rc, ss, xm, xl, xr, ll, lr, c, p1, p2, p3, p4, ch;
// cache vars for method pdf(...)
- private double log_p, log_q, log_n;
+ private double logP, logQ, logN;
// The uniform random number generated shared by all <b>static</b> methods.
private static final Binomial shared = new Binomial(1, 0.5, makeDefaultGenerator());
-
/**
* Constructs a binomial distribution. Example: n=1, p=0.5.
*
@@ -89,9 +89,9 @@ public class Binomial extends AbstractDi
int i;
double f;
- if (n != n_last || p != p_last) { // set-up
- n_last = n;
- p_last = p;
+ if (n != nLast || p != pLast) { // set-up
+ nLast = n;
+ pLast = p;
par = Math.min(p, 1.0 - p);
q = 1.0 - par;
np = n * par;
@@ -149,10 +149,6 @@ public class Binomial extends AbstractDi
return ((p > 0.5) ? (n - K) : K);
}
- int DMAX_KM = 20;
- double C1_6 = 0.16666666666666667;
- double C5_8 = 0.62500000000000000;
- double C1_3 = 0.33333333333333333;
while (true) {
double V = randomGenerator.raw();
if ((U = randomGenerator.raw() * p4) <= p1) { // triangular region
@@ -206,14 +202,14 @@ public class Binomial extends AbstractDi
// lower and upper squeeze tests, based on lower bounds for log p(K)
V = Math.log(V);
double T = -Km * Km / (ss + ss);
- double E = (Km / ss) * ((Km * (Km * C1_3 + C5_8) + C1_6) / ss + 0.5);
+ double E = (Km / ss) * ((Km * (Km * 1.0 / 3 + 5.0 / 8) + 1.0 / 6) / ss + 0.5);
if (V <= T - E) {
break;
}
if (V <= T + E) {
- if (n != n_prev || par != p_prev) {
- n_prev = n;
- p_prev = par;
+ if (n != nPrev || par != pPrev) {
+ nPrev = n;
+ pPrev = par;
nm = n - m + 1;
ch = xm * Math.log((m + 1.0) / (pq * nm)) +
@@ -261,7 +257,7 @@ public class Binomial extends AbstractDi
}
int r = this.n - k;
return Math
- .exp(this.log_n - Arithmetic.logFactorial(k) - Arithmetic.logFactorial(r) + this.log_p * k + this.log_q * r);
+ .exp(this.logN - Arithmetic.logFactorial(k) - Arithmetic.logFactorial(r) + this.logP * k + this.logQ * r);
}
/**
@@ -271,16 +267,16 @@ public class Binomial extends AbstractDi
* @param p the probability of success.
* @throws IllegalArgumentException if <tt>n*Math.min(p,1-p) <= 0.0</tt>
*/
- public void setNandP(int n, double p) {
+ public final void setNandP(int n, double p) {
if (n * Math.min(p, 1 - p) <= 0.0) {
throw new IllegalArgumentException();
}
this.n = n;
this.p = p;
- this.log_p = Math.log(p);
- this.log_q = Math.log(1.0 - p);
- this.log_n = Arithmetic.logFactorial(n);
+ this.logP = Math.log(p);
+ this.logQ = Math.log(1.0 - p);
+ this.logN = Arithmetic.logFactorial(n);
}
/**
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Fun.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Fun.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Fun.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Fun.java Fri Aug 13 03:03:42 2010
@@ -21,12 +21,12 @@ class Fun {
private Fun() {
}
- private static double _fkt_value(double lambda, double z1, double z2, double x_value) {
+ private static double fktValue(double lambda, double z1, double z2, double xValue) {
- return Math.cos(z1 * x_value) / (Math.pow((x_value * x_value + z2 * z2), (lambda + 0.5)));
+ return Math.cos(z1 * xValue) / (Math.pow((xValue * xValue + z2 * z2), (lambda + 0.5)));
}
- public static double bessel2_fkt(double lambda, double beta) {
+ public static double bessel2Fkt(double lambda, double beta) {
double[] b0 = {-1.5787132, -0.6130827, 0.1735823, 1.4793411,
2.6667307, 4.9086836, 8.1355339,
@@ -262,29 +262,29 @@ class Fun {
double x = 0.0;
- double new_value;
+ double newValue;
double x1;
double step;
if (beta < 1.57) {
- double fx = (fkt2_value(lambda, beta, x)) * 0.01;
+ double fx = (fkt2Value(lambda, beta, x)) * 0.01;
double y = 0.0;
while (true) { //while (!NULL) {
y += 0.1;
- if ((fkt2_value(lambda, beta, y)) < fx) {
+ if ((fkt2Value(lambda, beta, y)) < fx) {
break;
}
}
step = y * 0.001;
x1 = step;
- sum = (0.5 * (10.0 * step + fkt2_value(lambda, beta, x1))) * step;
- double first_value = sum;
+ sum = (0.5 * (10.0 * step + fkt2Value(lambda, beta, x1))) * step;
+ double firstValue = sum;
double epsilon = 0.01;
while (true) { //while (!NULL) {
x = x1;
x1 += step;
- new_value = (0.5 * (fkt2_value(lambda, beta, x) + fkt2_value(lambda, beta, x1))) * step;
- sum += new_value;
- if ((new_value / first_value) < epsilon) {
+ newValue = (0.5 * (fkt2Value(lambda, beta, x) + fkt2Value(lambda, beta, x1))) * step;
+ sum += newValue;
+ if ((newValue / firstValue) < epsilon) {
break;
}
}
@@ -296,33 +296,33 @@ class Fun {
double period = pi / z1;
step = 0.1 * period;
double border = 100.0 / ((lambda + 0.1) * (lambda + 0.1));
- int nr_per = (int) Math.ceil((border / period)) + 20;
+ int nrPer = (int) Math.ceil((border / period)) + 20;
x1 = step;
int j;
double z2 = 1.57;
- for (i = 1; i <= nr_per; i++) {
+ for (i = 1; i <= nrPer; i++) {
for (j = 1; j <= 10; j++) {
- new_value = (0.5 * (_fkt_value(lambda, z1, z2, x) + _fkt_value(lambda, z1, z2, x1))) * step;
- sum += new_value;
+ newValue = (0.5 * (fktValue(lambda, z1, z2, x) + fktValue(lambda, z1, z2, x1))) * step;
+ sum += newValue;
x = x1;
x1 += step;
}
}
for (j = 1; j <= 5; j++) {
- new_value = (0.5 * (_fkt_value(lambda, z1, z2, x) + _fkt_value(lambda, z1, z2, x1))) * step;
- sum += new_value;
+ newValue = (0.5 * (fktValue(lambda, z1, z2, x) + fktValue(lambda, z1, z2, x1))) * step;
+ sum += newValue;
x = x1;
x1 += step;
}
- double first_sum = sum;
+ double firstSum = sum;
for (j = 1; j <= 10; j++) {
- new_value = (0.5 * (_fkt_value(lambda, z1, z2, x) + _fkt_value(lambda, z1, z2, x1))) * step;
- sum += new_value;
+ newValue = (0.5 * (fktValue(lambda, z1, z2, x) + fktValue(lambda, z1, z2, x1))) * step;
+ sum += newValue;
x = x1;
x1 += step;
}
- double second_sum = sum;
- sum = 0.5 * (first_sum + second_sum);
+ double secondSum = sum;
+ sum = 0.5 * (firstSum + secondSum);
erg = gamma(lambda + 0.5) * Math.pow((2.0 * z2), lambda) / (Math.sqrt(pi) * Math.pow(z1, lambda)) * sum;
erg = -Math.log(2.0 * erg);
return (erg);
@@ -375,9 +375,9 @@ class Fun {
return Arithmetic.longFactorial(n);
}
- private static double fkt2_value(double lambda, double beta, double x_value) {
+ private static double fkt2Value(double lambda, double beta, double xValue) {
- return cosh(lambda * x_value) * Math.exp(-beta * cosh(x_value));
+ return cosh(lambda * xValue) * Math.exp(-beta * cosh(xValue));
}
private static double cosh(double x) {
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Normal.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Normal.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Normal.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Normal.java Fri Aug 13 03:03:42 2010
@@ -22,7 +22,7 @@ public class Normal extends AbstractCont
private double cache; // cache for Box-Mueller algorithm
private boolean cacheFilled; // Box-Mueller
- private double SQRT_INV; // performance cache
+ private double normalizer; // performance cache
// The uniform random number generated shared by all <b>static</b> methods.
private static final Normal shared = new Normal(0.0, 1.0, makeDefaultGenerator());
@@ -68,7 +68,7 @@ public class Normal extends AbstractCont
/** Returns the probability distribution function. */
public double pdf(double x) {
double diff = x - mean;
- return SQRT_INV * Math.exp(-(diff * diff) / (2.0 * variance));
+ return normalizer * Math.exp(-(diff * diff) / (2.0 * variance));
}
/** Sets the uniform random generator internally used. */
@@ -86,7 +86,7 @@ public class Normal extends AbstractCont
this.variance = standardDeviation * standardDeviation;
this.cacheFilled = false;
- this.SQRT_INV = 1.0 / Math.sqrt(2.0 * Math.PI * variance);
+ this.normalizer = 1.0 / Math.sqrt(2.0 * Math.PI * variance);
}
}
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Poisson.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Poisson.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Poisson.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Poisson.java Fri Aug 13 03:03:42 2010
@@ -19,7 +19,7 @@ public class Poisson extends AbstractDis
// precomputed and cached values (for performance only)
// cache for < SWITCH_MEAN
- private double my_old = -1.0;
+ private double myOld = -1.0;
private double p;
private double q;
private double p0;
@@ -27,7 +27,7 @@ public class Poisson extends AbstractDis
private int llll;
// cache for >= SWITCH_MEAN
- private double my_last = -1.0;
+ private double myLast = -1.0;
private double ll;
private int k2;
private int k4;
@@ -40,8 +40,8 @@ public class Poisson extends AbstractDis
private double r4;
private double r5;
private double lr;
- private double l_my;
- private double c_pm;
+ private double lMy;
+ private double cPm;
private double f1;
private double f2;
private double f4;
@@ -129,8 +129,8 @@ public class Poisson extends AbstractDis
int m;
if (theMean < SWITCH_MEAN) { // CASE B: Inversion- start new table and calculate p0
- if (theMean != my_old) {
- my_old = theMean;
+ if (theMean != myOld) {
+ myOld = theMean;
llll = 0;
p = Math.exp(-theMean);
q = p;
@@ -174,8 +174,8 @@ public class Poisson extends AbstractDis
// f1, f2, f4, f5, p1, p2, p3, p4, p5, p6;
m = (int) theMean;
- if (theMean != my_last) { // set-up
- my_last = theMean;
+ if (theMean != myLast) { // set-up
+ myLast = theMean;
// approximate deviation of reflection points k2, k4 from my - 1/2
double Ds = Math.sqrt(theMean + 0.25);
@@ -202,14 +202,14 @@ public class Poisson extends AbstractDis
lr = -Math.log(r5); // expon. tail right
// Poisson constants, necessary for computing function values f(k)
- l_my = Math.log(theMean);
- c_pm = m * l_my - Arithmetic.logFactorial(m);
+ lMy = Math.log(theMean);
+ cPm = m * lMy - Arithmetic.logFactorial(m);
// function values f(k) = p(k)/p(m) at k = k2, k4, k1, k5
- f2 = f(k2, l_my, c_pm);
- f4 = f(k4, l_my, c_pm);
- f1 = f(k1, l_my, c_pm);
- f5 = f(k5, l_my, c_pm);
+ f2 = f(k2, lMy, cPm);
+ f4 = f(k4, lMy, cPm);
+ f1 = f(k1, lMy, cPm);
+ f5 = f(k5, lMy, cPm);
// area of the two centre and the two exponential tail regions
// area of the two immediate acceptance regions between k2, k4
@@ -252,7 +252,7 @@ public class Poisson extends AbstractDis
if (V <= f2 + Dk * (1.0 - f2) / (dl + 1.0)) {// quick accept of
return (Y); // Y = k2 + Dk
}
- if (V <= f(Y, l_my, c_pm)) {
+ if (V <= f(Y, lMy, cPm)) {
return (Y);
} // final accept of Y
}
@@ -278,7 +278,7 @@ public class Poisson extends AbstractDis
if (V <= f4 + Dk * (1.0 - f4) / dr) { // quick accept of
return (Y); // Y = k4 - Dk
}
- if (V <= f(Y, l_my, c_pm)) {
+ if (V <= f(Y, lMy, cPm)) {
return (Y);
} // final accept of Y
}
@@ -307,7 +307,7 @@ public class Poisson extends AbstractDis
// acceptance-rejection test of candidate X from the original area
// test, whether W <= f(k), with W = U*h(x) and U -- U(0, 1)
// log f(X) = (X - m)*log(my) - log X! + log m!
- if (Math.log(W) <= X * l_my - Arithmetic.logFactorial(X) - c_pm) {
+ if (Math.log(W) <= X * lMy - Arithmetic.logFactorial(X) - cPm) {
return (X);
}
}
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Gamma.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Gamma.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Gamma.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Gamma.java Fri Aug 13 03:03:42 2010
@@ -333,17 +333,17 @@ public class Gamma extends org.apache.ma
k7 += 2.0;
k8 += 2.0;
- if ((Math.abs(qk) + Math.abs(pk)) > big) {
- pkm2 *= biginv;
- pkm1 *= biginv;
- qkm2 *= biginv;
- qkm1 *= biginv;
- }
- if ((Math.abs(qk) < biginv) || (Math.abs(pk) < biginv)) {
- pkm2 *= big;
- pkm1 *= big;
- qkm2 *= big;
- qkm1 *= big;
+ if ((Math.abs(qk) + Math.abs(pk)) > BIG) {
+ pkm2 *= BIG_INVERSE;
+ pkm1 *= BIG_INVERSE;
+ qkm2 *= BIG_INVERSE;
+ qkm1 *= BIG_INVERSE;
+ }
+ if ((Math.abs(qk) < BIG_INVERSE) || (Math.abs(pk) < BIG_INVERSE)) {
+ pkm2 *= BIG;
+ pkm1 *= BIG;
+ qkm2 *= BIG;
+ qkm1 *= BIG;
}
} while (++n < 300);
@@ -412,17 +412,17 @@ public class Gamma extends org.apache.ma
k7 += 2.0;
k8 += 2.0;
- if ((Math.abs(qk) + Math.abs(pk)) > big) {
- pkm2 *= biginv;
- pkm1 *= biginv;
- qkm2 *= biginv;
- qkm1 *= biginv;
- }
- if ((Math.abs(qk) < biginv) || (Math.abs(pk) < biginv)) {
- pkm2 *= big;
- pkm1 *= big;
- qkm2 *= big;
- qkm1 *= big;
+ if ((Math.abs(qk) + Math.abs(pk)) > BIG) {
+ pkm2 *= BIG_INVERSE;
+ pkm1 *= BIG_INVERSE;
+ qkm2 *= BIG_INVERSE;
+ qkm1 *= BIG_INVERSE;
+ }
+ if ((Math.abs(qk) < BIG_INVERSE) || (Math.abs(pk) < BIG_INVERSE)) {
+ pkm2 *= BIG;
+ pkm1 *= BIG;
+ qkm2 *= BIG;
+ qkm1 *= BIG;
}
} while (++n < 300);
@@ -522,11 +522,11 @@ public class Gamma extends org.apache.ma
pkm1 = pk;
qkm2 = qkm1;
qkm1 = qk;
- if (Math.abs(pk) > big) {
- pkm2 *= biginv;
- pkm1 *= biginv;
- qkm2 *= biginv;
- qkm1 *= biginv;
+ if (Math.abs(pk) > BIG) {
+ pkm2 *= BIG_INVERSE;
+ pkm1 *= BIG_INVERSE;
+ qkm2 *= BIG_INVERSE;
+ qkm1 *= BIG_INVERSE;
}
} while (t > MACHEP);
Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/AbstractTestVector.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/AbstractTestVector.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/AbstractTestVector.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/AbstractTestVector.java Fri Aug 13 03:03:42 2010
@@ -36,7 +36,7 @@ public abstract class AbstractTestVector
}
@Override
- protected void setUp() throws Exception {
+ protected void setUp() {
super.setUp();
test = generateTestVector(2 * values.length + 1);
for (int i = 0; i < values.length; i++) {
Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/MahoutTestCase.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/MahoutTestCase.java?rev=985081&r1=985080&r2=985081&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/MahoutTestCase.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/MahoutTestCase.java Fri Aug 13 03:03:42 2010
@@ -29,16 +29,14 @@ public abstract class MahoutTestCase ext
@Override
protected void setUp() throws Exception {
- super.setUp();
testTempDir = null;
}
@Override
- protected void tearDown() throws Exception {
+ protected void tearDown() {
if (testTempDir != null) {
new DeletingVisitor().accept(testTempDir);
}
- super.tearDown();
}
protected final File getTestTempDir() throws IOException {