ivoflipse / Pawlabeling

Tool for processing and analyzing pressure measurements
Other
18 stars 1 forks source link

The model unnecessarily calculates results #75

Closed ivoflipse closed 11 years ago

ivoflipse commented 11 years ago

Previously I didn't store all the results, so I had to calculate them if I wanted the maximum results for example.

Now I can just dump them into PyTables, so be lazy and don't do any work you don't have to.

Even better: store the results that are aggregated over all contacts under the measurement and all results that are aggregated over all measurements under the session.

ivoflipse commented 11 years ago

Contactswidget is probably an offender too. It calculates results on the average_data, which should be done once, then stored in Pytables

ivoflipse commented 11 years ago

I've moved the functions that calculate average results to the session_model, I think it would be a good idea to have one function there manage everything, do the calculation and make sure they get saved.

Then instead of calculating, you simply ask the session_model for whatever results you want.

All I need to do now is come up with a way to update these results while we're still labeling contacts...

ivoflipse commented 11 years ago

I first recalculated the average when updating the current contact, which is rather wasteful. I probably could come up with a more 'online' way of doing it, which only requires some computation on the existing average contact and the new contact it will be updated with.

If for some reason, the user makes a mistake, we could either 'undo' the calculation, by 'subtracting' the contact from the mean or simply recompute the contacts involved (the one with the old and the new contact_label).

Furthermore, because the analysis_widget has no influence over updating the average, it should probably be called once when switching tabs to make sure we have the right data in memory.

ivoflipse commented 11 years ago

contacts_widget's predict_label also does some computations on the data, which should probably be moved to the model. It also rather wastefully calculates the RMSE with each contact that has been labeled, where it could be using the average contact instead.

ivoflipse commented 11 years ago

I'm still not happy with predict_label, but once I add image registration, I'll have to fix this part anyway