invenia / Models.jl

An interface package that defines the methods and types for working with models.
MIT License
3 stars 0 forks source link

Why do we have the weights argument can we remove it? #20

Open willtebbutt opened 4 years ago

willtebbutt commented 4 years ago

It's unclear to me what situations necessitate having a weights argument for fit. Is there some situation in which they cannot be baked into the Template and really have to be external?

Certainly, it's not the case that having weights always makes sense, so it would be great to remove it from the API if possible.

nickrobinson251 commented 4 years ago

fyi @oxinabox who's thought about this previously, i think.

oxinabox commented 4 years ago

We can not incorperate it into the template as it depends on the data. In particular it is the weights of each observation in the data, so needs to be the same length. How much data you have is not known until you call fit. Further the weight might be determined nontrivially, for example if we were doing classification and had unbalanced classes observation we might want to increase the weight on things in the rarer class.

wytbella commented 4 years ago

I'm actually not sure having weights or weights_generaltion_function in the model_template can achieve everything we've done easily.

(1) if weights vector is in the model_template, how do you know the length of it before knowing the length of inputs (#observations)

(2) if weight_generation_function is in the model_template, it's probably fine if the function doesn't have complicated inputs. The easiest situation is that the inputs to weight_generation_function is the same as inputs to model. The more complicated situation is weight_generation_function require other features, or even data at test time. (although you might be able to come across all of them by having more complicated inputs to fit)