Skip to content

Commit

Permalink
Add the possibility to use cross validation when training PyAF models #…
Browse files Browse the repository at this point in the history
…105

The Test dataset is optional
  • Loading branch information
Antoine Carme committed Sep 26, 2018
1 parent 2fc58a9 commit 0a587d5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions TS/TimeSeriesModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ def updatePerfs(self, compute_all_indicators = False):
lForecastPerf.compute(lFrameForecast[self.mOriginalSignal] ,
lFrameForecast[lForecastColumnName],
self.mOutName + '_Forecast')
lTestPerf.compute(lFrameTest[self.mOriginalSignal] , lFrameTest[lForecastColumnName],
self.mOutName + '_Test')
if(lFrameTest.shape[0] > 0):
lTestPerf.compute(lFrameTest[self.mOriginalSignal] , lFrameTest[lForecastColumnName],
self.mOutName + '_Test')
pass
else:
lFitPerf.computeCriterion(lFrameFit[self.mOriginalSignal] , lFrameFit[lForecastColumnName] ,
Expand All @@ -86,9 +87,10 @@ def updatePerfs(self, compute_all_indicators = False):
lForecastPerf.computeCriterion(lFrameForecast[self.mOriginalSignal] , lFrameForecast[lForecastColumnName],
self.mTimeInfo.mOptions.mModelSelection_Criterion,
self.mOutName + '_Forecast')
lTestPerf.computeCriterion(lFrameTest[self.mOriginalSignal] , lFrameTest[lForecastColumnName],
self.mTimeInfo.mOptions.mModelSelection_Criterion,
self.mOutName + '_Test')
if(lFrameTest.shape[0] > 0):
lTestPerf.computeCriterion(lFrameTest[self.mOriginalSignal] , lFrameTest[lForecastColumnName],
self.mTimeInfo.mOptions.mModelSelection_Criterion,
self.mOutName + '_Test')

self.mFitPerf = lFitPerf
self.mForecastPerf = lForecastPerf;
Expand Down

0 comments on commit 0a587d5

Please sign in to comment.