|
import org.encog.neural.data.NeuralData;
import org.encog.neural.data.basic.BasicNeuralData;
/**
* Class used to generate random training sets. This will always generate
* the same number outputs, as it always uses the same seed values. This
* allows for the consistent results needed by the benchmark.
*/
public class GenerateData {
private double[][] ideal;
private double[][] input;
private double randomRange(double min,double max)
{
double n = max - min + 1;
double i = Math.random() % n;
return min + i;
}
public void generate(final int count, final int inputCount,
final int idealCount, final double min, final double max) {
this.input = new double[count][inputCount];
this.ideal = new double[count][idealCount];
for (int i = 0; i < count; i++) {
for (int j = 0; j < inputCount; j++) {
input[i][j] = randomRange(min,max);
}
for (int j = 0; j < idealCount; j++) {
ideal[i][j] = randomRange(min, max);
}
}
}
public double[][] getInput() {
return this.input;
}
public double[][] getIdeal() {
return this.ideal;
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Hello, I am a student at Rutgers University. I am in computer science and am learning about machine learning and AI.