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 2014/06/09 05:57:50 UTC
git commit: MAHOUT-1577 - Kill a few more warnings and turn off
several (like newline in format string, non-final method call in constructor)
Repository: mahout
Updated Branches:
refs/heads/master 0844e69d6 -> 8bcaa7734
MAHOUT-1577 - Kill a few more warnings and turn off several (like newline in format string, non-final method call in constructor)
Project: http://git-wip-us.apache.org/repos/asf/mahout/repo
Commit: http://git-wip-us.apache.org/repos/asf/mahout/commit/8bcaa773
Tree: http://git-wip-us.apache.org/repos/asf/mahout/tree/8bcaa773
Diff: http://git-wip-us.apache.org/repos/asf/mahout/diff/8bcaa773
Branch: refs/heads/master
Commit: 8bcaa77340ac377a20237af4efbe891dc5a4790d
Parents: 0844e69
Author: Ted Dunning <td...@apache.org>
Authored: Sun Jun 8 20:57:37 2014 -0700
Committer: Ted Dunning <td...@apache.org>
Committed: Sun Jun 8 20:57:37 2014 -0700
----------------------------------------------------------------------
.../src/main/resources/findbugs-exclude.xml | 6 ++
.../src/main/resources/mahout-pmd-ruleset.xml | 6 +-
.../classifier/sgd/RunAdaptiveLogistic.java | 59 ++++++++++----------
.../math/list/AbstractValueTypeList.java.t | 2 +-
...itFeedbackAlternatingLeastSquaresSolver.java | 2 +-
.../math/decomposer/lanczos/LanczosState.java | 2 +-
6 files changed, 43 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mahout/blob/8bcaa773/buildtools/src/main/resources/findbugs-exclude.xml
----------------------------------------------------------------------
diff --git a/buildtools/src/main/resources/findbugs-exclude.xml b/buildtools/src/main/resources/findbugs-exclude.xml
index 3d4a0f5..6d88486 100644
--- a/buildtools/src/main/resources/findbugs-exclude.xml
+++ b/buildtools/src/main/resources/findbugs-exclude.xml
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<Match>
+ <Bug pattern="VA_FORMAT_STRING_USES_NEWLINE"/>
+ </Match>
+ <Match>
+ <Bug pattern="OBL_UNSATISFIED_EXCEPTION_EDGE"/>
+ </Match>
+ <Match>
<Bug pattern="CN_IDIOM_NO_SUPER_CALL"/>
</Match>
<Match>
http://git-wip-us.apache.org/repos/asf/mahout/blob/8bcaa773/buildtools/src/main/resources/mahout-pmd-ruleset.xml
----------------------------------------------------------------------
diff --git a/buildtools/src/main/resources/mahout-pmd-ruleset.xml b/buildtools/src/main/resources/mahout-pmd-ruleset.xml
index 633fda3..b209858 100644
--- a/buildtools/src/main/resources/mahout-pmd-ruleset.xml
+++ b/buildtools/src/main/resources/mahout-pmd-ruleset.xml
@@ -54,7 +54,7 @@
<!--<rule ref="rulesets/java/codesize.xml/CyclomaticComplexity"/>-->
<rule ref="rulesets/java/codesize.xml/ExcessiveClassLength"/>
- <rule ref="rulesets/java/codesize.xml/ExcessiveMethodLength"/>
+ <!--<rule ref="rulesets/java/codesize.xml/ExcessiveMethodLength"/>-->
<rule ref="rulesets/java/codesize.xml/ExcessiveParameterList"/>
<rule ref="rulesets/java/codesize.xml/ExcessivePublicCount"/>
<!--<rule ref="rulesets/java/codesize.xml/TooManyFields"/>-->
@@ -87,7 +87,7 @@
<!--<rule ref="rulesets/java/design.xml/CloseConnection"/>-->
<!--<rule ref="rulesets/java/design.xml/CompareObjectsWithEquals"/>-->
<!--<rule ref="rulesets/java/design.xml/ConfusingTernary"/>-->
- <rule ref="rulesets/java/design.xml/ConstructorCallsOverridableMethod"/>
+ <!--<rule ref="rulesets/java/design.xml/ConstructorCallsOverridableMethod"/>-->
<!--<rule ref="rulesets/java/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
<!--<rule ref="rulesets/java/design.xml/FinalFieldCouldBeStatic"/>-->
<rule ref="rulesets/java/design.xml/IdempotentOperations"/>
@@ -98,7 +98,7 @@
<!--<rule ref="rulesets/java/design.xml/NonCaseLabelInSwitchStatement"/>-->
<!--<rule ref="rulesets/java/design.xml/NonStaticInitializer"/>-->
<rule ref="rulesets/java/design.xml/OptimizableToArrayCall"/>
- <rule ref="rulesets/java/design.xml/PositionLiteralsFirstInComparisons"/>
+ <!--<rule ref="rulesets/java/design.xml/PositionLiteralsFirstInComparisons"/>-->
<!--rule ref="rulesets/java/design.xml/SimplifyBooleanExpressions"/-->
<rule ref="rulesets/java/design.xml/SimplifyBooleanReturns"/>
<rule ref="rulesets/java/design.xml/SimplifyConditional"/>
http://git-wip-us.apache.org/repos/asf/mahout/blob/8bcaa773/examples/src/main/java/org/apache/mahout/classifier/sgd/RunAdaptiveLogistic.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/mahout/classifier/sgd/RunAdaptiveLogistic.java b/examples/src/main/java/org/apache/mahout/classifier/sgd/RunAdaptiveLogistic.java
index 2edefe9..5d0549d 100644
--- a/examples/src/main/java/org/apache/mahout/classifier/sgd/RunAdaptiveLogistic.java
+++ b/examples/src/main/java/org/apache/mahout/classifier/sgd/RunAdaptiveLogistic.java
@@ -74,42 +74,45 @@ public final class RunAdaptiveLogistic {
CrossFoldLearner learner = best.getPayload().getLearner();
BufferedReader in = TrainAdaptiveLogistic.open(inputFile);
+ int k = 0;
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), Charsets.UTF_8));
- out.write(idColumn + ",target,score");
- out.newLine();
+ try {
+ out.write(idColumn + ",target,score");
+ out.newLine();
- String line = in.readLine();
- csv.firstLine(line);
- line = in.readLine();
- Map<String, Double> results = new HashMap<String, Double>();
- int k = 0;
- while (line != null) {
- Vector v = new SequentialAccessSparseVector(lmp.getNumFeatures());
- csv.processLine(line, v, false);
- Vector scores = learner.classifyFull(v);
- results.clear();
- if (maxScoreOnly) {
- results.put(csv.getTargetLabel(scores.maxValueIndex()),
+ String line = in.readLine();
+ csv.firstLine(line);
+ line = in.readLine();
+ Map<String, Double> results = new HashMap<String, Double>();
+ while (line != null) {
+ Vector v = new SequentialAccessSparseVector(lmp.getNumFeatures());
+ csv.processLine(line, v, false);
+ Vector scores = learner.classifyFull(v);
+ results.clear();
+ if (maxScoreOnly) {
+ results.put(csv.getTargetLabel(scores.maxValueIndex()),
scores.maxValue());
- } else {
- for (int i = 0; i < scores.size(); i++) {
- results.put(csv.getTargetLabel(i), scores.get(i));
+ } else {
+ for (int i = 0; i < scores.size(); i++) {
+ results.put(csv.getTargetLabel(i), scores.get(i));
+ }
}
- }
- for (Map.Entry<String,Double> entry : results.entrySet()) {
- out.write(csv.getIdString(line) + ',' + entry.getKey() + ',' + entry.getValue());
- out.newLine();
- }
- k++;
- if (k % 100 == 0) {
- output.println(k + " records processed");
+ for (Map.Entry<String, Double> entry : results.entrySet()) {
+ out.write(csv.getIdString(line) + ',' + entry.getKey() + ',' + entry.getValue());
+ out.newLine();
+ }
+ k++;
+ if (k % 100 == 0) {
+ output.println(k + " records processed");
+ }
+ line = in.readLine();
}
- line = in.readLine();
+ out.flush();
+ } finally {
+ out.close();
}
- out.flush();
- out.close();
output.println(k + " records processed totally.");
}
http://git-wip-us.apache.org/repos/asf/mahout/blob/8bcaa773/math/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t
----------------------------------------------------------------------
diff --git a/math/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t b/math/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t
index c9943b1..343472a 100644
--- a/math/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t
+++ b/math/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t
@@ -39,7 +39,7 @@ import java.util.List;
/**
Abstract base class for resizable lists holding <code>${valueType}</code> elements; abstract.
*/
-public abstract class Abstract${valueTypeCap}List extends AbstractList implements ${valueTypeCap}BufferConsumer, Cloneable {
+public abstract class Abstract${valueTypeCap}List extends AbstractList implements ${valueTypeCap}BufferConsumer {
/**
* The size of the list. This is a READ_ONLY variable for all methods but setSizeRaw(int newSize) !!! If you violate
http://git-wip-us.apache.org/repos/asf/mahout/blob/8bcaa773/math/src/main/java/org/apache/mahout/math/als/ImplicitFeedbackAlternatingLeastSquaresSolver.java
----------------------------------------------------------------------
diff --git a/math/src/main/java/org/apache/mahout/math/als/ImplicitFeedbackAlternatingLeastSquaresSolver.java b/math/src/main/java/org/apache/mahout/math/als/ImplicitFeedbackAlternatingLeastSquaresSolver.java
index 289e809..5794e46 100644
--- a/math/src/main/java/org/apache/mahout/math/als/ImplicitFeedbackAlternatingLeastSquaresSolver.java
+++ b/math/src/main/java/org/apache/mahout/math/als/ImplicitFeedbackAlternatingLeastSquaresSolver.java
@@ -71,7 +71,7 @@ public class ImplicitFeedbackAlternatingLeastSquaresSolver {
}
/* Y' Y */
- Matrix getYtransposeY(final OpenIntObjectHashMap<Vector> Y) {
+ private Matrix getYtransposeY(final OpenIntObjectHashMap<Vector> Y) {
ExecutorService queue = Executors.newFixedThreadPool(numTrainingThreads);
if (log.isInfoEnabled()) {
http://git-wip-us.apache.org/repos/asf/mahout/blob/8bcaa773/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosState.java
----------------------------------------------------------------------
diff --git a/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosState.java b/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosState.java
index df9fcd1..8a55f24 100644
--- a/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosState.java
+++ b/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosState.java
@@ -47,7 +47,7 @@ public class LanczosState {
iterationNumber = 1;
}
- protected void intitializeBasisAndSingularVectors() {
+ private void intitializeBasisAndSingularVectors() {
basis = Maps.newHashMap();
singularVectors = Maps.newHashMap();
}