raamana / pyradigm

Research data management in biomedical and machine learning applications
http://raamana.github.io/pyradigm/
MIT License
28 stars 12 forks source link

Easier Method to Add, Update or Delete Features #20

Open atheyers opened 5 years ago

atheyers commented 5 years ago

It would be nice to be able to loop through the list of subject IDs and make updates to the array of features stored under there, instead of having to create a new datastructure for small changes.

raamana commented 5 years ago

thanks! Looping wouldn't work, as we need to ensure all the samples have same dimensionality, but updating all samples at once can work.

For example, for an MLDataset of tow samples id1 and id2, it can be something like this:

ds.add_feature(name='first', dict(id1=1, id2=0))
ds.add_feature(name='second', dict(id1=2, id2=3))
ds.del_feature(name='first')
ds.update_feature(name='second', dict(id1=5, id2=9))