Ejemplo n.º 1
0
def mserror(ts_id, win, **kwargs):
    ts = dat.get_series(ts_id)[:, 0]
    tsdf = pd.Series(ts)
    bn = analysis.get_best_net(ts_id)
    mse = lambda win: np.mean(win - bn.predict(
        np.array(win, dtype='float32')[:, None, None]))**2
    if win == 0:  #no window. just return all errors at once
        pr = (bn.predict(ts[:, None, None])[:, 0, 0] - ts)**2
        return pr
    return \
        rolling_apply(tsdf,
        win
                      ,mse
                      ,center=True
        )
Ejemplo n.º 2
0
def env(ts_id, **kwargs):
    """use dbts_id='test' kwargs to test things"""

    global gts_id
    gts_id = kwargs.setdefault('dbts_id', ts_id)

    global trn
    global vld
    global dim_out
    global dim_in
    global noise

    ts = dat.get(ts_id)
    tl = int(.75 * len(ts))  #potential <-param here
    trn = dat.list_call(ts[:tl])
    vld = dat.list_call(ts[tl:])
    dim_out = dim_in = dat.dim(ts_id)

    noise = np.std(dat.get_series(ts_id)) * .75  #<- critical param
Ejemplo n.º 3
0
 def data(self):
     er=[analysis.errs(self.name,awin) for awin in self.wins ]
     tsd=dat.get_series(self.name)
     return tsd,er