Beispiel #1
0
 def test_predict(self):
     model = VAR(2)
     model.fit(data)
     forecast, ci95_low, ci95_high = model.predict(10)
     self.assertTrue(
         np.logical_and(forecast > ci95_low, forecast < ci95_high).all())
Beispiel #2
0
 def test_predict_as_table(self):
     model = VAR(2)
     model.fit(data)
     forecast = model.predict(10, as_table=True)
     self.assertEqual(len(forecast.domain.variables), 2 * (1 + 2))
        super().closeEvent(event)

    def closeContext(self) -> None:
        """
        Gather configs in contextVariables and close context.
        """
        if not self.features:
            # only close in case of when features are not present if they are
            # feature selection is defined by the input and context should
            # not have impact
            attrs, is_logit = [], []
            for config in self.configs:
                attrs.append(config.get_selection())
                is_logit.append(config.is_logarithmic)
            self.attrs = attrs
            self.is_logit = is_logit
            super().closeContext()


if __name__ == "__main__":
    from orangecontrib.timeseries import ARIMA, VAR

    airpassengers = Timeseries.from_file('airpassengers')
    msft = airpassengers.interp()
    model1 = ARIMA((3, 1, 1)).fit(airpassengers)
    model2 = VAR(4).fit(msft)
    ow = WidgetPreview(OWLineChart)
    ow.run(set_data=airpassengers,
           set_forecast=[(model1.predict(10, as_table=True), 0),
                         (model2.predict(10, as_table=True), 1)])