Skip to main content

Keras Tuner Cross Validation

Extension for keras tuner that adds a set of classes to implement cross validation methodologies.

Install

$ pip install keras_tuner_cv

Implemented methodologies

Here is the list of implemented methodologies and how to use them!

Outer Cross Validation

from keras_tuner_cv.outer_cv import OuterCV

from keras_tuner.tuners import RandomSearch

from sklearn.model_selection import KFold

cv = KFold(n_splits=5, random_state=12345, shuffle=True),

outer_cv = OuterCV(
    # You can use any class extendind:
    # sklearn.model_selection.cros.BaseCrossValidator
    cv,
    # You can use any class extending:
    # keras_tuner.engine.tuner.Tuner, e.g. RandomSearch
    RandomSearch,
    # Tuner parameters both positional and named ones
    ...
)

Inner Cross Validation

from keras_tuner_cv.outer_cv import OuterCV

from keras_tuner.tuners import RandomSearch

from sklearn.model_selection import KFold

cv = KFold(n_splits=5, random_state=12345, shuffle=True),
    
# You can use any class extending:
# keras_tuner.engine.tuner.Tuner, e.g. RandomSearch
outer_cv = inner_cv(RandomSearch)(
    hypermodel,
    # You can use any class extendind:
    # sklearn.model_selection.cros.BaseCrossValidator
    cv,
    # Tuner positional parameters except hypermodel
    ...,
    # Saves the history of all metrics observed across the epochs 
    # in json format.    
    save_history=False,
    # Saves the model output for both the training and validation 
    # datasets in numpy format.
    save_output=False,
    # Indicates when or not to reload the best weights w.r.t. to 
    # the objective indicated for the calculation of output and
    # scores.
    restore_best=True,
    # Tuner named parameters except hypermodel
    ...
)

License

Keras Tuner CV is released under the GPL v3.

Release files for keras-tuner-cv 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keras-tuner-cv 1.0.3
File Size Uploaded
keras_tuner_cv-1.0.3.tar.gz 7.1 kB Details

Release files / keras_tuner_cv-1.0.3.tar.gz

Download URL keras_tuner_cv-1.0.3.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fd59234e1b748764d906fd78daf86a0da6059005cf2928ed2e06358765b19885
BLAKE2b-256 checksum
How to use checksums
acac0ce5f6d656c28840b9c7ce8dcb7a2408e5638b8245e148e8a24e6e9dc5bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.3 This release

1 release file

1.0.1

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page