-1

So I have a table that stores ML model metadata. I have a table that holds my model. I need to also include hyper parameter information (epochs, batch_size, weight_decay, classes etc.). I don't want to include this in my following model table as in some cases they might be NULL and wouldn't be generic enough. For example, what happens in 2 months when we need to add another hyper parameter?

A model can have many hyper parameters. This would lead me to design the relations to be a many to many relationship.

So

The issue is that they can be different types. epochs (int), batch_size (int), weight_decay (float), classes (string).

A(model, relative_model_path), B(model_fk, hyper_parameter_fk, value) C(hyper_parameter)

So for example

A
---
modelA, /models/modelA.h5
modelB, /models/modelB.h5

B
---
modelA, epochs, 5
modelA, weight_decay, .1
modelA, classes, "my_model"
modelB, batch_size, 2
modelB, classes, "modelB_model"

C
---
epochs
weight_decay
classes
learning_rate
batch_size

So value column would be holding an int, string, and float in my example, which isn't good. I feel like I'm running into the EAV – Entity-Attribute-Value anti-pattern as well, but I'm not quite sure how to design around this.

1

One pattern you might want to look into is Class Table Inheritance. This is a design technique that enables an SQL database designer the ability to mimic the benefits you get out of inheritance in an object oriented environment.
Whether this is relevant to your case depends on whether treating certain models as specialized versions of the generic model is meaningful here or not. Specialization in ER modeling expresses something analogous to what subclasses express in an object model.
You can get more of a write up on Class Table Inheritance by looking here or searching on the web.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.