Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between calculating the features using efel versus when using fitcalc.calculate_scores #303

Closed
orena1 opened this issue Apr 8, 2020 · 4 comments
Assignees

Comments

@orena1
Copy link

orena1 commented Apr 8, 2020

Hi I am comparing the results of the efel vs fitcalc.calculate_scores and it seems that there is a difference.

scores = fitcalc.calculate_scores(best_responses)


import efel
import pandas as pd
trace1 = {'T': best_responses['IDRest_7.soma.v'].response['time'], 'V':best_responses['IDRest_7.soma.v'].response['voltage']}
trace1['stim_start'] = [700]
trace1['stim_end'] = [2700]
traces_results = efel.getFeatureValues([trace1],
                                ['AP_height','AP_amplitude','Spikecount','AHP_depth_abs'])


traces_results


print('IDRest_7_AHP_depth_abs')
print('manual calculation - ' + str((-69.4687143541 - traces_results[0]['AHP_depth_abs'].mean())/0.539758874442))
print('bluepyopt calculation - ' + str(scores['IDRest_7.soma.AHP_depth_abs']))

IIDRest_7_AHP_depth_abs
manual calculation : 29.24285168089122
bluepyopt calculation : 36.269754996091436

See full example in the attached zip -Show_Bug.zip - file, open Show_error.ipynb for full details,
Thanks.

Might be related to BlueBrain/eFEL#166

@wvangeit
Copy link
Contributor

wvangeit commented Apr 9, 2020

@DrTaDa , could you have a look?

@wvangeit
Copy link
Contributor

wvangeit commented Apr 9, 2020

(I'd try to manually see what efel.getDistance() returns for this trace / values)

@DrTaDa DrTaDa self-assigned this Apr 9, 2020
@DrTaDa
Copy link
Contributor

DrTaDa commented Apr 9, 2020

Hello @orena1,
The discrepancy you see does not come from BluePyOpt but from the way the score is computed in eFel.

As you can see from https://github.com/BlueBrain/eFEL/blob/master/efel/api.py, line 230, scores are computed as:

for feature_value in feature_values:
    distance += abs(feature_value - meann)
distance = distance / stdd / len(feature_values)

In your by hand computation, you do:
abs(-69.4687143541 - score1[0]['AHP_depth_abs'].mean())/0.539758874442
To compare with eFel, it should be:
abs(-69.4687143541 - score1[0]['AHP_depth_abs']).mean()/0.539758874442

@orena1
Copy link
Author

orena1 commented Apr 15, 2020

Got it, thanks!

@DrTaDa DrTaDa closed this as completed Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants