-
Notifications
You must be signed in to change notification settings - Fork 74
Base and Differentiable Transformer #608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| docs/api/* | ||
| docs/_build/* | ||
| cover/* | ||
| .coverage.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added as tests create .coverage.Mac for each process.
fkiraly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
Would this solve the fitting/reset problem?
|
I had already made some changes yesterday before your reply stating your preference to just passing the additional functions (option 2). In the BaseTransformer, I have implemented an sklearn -> skpro transformer. The main idea is that the (skpro) BaseTransformer (BaseT) can take an sklearn transformer an wrap it in one of two ways:
Why is this needed? Reset Issue |
|
This gives us the following options for using a TTR that returns a TD that can use log_loss: Pass sklearn transformer # wraps the fitted MMS in the DiffT internally
xgb = XGBoostLSS(**params)
mms = MinMaxScaler()
pipe = TransformedTargetRegressor(regressor=xgb, transformer=mms)
pipe.fit(X=Xy[["feature"]], y=Xy["target"])
td = pipe.predict_proba(Xy[["feature"]])
LogLoss()(y_true=Xy["target"], y_pred=pp)Pass skpro DiffT # this calls fit on the DiffT and subsequent MMS
xgb = XGBoostLSS(**params)
mms = DifferentiableTransformer(transformer=MinMaxScaler())
pipe = TransformedTargetRegressor(regressor=xgb, transformer=mms)
pipe.fit(X=Xy[["feature"]], y=Xy["target"])
td = pipe.predict_proba(Xy[["feature"]])
LogLoss()(y_true=Xy["target"], y_pred=pp)The transformer that is not used in the TD This also means we can still pass an mms = MinMaxScaler()
mms.fit(Xy[["target"]])
trafo = TransformedDistribution(
distribution=Normal(),
transform=mms.transform,
assume_monotonic=True,
index=Xy.index,
columns=['target'],
)
trafo.log_pdf(Xy[["target"]]) |
Just to clarify, I think it would be good if TD had:
What makes sense is to separate differentiation logic that is at least one of:
|
Done in #612
Solution in #612 makes it very easy to add this. Closing this in favour of #612 |
Reference Issues/PRs
#605 and #601
What does this implement/fix? Explain your changes.
Implements the Differentiable Transformer as discussed in #605.
Does your contribution introduce a new dependency? If yes, which one?
No
What should a reviewer concentrate their feedback on?
See #605 for details.
Did you add any tests for the change?
Not yet. Tests to follow
Any other comments?
PR checklist
For all contributions
How to: add yourself to the all-contributors file in the
skproroot directory (not theCONTRIBUTORS.md). Common badges:code- fixing a bug, or adding code logic.doc- writing or improving documentation or docstrings.bug- reporting or diagnosing a bug (get this pluscodeif you also fixed the bug in the PR).maintenance- CI, test framework, release.See here for full badge reference
For new estimators
docs/source/api_reference/taskname.rst, follow the pattern.Examplessection.python_dependenciestag and ensureddependency isolation, see the estimator dependencies guide.