adapt icon indicating copy to clipboard operation
adapt copied to clipboard

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

Open davidshumway opened this issue 3 years ago • 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).

davidshumway avatar Aug 29 '22 20:08 davidshumway

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)

antoinedemathelin avatar Aug 31 '22 10:08 antoinedemathelin