Closed lmossina closed 11 months ago
Here is the point of having two arguments:
The argument train
of deel.puncc.regression.SplitCP
specifies if the user wants the model to be trained when calling fit
on the CP wrapper. For many wrappers in regression module, train
is set to True
by default.
The is_trained
argument in the predictor serves as an indicator of whether the predictor has been trained or not. This state variable helps identify potential inconsistencies in the usage of wrappers, such as attempting to utilize an underlying model that is untrained and will not be trained within the wrapper.
In principle, you can retrain a model that is already pretrained, which aligns with the way you wrote the code. However, the training dataset has not been supplied (only calibration data). Puncc failed to catch this inconsistency.
I'll fix this bug by adding a consistency check between the two arguments in that case.
Could you please replicate your test using the most recent version 4c7c568?
This bug is fixed. I'm closing the issue.
I am training my predictor (
LinearRegression()
) with my own data, and then I want to create a conformal predictor withSplitCP
that takes my pre-trained model and does conformalization.Here is my problem:
So my
mod
has been trained correctly. I give two different cases:Case 1
Now, I expect
SplitCP
to have "learned" that mymod
is ready for prediction (via manually settingis_trained=True
). However, the predicted values returned bycp.predict
are unexpected, whilecp.predictor.predict(..)
behaves as expected (returns predictions ofmod
).Good:
Bad:
Remark: during a previous run, the code celle above was returning small values around
0.0
, so maybe it is returning something that is not initialized properly.Case 2
On the other hand, this seems to work correctly:
Problem:
is_trained
inBasePredictor
ortrain
inSplitCP
is redundant, or the latter ignore the first.cp.predict
returns dummy values when the call to the underlying sklearn fitted model viacp.predict.predict(...)
still works as expected