com.expleague.ml.func.FuncEnsemble Maven / Gradle / Ivy
package com.expleague.ml.func;
import com.expleague.commons.math.vectors.Vec;
import com.expleague.commons.math.Func;
import java.util.List;
/**
* User: qdeee
* Date: 09.04.14
*/
public class FuncEnsemble extends Ensemble implements Func{
public FuncEnsemble(final X[] models, final Vec weights) {
super(models, weights);
}
public FuncEnsemble(final List models, final double step) {
super(models, step);
}
@Override
public double value(final Vec x) {
double result = 0.;
for (int i = 0; i < size(); i++) {
result += models[i].value(x) * weights.get(i);
}
return result;
}
@Override
public int dim() {
return super.xdim();
}
}