/// <summary> /// Predicts next value for the time series. /// The prediction is based on the distance of last day observation from the observation /// with closest likelihood. /// </summary> /// <param name="observations">Observation matrix. As a static database of observations</param> /// <param name="weights">Observation weights</param> /// <returns>Predicted vector</returns> public IPredictionResult Predict(double[][] observations, double[] weights) { var model = new GaussianMixtureModel(_mixture.Coefficients, _mixture.Components); var request = new PredictionRequest(); request.TrainingSet = observations; request.NumberOfDays = 1; request.Tolerance = PREDICTION_LIKELIHOOD_TOLERANCE; var predictor = new LikelihoodBasedPredictor(); return(predictor.Predict(model, request)); }
public IEvaluationResult EvaluatePrediction(IPredictionResult predicted, double[][] observed) { var request = new EvaluationRequest(); request.PredictionParameters = new PredictionRequest(); request.PredictionToEvaluate = new PredictionResult(); request.EstimatorType = ErrorEstimatorType.Value; request.PredictionParameters.Tolerance = PREDICTION_LIKELIHOOD_TOLERANCE; request.PredictionParameters.TestSet = observed; request.PredictionToEvaluate.Predicted = predicted.Predicted; var predictor = new LikelihoodBasedPredictor(); return(predictor.Evaluate(request)); }