CheckLast { public boolean check(TsData data) { clear(); if (!testSeries(data)) { return false; } ModellingContext context = new ModellingContext(); model_ = preprocessor_.process(data.drop(0, nback_), context); if (model_ == null) { return false; } info_ = context.information; TsVariableList vars = model_.description.buildRegressionVariables(); TsDomain fdomain = new TsDomain(model_.description.getSeriesDomain().getEnd(), nback_); List<DataBlock> x = vars.all().data(fdomain); forecasts_ = new Forecasts(); RegArimaEstimation<SarimaModel> estimation = new RegArimaEstimation<>(model_.estimation.getRegArima(), model_.estimation.getLikelihood()); try { forecasts_.calcForecast(estimation, x, nback_, model_.description.getArimaComponent().getFreeParametersCount()); } catch (RuntimeException err) { return false; } y_ = data.fittoDomain(fdomain); fy_ = y_.clone(); ofcasts_ = new TsData(fdomain); for (int i = 0; i < ofcasts_.getLength(); ++i) { ofcasts_.set(i, forecasts_.forecast(i)); } model_.backTransform(ofcasts_, true, true); List<ITsDataTransformation> transformations = model_.description.transformations(); for (ITsDataTransformation tr : transformations) { tr.transform(fy_, null); } return true; } CheckLast(IPreprocessor preprocessor); boolean check(TsData data); Forecasts getForecast(); double[] getValues(); double[] getActualValues(); double[] getAbsoluteErrors(); double getAbsoluteError(int i); double[] getForecastsValues(); double[] getScores(); double[] getRelativeErrors(); double getScore(int i); double getRelativeError(int i); InformationSet getInformation(); int getBackCount(); void setBackCount(int n); PreprocessingModel getEstimatedModel(); boolean testSeries(final TsData y); final static int MAX_REPEAT_COUNT; }
@Test public void testSO() { TramoSpecification spec = TramoSpecification.TRfull.clone(); spec.getOutliers().add(OutlierType.SO); spec.getOutliers().setCriticalValue(3); CheckLast cl=new CheckLast(spec.build()); assertTrue(cl.check(Data.P)); }