You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my own evaluation code I used the check for '_predict_risk_score' to see, whether models return their predictions on the time scale or risk scale, but this doesn't work, when the estimator is wrapped in a pipeline.
# Insert your code here that produces the bug.fromsklearn.pipelineimportPipelinefromsksurv.linear_model.aftimportIPCRidgefromsksurv.datasetsimportload_veterans_lung_cancerfromsksurv.preprocessingimportOneHotEncoderfromsksurv.baseimportSurvivalAnalysisMixindata_x, data_y=load_veterans_lung_cancer()
data_x_prep=OneHotEncoder().fit_transform(data_x)
model_direct=IPCRidge().fit(data_x_prep, data_y)
pipe=Pipeline([('encode', OneHotEncoder()),
('model', IPCRidge())])
pipe.fit(data_x, data_y)
# Are equalprint(model_direct.predict(data_x_prep.head()))
print(pipe.predict(data_x.head()))
# Steal super method# This does not match, because ...print(SurvivalAnalysisMixin.score(model_direct, data_x_prep, data_y))
print(SurvivalAnalysisMixin.score(pipe, data_x, data_y))
# ... the property is not patched through# if this returns true, the scores are treated as being on the time scaleprint(notgetattr(model_direct, "_predict_risk_score", True))
print(notgetattr(pipe, "_predict_risk_score", True))
# The second one should also be true!
Expected Results
A Pipeline object should also have the corresponding property set, as this might break evaluation codes.
Actual Results
The property is not available. It should be possible to just add it to the __init__.py, but I am not sure, how well it works together with the @property decorator. Currently I am finishing my master thesis, but I should be able to work out a PR on the 5th of December while testing the behaviour.
Describe the bug
In my own evaluation code I used the check for '_predict_risk_score' to see, whether models return their predictions on the time scale or risk scale, but this doesn't work, when the estimator is wrapped in a pipeline.
Expected Results
A
Pipeline
object should also have the corresponding property set, as this might break evaluation codes.Actual Results
The property is not available. It should be possible to just add it to the
__init__.py
, but I am not sure, how well it works together with the@property
decorator. Currently I am finishing my master thesis, but I should be able to work out a PR on the 5th of December while testing the behaviour.Versions
(Not running the newest version cough)
The text was updated successfully, but these errors were encountered: