Пример #1
0
def get_multi_model():
    cp6 = datasets.table_111()

    E2 = [[1, 0]]

    G = tools.jordan_form(2)

    order = ['standard', 'outlier', 'level', 'growth']
    prior_model_prob = {
        'standard': 0.85,
        'outlier': 0.07,
        'level': 0.05,
        'growth': 0.03
    }

    # order = ['standard', 'outlier']
    # prior_model_prob = {'standard' : 0.90,
    #                     'outlier' : 0.10}

    models = {}

    standard = Model(G, [0.9, 0.9], obs_var_mult=1.)
    models['standard'] = standard
    models['outlier'] = Model(G, [0.9, 0.9], obs_var_mult=100.)
    models['level'] = Model(G, [0.01, 0.9], obs_var_mult=1.)
    models['growth'] = Model(G, [0.9, 0.01], obs_var_mult=1.)

    # priors
    m0 = np.array([600., 10.])
    C0 = np.diag([10000., 25.])
    n0, d0 = 10., 1440.

    multi = MultiProcessDLM(cp6,
                            E2,
                            models,
                            order,
                            prior_model_prob,
                            m0=m0,
                            C0=C0,
                            n0=n0,
                            s0=d0 / n0,
                            approx_steps=1)

    return multi
Пример #2
0
def get_multi_model():
    cp6 = datasets.table_111()

    E2 = [[1, 0]]

    G = tools.jordan_form(2)

    order = ['standard', 'outlier', 'level', 'growth']
    prior_model_prob = {'standard' : 0.85,
                        'outlier' : 0.07,
                        'level' : 0.05,
                        'growth' : 0.03}

    # order = ['standard', 'outlier']
    # prior_model_prob = {'standard' : 0.90,
    #                     'outlier' : 0.10}

    models = {}

    standard = Model(G, [0.9, 0.9], obs_var_mult=1.)
    models['standard'] = standard
    models['outlier'] = Model(G, [0.9, 0.9], obs_var_mult=100.)
    models['level'] = Model(G, [0.01, 0.9], obs_var_mult=1.)
    models['growth'] = Model(G, [0.9, 0.01], obs_var_mult=1.)

    # priors
    m0 = np.array([600., 10.])
    C0 = np.diag([10000., 25.])
    n0, d0 = 10., 1440.

    multi = MultiProcessDLM(cp6, E2, models, order,
                            prior_model_prob,
                            m0=m0, C0=C0, n0=n0, s0=d0 / n0,
                            approx_steps=1)

    return multi
Пример #3
0
    def __init__(self, order, lam=1., discount=None):
        self.order = order

        F = _e_vector(order)
        G = tools.jordan_form(order, lam)
        ConstantComponent.__init__(self, F, G, discount=discount)
Пример #4
0
    def __init__(self, order, lam=1., discount=None):
        self.order = order

        F = _e_vector(order)
        G = tools.jordan_form(order, lam)
        ConstantComponent.__init__(self, F, G, discount=discount)