You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by yx...@apache.org on 2013/09/29 05:04:05 UTC
svn commit: r1527266 - in /hama/trunk: ./ CHANGES.txt
examples/src/main/java/org/apache/hama/examples/NeuralNetwork.java
examples/src/test/java/org/apache/hama/examples/NeuralNetworkTest.java
Author: yxjiang
Date: Sun Sep 29 03:04:05 2013
New Revision: 1527266
URL: http://svn.apache.org/r1527266
Log:
HAMA-806: Make the description of NeuralNetwork example more clear
Modified:
hama/trunk/ (props changed)
hama/trunk/CHANGES.txt
hama/trunk/examples/src/main/java/org/apache/hama/examples/NeuralNetwork.java
hama/trunk/examples/src/test/java/org/apache/hama/examples/NeuralNetworkTest.java
Propchange: hama/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Sep 29 03:04:05 2013
@@ -6,10 +6,8 @@ src-gen
**/docs
logs
.settings
-
lib
target
-
*.ipr
-
*.iml
+*.patch
Modified: hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hama/trunk/CHANGES.txt?rev=1527266&r1=1527265&r2=1527266&view=diff
==============================================================================
--- hama/trunk/CHANGES.txt (original)
+++ hama/trunk/CHANGES.txt Sun Sep 29 03:04:05 2013
@@ -3,6 +3,7 @@ Hama Change Log
Release 0.6.3 (unreleased changes)
NEW FEATURES
+
HAMA-804: Create NeuralNetwork Example (Yexi Jiang)
HAMA-795: Implement Autoencoder based on NeuralNetwork (Yexi Jiang)
HAMA-767: Add vertex addition/removal APIs (Anastasis Andronidis via edwardyoon)
@@ -24,6 +25,7 @@ Release 0.6.3 (unreleased changes)
IMPROVEMENTS
+ HAMA-806: Make the description of NeuralNetwork example more clear (Yexi Jiang)
HAMA-749: Build for C++ Pipes (Martin Illecker)
HAMA-796: Add Vector multiply Matrix for DoubleVector as well as DenseDoubleVector. (Yexi Jiang)
HAMA-770: Use a unified model to represent linear regression, logistic regression, MLP, autoencoder, and deepNets (Yexi Jiang)
Modified: hama/trunk/examples/src/main/java/org/apache/hama/examples/NeuralNetwork.java
URL: http://svn.apache.org/viewvc/hama/trunk/examples/src/main/java/org/apache/hama/examples/NeuralNetwork.java?rev=1527266&r1=1527265&r2=1527266&view=diff
==============================================================================
--- hama/trunk/examples/src/main/java/org/apache/hama/examples/NeuralNetwork.java (original)
+++ hama/trunk/examples/src/main/java/org/apache/hama/examples/NeuralNetwork.java Sun Sep 29 03:04:05 2013
@@ -34,7 +34,8 @@ import org.apache.hama.ml.math.DoubleVec
import org.apache.hama.ml.math.FunctionFactory;
/**
- *
+ * The example of using {@link SmallLayeredNeuralNetwork}, including the
+ * training phase and labeling phase.
*/
public class NeuralNetwork {
@@ -50,9 +51,9 @@ public class NeuralNetwork {
return;
}
- String modelPath = args[1];
- String featureDataPath = args[2];
- String resultDataPath = args[3];
+ String featureDataPath = args[1];
+ String resultDataPath = args[2];
+ String modelPath = args[3];
SmallLayeredNeuralNetwork ann = new SmallLayeredNeuralNetwork(modelPath);
@@ -187,14 +188,14 @@ public class NeuralNetwork {
System.out
.println("\tMODE\t- train: train the model with given training data.");
System.out
- .println("\t\t- evaluate: obtain the result by feeding the features to the neural network.");
+ .println("\t\t- label: obtain the result by feeding the features to the neural network.");
System.out
- .println("\tINPUT_PATH\tin 'train' mode, it is the path of the training data; in 'evaluate' mode, it is the path of the to be evaluated data that lacks the label.");
+ .println("\tINPUT_PATH\tin 'train' mode, it is the path of the training data; in 'label' mode, it is the path of the to be evaluated data that lacks the label.");
System.out
- .println("\tOUTPUT_PATH\tin 'train' mode, it is where the trained model is stored; in 'evaluate' mode, it is where the labeled data is stored.");
+ .println("\tOUTPUT_PATH\tin 'train' mode, it is where the trained model is stored; in 'label' mode, it is where the labeled data is stored.");
System.out.println("\n\tConditional Parameters:");
System.out
- .println("\tMODEL_PATH\tonly required in 'evaluate' mode. It specifies where to load the trained neural network model.");
+ .println("\tMODEL_PATH\tonly required in 'label' mode. It specifies where to load the trained neural network model.");
System.out
.println("\tMAX_ITERATION\tonly used in 'train' mode. It specifies how many iterations for the neural network to run. Default is 0.01.");
System.out
@@ -205,9 +206,9 @@ public class NeuralNetwork {
.println("\tREGULARIZATION_WEIGHT\tonly required in 'train' model. It specifies the weight of reqularization.");
System.out.println("\nExample:");
System.out
- .println("Train a neural network with default setting:\n\tneuralnets train hdfs://localhost:30002/training_data hdfs://localhost:30002/model 8 1");
+ .println("Train a neural network with with feature dimension 8, label dimension 1 and default setting:\n\tneuralnets train hdfs://localhost:30002/training_data hdfs://localhost:30002/model 8 1");
System.out
- .println("Train a neural network by specify learning rate as 0.1, momemtum rate as 0.2, and regularization weight as 0.01:\n\tneuralnets.train hdfs://localhost:30002/training_data hdfs://localhost:30002/model 0.1 0.2 0.01");
+ .println("Train a neural network with with feature dimension 8, label dimension 1 and specify learning rate as 0.1, momemtum rate as 0.2, and regularization weight as 0.01:\n\tneuralnets.train hdfs://localhost:30002/training_data hdfs://localhost:30002/model 8 1 0.1 0.2 0.01");
System.out
.println("Label the data with trained model:\n\tneuralnets evaluate hdfs://localhost:30002/unlabeled_data hdfs://localhost:30002/result hdfs://localhost:30002/model");
}
Modified: hama/trunk/examples/src/test/java/org/apache/hama/examples/NeuralNetworkTest.java
URL: http://svn.apache.org/viewvc/hama/trunk/examples/src/test/java/org/apache/hama/examples/NeuralNetworkTest.java?rev=1527266&r1=1527265&r2=1527266&view=diff
==============================================================================
--- hama/trunk/examples/src/test/java/org/apache/hama/examples/NeuralNetworkTest.java (original)
+++ hama/trunk/examples/src/test/java/org/apache/hama/examples/NeuralNetworkTest.java Sun Sep 29 03:04:05 2013
@@ -58,7 +58,7 @@ public class NeuralNetworkTest extends T
String mode = "label";
try {
NeuralNetwork
- .main(new String[] { mode, MODEL_PATH, dataPath, RESULT_PATH });
+ .main(new String[] { mode, dataPath, RESULT_PATH, MODEL_PATH });
// compare results with ground-truth
BufferedReader groundTruthReader = new BufferedReader(new FileReader(