Skip to content

Commit

Permalink
no traffic segs key error
Browse files Browse the repository at this point in the history
  • Loading branch information
mxndrwgrdnr committed Aug 21, 2017
1 parent 44e8f11 commit e6e2c1f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def plot_change_in_acc(oneSizeFitsAllAcc, rateSpecificAcc, sampleRates,
def grid_search_hmm_params(cityName, routeList, sampleRates, noiseLevels,
betaVals, sigmaZVals, turnPenaltyFactor=500,
saveResults=True):

noTrafficSegs = 0
for i, rteCoords in enumerate(routeList):
df = pd.DataFrame(
columns=['sample_rate', 'noise', 'beta', 'sigma_z', 'score'])
Expand All @@ -464,7 +464,11 @@ def grid_search_hmm_params(cityName, routeList, sampleRates, noiseLevels,
df.loc[outDfRow, [
'sample_rate', 'noise', 'beta', 'sigma_z']] = [
sampleRate, noise, beta, sigmaZ]
dfEdges = format_edge_df(edges)
try:
dfEdges = format_edge_df(edges)
except KeyError:
noTrafficSegs += 1
continue
dfEdges, jsonDict, geojson, gpsMatchEdges, \
gpsMatchShape = \
synthesize_gps(
Expand All @@ -485,7 +489,9 @@ def grid_search_hmm_params(cityName, routeList, sampleRates, noiseLevels,
df.to_csv('../data/{0}_route_{1}_param_scores.csv'.format(
cityName, i + 1),
index=False)

print(
'{0} route(s) skipped because they contained '
'no traffic segments'.format(noTrafficSegs))

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

0 comments on commit e6e2c1f

Please sign in to comment.