Skip to content

Commit

Permalink
Minor fixes for LinearRegression example
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Hueske authored and fhueske committed Jun 13, 2014
1 parent 22949fc commit 8a55793
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import eu.stratosphere.example.java.ml.util.LinearRegressionData;

/**
* This example implements a basic Linear Regression using batch gradient descent algorithm.
* This example implements a basic Linear Regression to solve the y = theta0 + theta1*x problem using batch gradient descent algorithm.
*
* <p>
* Linear Regression with BGD(batch gradient descent) algorithm is an iterative clustering algorithm and works as follows:<br>
Expand Down Expand Up @@ -57,10 +57,6 @@
* <li> Custom Java objects (PoJos)
* </ul>
*/

/**
* A linearRegression example to solve the y = theta0 + theta1*x problem.
*/
@SuppressWarnings("serial")
public class LinearRegression {

Expand Down Expand Up @@ -100,7 +96,7 @@ public static void main(String[] args) throws Exception{

// emit result
if(fileOutput) {
result.writeAsCsv(outputPath, "\n", " ");
result.writeAsText(outputPath);
} else {
result.print();
}
Expand Down Expand Up @@ -150,7 +146,7 @@ public Params(double x0, double x1){

@Override
public String toString() {
return "(" + theta0 + "|" + theta1 + ")";
return theta0 + " " + theta1;
}

public double getTheta0() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public class LinearRegressionDataGenerator {
*/
public static void main(String[] args) throws IOException {

System.out.println(args.length);

// check parameter count
if (args.length < 1) {
System.out.println("LinearRegressionDataGenerator <numberOfDataPoints> [<seed>]");
Expand All @@ -69,7 +67,7 @@ public static void main(String[] args) throws IOException {
// write the points out
BufferedWriter pointsOut = null;
try {
pointsOut = new BufferedWriter(new FileWriter(new File(POINTS_FILE)));
pointsOut = new BufferedWriter(new FileWriter(new File(tmpDir+"/"+POINTS_FILE)));
StringBuilder buffer = new StringBuilder();

// DIMENSIONALITY + 1 means that the number of x(dimensionality) and target y
Expand Down

0 comments on commit 8a55793

Please sign in to comment.