-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import java.util.ArrayList; | ||
import org.apache.commons.math3.stat.regression.OLSMultipleLinearRegression; | ||
|
||
public class LearningEvaluator extends BaseEvaluator{ | ||
|
||
ArrayList<double[]> params; | ||
ArrayList<Double> values; | ||
double alpha; // learning parameter, higher alpha means weights are closer to the regression output | ||
// alpha of 1 is directly setting weights to be regression weights | ||
// ideally we start at 1 and lower alpha to get a convergence | ||
|
||
public LearningEvaluator(String file, double alpha){ | ||
super(file); | ||
params = new ArrayList<double[]>(); | ||
values = new ArrayList<Double>(); | ||
this.alpha = alpha; | ||
|
||
} | ||
|
||
public void setAlpha(double a){ | ||
alpha = a; | ||
} | ||
|
||
public void add_data(double[] features, double value){ | ||
values.add(value); | ||
params.add(features); | ||
} | ||
|
||
public void commitWeights(String path){ | ||
this.wp.writeWeights(path, this.weights); // method to commit weights to beta. provide path to beta csv | ||
} | ||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 | ||
10.0, 10.0, 10.0, 10.0, 10.0, 75.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 | ||
10.0, 10.0, 10.0, 10.0, 10.0, 75.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 |