def testTemporalPerformance(self, testModel, Xall, Yall, Lall, XtestAll, YtestAll, LtestAll, verbose): # Initial window to kick-off free simulation x_start = XtestAll[0, :][:, None].T # Free simulation ygp, varygp = utils.gp_narx(testModel[0].SAMObject.model, x_start, YtestAll.shape[0], LtestAll, self.windowSize) return 1000
def testTemporalPerformance(self, testModel, Xall, Yall, Lall, XtestAll, YtestAll, LtestAll, verbose): # Initial window to kick-off free simulation x_start = XtestAll[0, :][:, None].T # Free simulation ygp, varygp = utils.gp_narx(testModel[0].SAMObject.model, x_start, YtestAll.shape[0], LtestAll, self.windowSize) pb.figure() pb.plot(YtestAll, 'x-') pb.plot(ygp, 'ro-') pb.legend(('True', 'Pred')) pb.title('NARX-with-exogenous') err = np.sum((YtestAll - ygp)**2) return err
Yts = yy[Ntr:, :] Utr = uu[0:Ntr, :] Uts = uu[Ntr:, :] # ---------- Train autoregressive model with additional (exogenous) inputs m_autoreg = GPy.models.SparseGPRegression(np.hstack((Xtr, Utr)), Ytr, num_inducing=num_inducing) m_autoreg.optimize('bfgs', max_iters=1000, messages=True) print m_autoreg # Initial window to kick-off free simulation x_start = Xts[0, :][:, None].T # Free simulation ygp, varygp = autoregressive.gp_narx(m_autoreg, x_start, Yts.shape[0], Uts, ws) pb.figure() pb.plot(Yts, 'x-') pb.plot(ygp, 'ro-') pb.legend(('True', 'Pred')) pb.title('NARX-with-exogenous') #-------------------------------------------- # #---------- Train autoregressive model with no (exogenous) inputs m_autoreg2 = GPy.models.SparseGPRegression(Xtr, Ytr, num_inducing=num_inducing) print m_autoreg2 # Initial window to kick-off free simulation x_start = Xts[0, :][:, None].T # Free simulation