Search in sources :

Example 1 with GeneMeanModel

use of ntuple.GeneMeanModel in project SimpleAsteroids by ljialin.

the class MeanLearner method learn.

@Override
public int[] learn(List<ScoredVec> scoredVecs, NoisySolutionEvaluator evaluator) {
    int n = evaluator.searchSpace().nDims();
    fitness = new double[scoredVecs.size()];
    // set up the models
    GeneMeanModel[] models = new GeneMeanModel[n];
    for (int i = 0; i < n; i++) models[i] = new GeneMeanModel(evaluator.searchSpace().nValues(i));
    // now train the,
    int ix = 0;
    for (ScoredVec sv : scoredVecs) {
        // update it here
        for (int i = 0; i < n; i++) {
            models[i].updateMean(sv.p[i], sv.score);
        }
        int[] p = argmax(models);
        // System.out.println(Arrays.toString(p));
        fitness[ix++] = evaluator.trueFitness(p);
    }
    // now return the argmax array
    return argmax(models);
}
Also used : GeneMeanModel(ntuple.GeneMeanModel) ScoredVec(ntuple.ScoredVec)

Aggregations

GeneMeanModel (ntuple.GeneMeanModel)1 ScoredVec (ntuple.ScoredVec)1