def plot_instances_for_gps_error_model():
    smoothing_ground_truth_map = json.load(open("/Users/shankari/cluster_ground_truth/smoothing/caltrain/smoothing_removed_points"))
    needsSmoothing = []
    fineWithoutSmoothing = []

    for (sid, rp_list) in smoothing_ground_truth_map.items():
        sectionJSON = get_section_db().find_one({"_id": sid})
        if sectionJSON is None:
            print("Unable to find section %s in the database" % sid)
        else:
            if len(rp_list) > 0:
                needsSmoothing.append(sectionJSON)
            else:
                fineWithoutSmoothing.append(sectionJSON)

    print("-" * 20, "Needs smoothing", '-' * 20)

    for section in needsSmoothing:
        if section is not None:
            print(section["_id"], fc.calAvgSpeed(section), fc.getIthMaxSpeed(section, 1), np.percentile(fc.calSpeeds(section), [90, 95, 99]))

    print("-" * 20, "Fine without smoothing", '-' * 20)

    for section in fineWithoutSmoothing:
        if section is not None:
            print(section["_id"], fc.calAvgSpeed(section), fc.getIthMaxSpeed(section, 1), np.percentile(fc.calSpeeds(section), [90, 95, 99]))

    other_manual_candidates = find_other_sections_manual(needsSmoothing, fineWithoutSmoothing)
    other_auto_candidates = find_other_sections_auto(needsSmoothing, fineWithoutSmoothing)

    print(other_auto_candidates)

    gsfgtc.generate_cluster_comparison(other_manual_candidates, "/tmp/other_manual")
    gsfgtc.generate_cluster_comparison(other_auto_candidates, "/tmp/other_auto")
Beispiel #2
0
def plot_instances_for_gps_error_model():
    smoothing_ground_truth_map = json.load(
        open(
            "/Users/shankari/cluster_ground_truth/smoothing/caltrain/smoothing_removed_points"
        ))
    needsSmoothing = []
    fineWithoutSmoothing = []

    for (sid, rp_list) in smoothing_ground_truth_map.items():
        sectionJSON = get_section_db().find_one({"_id": sid})
        if sectionJSON is None:
            print("Unable to find section %s in the database" % sid)
        else:
            if len(rp_list) > 0:
                needsSmoothing.append(sectionJSON)
            else:
                fineWithoutSmoothing.append(sectionJSON)

    print("-" * 20, "Needs smoothing", '-' * 20)

    for section in needsSmoothing:
        if section is not None:
            print(section["_id"], fc.calAvgSpeed(section),
                  fc.getIthMaxSpeed(section, 1),
                  np.percentile(fc.calSpeeds(section), [90, 95, 99]))

    print("-" * 20, "Fine without smoothing", '-' * 20)

    for section in fineWithoutSmoothing:
        if section is not None:
            print(section["_id"], fc.calAvgSpeed(section),
                  fc.getIthMaxSpeed(section, 1),
                  np.percentile(fc.calSpeeds(section), [90, 95, 99]))

    other_manual_candidates = find_other_sections_manual(
        needsSmoothing, fineWithoutSmoothing)
    other_auto_candidates = find_other_sections_auto(needsSmoothing,
                                                     fineWithoutSmoothing)

    print(other_auto_candidates)

    gsfgtc.generate_cluster_comparison(other_manual_candidates,
                                       "/tmp/other_manual")
    gsfgtc.generate_cluster_comparison(other_auto_candidates,
                                       "/tmp/other_auto")
def get_feature_row(section):
    ret_arr = np.zeros((5))
    ret_arr[0] = fc.calAvgSpeed(section)
    ret_arr[1] = fc.getIthMaxSpeed(section, 1)
    percentiles = np.percentile(fc.calSpeeds(section), [90, 95, 99])
    ret_arr[2] = percentiles[0]
    ret_arr[3] = percentiles[1]
    ret_arr[4] = percentiles[2]
    return ret_arr
Beispiel #4
0
def get_feature_row(section):
    ret_arr = np.zeros((5))
    ret_arr[0] = fc.calAvgSpeed(section)
    ret_arr[1] = fc.getIthMaxSpeed(section, 1)
    percentiles = np.percentile(fc.calSpeeds(section), [90, 95, 99])
    ret_arr[2] = percentiles[0]
    ret_arr[3] = percentiles[1]
    ret_arr[4] = percentiles[2]
    return ret_arr