The database View class could be simplified
I don't know exactly the internals of beat but I wonder why the database view class needs to be this complicated? There may be some technical reasons behind this but I don't think this should be exposed to the users. These Views are just a container as far as I can see. So, I wonder if having something like:
class Train: """The training set""" def __init__(self, parameters=None, root_folder=None): self.parameters = parameters self.root_folder = root_folder # initialize the db interface here # e.g. load a csv file import pandas as pd self.df = pd.read_csv(...) def __len__(self): # return the total number of items in here return len(self.df) def __getitem__(self, index): # return the nth row in here row = self.df.iloc[index] # load the data here if necessary row.image = load(row.filename) return row
would not satisfy the requirements.