Skip to content

Error while running bias_variance_decomp for Tensorflow-Keras Functional API #759

@jackaraz

Description

@jackaraz

Hi All

Hope you are doing fine in these strange times. I got a problem with bias_variance_decomp while using it for tf.keras.models.Model. The problem was coming from /mlxtend/evaluate/bias_variance_decomp.py L110. First of all, for some reason my model can't pass if estimator.__class__.__name__ in ['Sequential', 'Functional'] so it goes through else at L108 where code takes pred = estimator.fit(...).predict(...) but estimator.fit is just history object apparently and it doesn't have predict functionality, so I patched it as follows

        else:
            estimator.fit(X_boot, y_boot, **fit_params)#.predict(X_test)
            pred = estimator.predict(X_test).reshape(1, -1)

but wanted to run by you to see if it might create any problem in the future or if I'm missing anything.

Python version 3.6
Tensorflow v2.1 (Keras within)

Thanks
Cheers
Jack

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions