-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add wrapper to transform targets of (semi)supervised models #678
Conversation
@CameronBieganek Would be great if you could comment on the doc-string. If you also have time for a more detailed review over the next two weeks, let me know. |
Codecov Report
@@ Coverage Diff @@
## for-0-point-19-release #678 +/- ##
==========================================================
- Coverage 85.84% 83.48% -2.36%
==========================================================
Files 40 41 +1
Lines 3610 3173 -437
==========================================================
- Hits 3099 2649 -450
- Misses 511 524 +13
Continue to review full report at Codecov.
|
more test coverage
This PR adds a model wrapper
TransformedTargetModel
implementing this suggestion of @CameronBieganek. Together with thePipeline
model already implemented (on the target branch) this wrapper renders the@pipeline
macro redundant and whence resolves this Pluto notebook issue.The doc-string for the new model appears below.
This PR is not breaking but I am basing it on the 0.19 release branch as it was convenient to use some utilities introduced there for the new pipelines.
To do:
@pipeline
Wrap the supervised or semi-supervised
model
in a transformation ofthe target variable.
Here
target
is either:Unsupervised
model that is to transform the training target.By default (
inverse=nothing
) the parameters learned by thistransformer are also used to inverse-transform the predictions of
model
, which meanstarget
must implement theinverse_transform
method. If this is not the case, specify
inverse=identity
tosuppress inversion.
or
y -> log.(y)
. In this casea callable
inverse
, such asz -> exp.(z)
, should be specified.Specify
cache=false
to prioritize memory over speed, or to guarantee dataanonymity.
Specify
inverse=identity
ifmodel
is a probabilistic predictor, asinverse-transforming sample spaces is not supported. Alternatively,
replace
model
with a deterministic model, such asPipeline(model, y -> mode.(y))
.Examples
A model that normalizes the target before applying ridge regression,
with predictions returned on the original scale:
A model that instead applies a static
log
transformation to the data, againreturning predictions to the original scale: