Beispiel #1
0
def separate_grid_model_poisson(covariates,
                                active='active',
                                regularizer_weight=None,
                                log_shift=.5,
                                log_correction='max'):
    def filter_func(x):
        return x[x[active]]

    def pred_func(x, y):
        return y * x[active]

    def ign_filter_func(x):
        return x[~x[active]]

    def ign_pred_func(x, y):
        return y * (~x[active])

    afm = prg.PoissonRegressionGridModel(covariates, regularizer_weight,
                                         log_shift, log_correction,
                                         filter_func, pred_func)
    igm = prg.PoissonRegressionGridModel(covariates, regularizer_weight,
                                         log_shift, log_correction,
                                         ign_filter_func, ign_pred_func)
    model = aig.ActiveIgnitionGridModel(afm, igm)

    return model
Beispiel #2
0
def active_only_grid_model_linear(covariates,
                                  active='active',
                                  regularizer_weight=None,
                                  log_shift=1,
                                  log_correction='add'):
    def filter_func(x):
        return x[x[active]]

    def pred_func(x, y):
        return y * x[active]

    afm = lrg.LinearRegressionGridModel(covariates, regularizer_weight,
                                        filter_func, pred_func)
    model = aig.ActiveIgnitionGridModel(afm, None)

    return model
Beispiel #3
0
def active_only_grid_model_poisson_hurdle(covariates,
                                          active='active',
                                          regularizer_weight=None,
                                          log_shift=1,
                                          log_correction='add'):
    def filter_func(x):
        return x[x[active]]

    def pred_func(x, y):
        return y * x[active]

    afm = prhg.PoissonRegressionHurdleGridModel(covariates, regularizer_weight,
                                                log_shift, log_correction,
                                                filter_func, pred_func)
    model = aig.ActiveIgnitionGridModel(afm, None)

    return model
Beispiel #4
0
def active_ig_grid_model_poisson(covariates):
    def filter_func(x):
        return x[x[x.active]]

    def pred_func(x, y):
        return y * x[x.active]

    afm = prg.PoissonRegressionGridModel(covariates, filter_func, pred_func)

    def filter_func(x):
        return x[not x.active]

    def pred_func(x, y):
        return y * (not x.active)

    ifm = prg.PoissonRegressionGridModel(covariates, filter_func, pred_func)

    model = aig.ActiveIgnitionGridModel(afm, ifm)

    return model
Beispiel #5
0
def no_ignition_grid_model_poisson(covariates):
    afm = prg.PoissonRegressionGridModel(covariates)
    model = aig.ActiveIgnitionGridModel(afm, None)

    return model
Beispiel #6
0
def only_zero_grid_model(covariates):
    model = aig.ActiveIgnitionGridModel(None, None)

    return model
Beispiel #7
0
def no_ignition_model_poisson_zip(covariates, bounding_box):
    afm = gp.GridPredictorModel(
        pzip.PoissonRegressionZeroInflatedModel(covariates), bounding_box)
    model = aig.ActiveIgnitionGridModel(afm, None)

    return model
Beispiel #8
0
def auto_grid_model(covariates):
    igm = ag.AutoregressiveGridModel()
    model = aig.ActiveIgnitionGridModel(None, igm)

    return model
Beispiel #9
0
def only_bias_grid_model(covariates):
    igm = bg.BiasGridModel()
    model = aig.ActiveIgnitionGridModel(None, igm)

    return model