def run_planar_validation_compare_by_grid_network_intersection(
        data, net, topt, dopt, debug=False):
    if debug:
        # set logger to verbose output
        sh = logging.StreamHandler()
        validation.roc.logger.handlers = [sh]
        validation.roc.logger.setLevel(logging.DEBUG)
        validation.roc.logger.debug("Initiated debugging logger for ROC")
    poly = load_boundary_file()
    sk_planar = hotspot.STLinearSpaceExponentialTime(radius=dopt,
                                                     mean_time=topt)
    vb = validation.ValidationIntegrationByNetworkSegment(
        data,
        sk_planar,
        spatial_domain=poly,
        graph=net,
        include_predictions=True)
    vb.set_t_cutoff(START_DAY_NUMBER)
    vb.set_sample_units(GRID_LENGTH, N_SAMPLES_PER_GRID)

    tic = time()
    vb_res = vb.run(1, n_iter=NUM_VALIDATION)
    toc = time()
    print toc - tic
    return vb_res
def run_planar_validation_compare_by_grid(data, topt, dopt):
    poly = load_boundary_file()
    sk_planar = hotspot.STLinearSpaceExponentialTime(radius=dopt,
                                                     mean_time=topt)
    vb_planar = validation.ValidationIntegration(data,
                                                 sk_planar,
                                                 spatial_domain=poly,
                                                 include_predictions=True)
    vb_planar.set_t_cutoff(START_DAY_NUMBER)
    vb_planar.set_sample_units(GRID_LENGTH, N_SAMPLES_PER_GRID)

    tic = time()
    vb_res = vb_planar.run(1, n_iter=NUM_VALIDATION)
    toc = time()
    print toc - tic
    return vb_res
示例#3
0
        vb.set_t_cutoff(INITAL_CUTOFF)
        vb.set_sample_units(
            None,
            n_samples)  # 2nd argument refers to interval between sample points

        import time
        tic = time.time()
        vb_res = vb.run(1, n_iter=n_test)
        toc = time.time()
        print toc - tic

        # compare with grid-based method with same parameters
        cb_poly = camden_boundary()
        data_txy = all_data.time.adddim(all_data.space.to_cartesian(),
                                        type=models.CartesianSpaceTimeData)
        sk_planar = hotspot.STLinearSpaceExponentialTime(radius=h,
                                                         mean_time=t_decay)
        vb_planar = validation.ValidationIntegration(data_txy,
                                                     sk_planar,
                                                     spatial_domain=cb_poly,
                                                     include_predictions=True)
        vb_planar.set_t_cutoff(INITAL_CUTOFF)
        vb_planar.set_sample_units(grid_length, n_samples)

        tic = time.time()
        vb_res_planar = vb_planar.run(1, n_iter=n_test)
        toc = time.time()
        print toc - tic

        # compare with grid-based method using intersecting network segments to measure sample unit size
        vb_planar_segment = validation.ValidationIntegrationByNetworkSegment(
            data_txy, sk_planar, spatial_domain=cb_poly, graph=itn_net)
                                          include_predictions=True)
    vb.set_t_cutoff(211)
    vb.set_sample_units(
        None, 20)  # 2nd argument refers to interval between sample points

    import time
    tic = time.time()
    vb_res = vb.run(1, n_iter=100)
    toc = time.time()
    print toc - tic

    # compare with grid-based method with same parameters
    cb_poly = camden_boundary()
    data_txy = all_data.time.adddim(all_data.space.to_cartesian(),
                                    type=models.CartesianSpaceTimeData)
    sk_planar = hotspot.STLinearSpaceExponentialTime(radius=400, mean_time=30.)
    vb_planar = validation.ValidationIntegration(data_txy,
                                                 sk_planar,
                                                 spatial_domain=cb_poly,
                                                 include_predictions=True)
    vb_planar.set_t_cutoff(211)
    vb_planar.set_sample_units(250, 10)

    tic = time.time()
    vb_res_planar = vb_planar.run(1, n_iter=100)
    toc = time.time()
    print toc - tic

    # compare with grid-based method using intersecting network segments to measure sample unit size
    vb_planar_segment = validation.ValidationIntegrationByNetworkSegment(
        data_txy, sk_planar, spatial_domain=cb_poly, graph=itn_net)