question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transformed target regressor support?

See original GitHub issue

When I build a pipeline where I use a scikeras KerasRegressor, but put it inside of a scikitlearn transformedtargetregressor, I can no longer access the training history.

I can still access the KerasRegressor object, and when I do I get the following:

In [38]: pipeline['NN_model'].regressor
Out[38]: 
KerasRegressor(
	model=<function build_regressor_model at 0x000001DE15A4D5E0>
	build_fn=None
	warm_start=False
	random_state=None
	optimizer=<tensorflow.python.keras.optimizer_v2.adam.Adam object at 0x000001DE760DAF40>
	loss=mse
	metrics=None
	batch_size=None
	validation_batch_size=None
	verbose=1
	callbacks=None
	validation_split=0.2
	shuffle=True
	run_eagerly=False
	epochs=100
	parameters={'num_nodes': (250, 150, 100), 'num_dense_layers': 3, 'dropout': 0.01, 'dropout_type': 'none', 'activation': 'elu', 'output_activation': 'linear', 'learning_rate': 0.0001, 'input_dim': 258, 'output_dim': 140, 'loss': 'mse', 'epochs': 100}
)

but when I try to get the history object, I get the following

In [39]: pipeline['NN_model'].regressor.history
Traceback (most recent call last):

  File "<ipython-input-40-eb7647671dbe>", line 1, in <module>
    pipeline['NN_model'].regressor.history

AttributeError: 'KerasRegressor' object has no attribute 'history'

Am I doing something wrong, or is some of the functionality of scikeras not supported when using a Transformed target regressor?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

0reactions
adriangbcommented, Jun 24, 2021

Glad we could help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

sklearn.compose.TransformedTargetRegressor
Meta-estimator to regress on a transformed target. Useful for applying a non-linear transformation to the target y in regression problems. This transformation ......
Read more >
How to Transform Target Variables for Regression in Python
In this tutorial, you will discover how to use the TransformedTargetRegressor to scale and transform target variables for regression using ...
Read more >
Effect of transforming the targets in regression model
TransformedTargetRegressor . Two examples illustrate the benefit of transforming the targets before learning a linear regression model.
Read more >
Target Transformed Regression for Accurate Tracking - arXiv
This target contextualized representation is able to enhance the target relevant information to help precisely locate the box boundaries, and ...
Read more >
SHAP library does not support TransformedTargetRegressor ...
We are working with a regression problem, where we want to apply log transform to target variable. After model training, we want to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found