I have several algorithms that I would like to test against the same data sets to compare their results. I don't know how to design it so there is maximum readability and maximum efficiency.
I have considered creating a class for each algorithm, and giving it a copy of the data to work with, but it doesn't seem that that is the right answer:
- Each data set is fairly large (10,000 float numpy array), so I don't want to copy each one ~30 times.
- Many of the algorithms have similar pre-processing routines (thus repeating them for each algorithm seems wasteful)
- Some algorithms have nearly identical code, except a few parameters which are different.
At the same time, having one function call per algorithm also seems wrong: as per (2), many will call the same preprocessing functions, and then it becomes very difficult to tell who is calling who.
I want to be able to allow the user (which will be me) to easily call a variety of algorithms on the data, while keeping the code as clear as possible.
I just keep thinking I need the inverse of a class; where each objects of a class will have the same methods but different data, I need something where each member will have the same data but different methods.