adapt-python/adapt

Adding (Xt, yt) data during model creation versus model.fit()

davidshumway opened this issue · 1 comments

What is the difference between adding (Xt, yt) data during model creation (model = FA(LinearRegression(), Xt=..., yt=...)) versus model.fit(Xs=..., ys=..., Xt=..., yt=...)? One observation is that during model creation, if Xt=None and yt=None, then it seems model.fit(...) will fail unless values for Xt and yt are provided (i.e. not None).

Hi @davidshumway,
Yes, it's a good observation, in fact it's almost the unique difference...

Setting Xt, yt at initialization is usefull when you want to use cross-validation objects from scikit-learn on an adapt algorithm.

Giving Xt, yt in the fit instead of initialization is usefull for memory reason, if your target dataset is huge and you don't want to save it with your adapt model, you give Xt, yt only in the fit method. Indeed, when setting at initialization, two attributes self.Xt and self.yt are created and are saved with the adapt model.

Note that you should give Xt, yt (or only Xt, depending of the adapt model you use) in at least one of the two: at initialization or in the fit. But you don't need to give it in both (in fact, the Xt, yt given in fit will overwrite the one given at initialization)