Skip to content

Commit

Permalink
chg: Compatibility with new db
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiebrynes7 committed Feb 24, 2017
1 parent c2b2824 commit feb5594
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
15 changes: 4 additions & 11 deletions client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,13 @@ def main():
algo = Wpd(fp, pre, filter, scoring, detection, post)
getAlgoResults(algo, config)

# Return data
# Calculate final statistics
config['stats']['overall_error'] = 1 - abs(config['stats']['steps'] - config['stats']['ground_truth'] / config['stats']['ground_truth'])

# Calculate algorithm score
# Calculate algorithm accuracy
score = 0
n = 0
for key in list(config['results'].keys()):
score += config['results'][key]['score']
score += config['results'][key]['accuracy']
n += 1
config['stats']['score'] = score / n
config['stats']['accuracy'] = score / n

res = requests.post(return_url, headers=headers, data=json.dumps(config))

Expand Down Expand Up @@ -85,10 +81,7 @@ def getAlgoResults(algorithm, config):
# Add entry to results.
config['results'][algorithm.filelocation] = dict()
# Accuracy
config['results'][algorithm.filelocation]['error'] = 1 - abs(result[0] - result[1] / result[1])

# Calculate rating.
config['results'][algorithm.filelocation]['score'] = 1 - config['results'][algorithm.filelocation]['error']
config['results'][algorithm.filelocation]['accuracy'] = 1 - abs(result[0] - result[1]) / result[1]

if __name__ == "__main__":
main()
13 changes: 7 additions & 6 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@
"ts_factor": 1000000
},
"filter": {
"window_size": 43,
"type": "kaiser_bessel",
"window_size": 51,
"type": "gaussian",
"std": 0.3,
"cutoff_freq": 3,
"sample_freq": 100
},
"scoring": {
"window_size": 5,
"type": "max_diff"
"window_size": 11,
"type": "mean_diff"
},
"detection": {
"threshold": 1.2
},
"post": {
"time_threshold": 250
"time_threshold": 200
}
}
},
"file_path": "../data/Jamie_Hard_InHand_1/"
"file_path": "../data/Samsung_Carmelo_Hard_FrontPocket_1/"
}
2 changes: 1 addition & 1 deletion src/algorithms/peakDetection/peakFuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def __init__(self, params, smoothData, smoothDataList, peakScores):
self.target = self.meanDiff
elif self.typ == 'pan_tompkins':
self.target = self.panTompkins
elif self.typ == 'pass':
elif self.typ == 'pass_through':
self.target = self.passThrough
else:
raise Exception('Unknown peak scorer type: ' + self.typ)
Expand Down
3 changes: 2 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def main():
print("Algorithm complete. Running comparison.")
result = algo.compare()
print(result)
ui = UI(algo)
print(1 - abs((result[1] - result[0]) / result[1]))
#ui = UI(algo)


# Entry point
Expand Down

0 comments on commit feb5594

Please sign in to comment.