/src/main/java/net/finmath/montecarlo/conditionalexpectation/MonteCarloConditionalExpectationRegression.java
final RandomVariable[] basisFunctions = basisFunctionsEstimator.getBasisFunctions( ) ;
final RandomVariable[] basisFunctions = basisFunctionsPredictor.getBasisFunctions ( ) ;
this.basisFunctionsEstimator = new RegressionBasisFunctionsGiven(getNonZeroBasisFunctions(basisFunctionsEstimator)); this.basisFunctionsPredictor = new RegressionBasisFunctionsGiven(getNonZeroBasisFunctions(basisFunctionsPredictor)); } @Override public RandomVariable getConditionalExpectation(final RandomVariable randomVariable) { final double[] linearRegressionParameters = getLinearRegressionParameters(randomVariable); <extra_id_0> RandomVariable conditionalExpectation = basisFunctions[0].mult(linearRegressionParameters[0]); for(int i=1; i<basisFunctions.length; i++) { conditionalExpectation = conditionalExpectation.addProduct(basisFunctions[i], linearRegressionParameters[i]); } return conditionalExpectation; }