Skip to content

Commit

Permalink
no gps edge error in grid search
Browse files Browse the repository at this point in the history
  • Loading branch information
mxndrwgrdnr committed Aug 21, 2017
1 parent abd5369 commit e54c382
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ def grid_search_hmm_params(cityName, routeList, sampleRates, noiseLevels,
betaVals, sigmaZVals, turnPenaltyFactor=500,
saveResults=True):
noTrafficSegs = 0
noGpsEdges = 0
for i, rteCoords in enumerate(routeList):
df = pd.DataFrame(
columns=['sample_rate', 'noise', 'beta', 'sigma_z', 'score'])
Expand Down Expand Up @@ -470,12 +471,17 @@ def grid_search_hmm_params(cityName, routeList, sampleRates, noiseLevels,
except KeyError:
noTrafficSegs += 1
continue
dfEdges, jsonDict, geojson, gpsMatchEdges, \
gpsMatchShape = \
synthesize_gps(
dfEdges, shapeCoords, '2768', noise=noise,
sampleRate=sampleRate, turnPenaltyFactor=tpf,
beta=beta, sigmaZ=sigmaZ)
try:
dfEdges, jsonDict, geojson, gpsMatchEdges, \
gpsMatchShape = \
synthesize_gps(
dfEdges, shapeCoords, '2768', noise=noise,
sampleRate=sampleRate,
turnPenaltyFactor=tpf,
beta=beta, sigmaZ=sigmaZ)
except KeyError:
noGpsEdges += 1
continue
segments, reportUrl = get_reporter_segments(jsonDict)
segScore, distScore, undermatchScore, \
undermatchLenScore, overmatchScore, \
Expand All @@ -491,8 +497,12 @@ def grid_search_hmm_params(cityName, routeList, sampleRates, noiseLevels,
cityName, i + 1),
index=False)
print(
'{0} route(s) skipped because they contained '
'no traffic segments'.format(noTrafficSegs))
'{0} route(s) skipped because they contained '
'no traffic segments'.format(noTrafficSegs))
print(
'{0} route(s) skipped because the synthetic GPS '
'returned no Valhalla edges'.format(noGpsEdges))


def get_param_scores(paramDf, sampleRates, noiseLevels, betaVals, sigmaZVals,
plot=True, saveFig=True):
Expand Down

0 comments on commit e54c382

Please sign in to comment.