Skip to main content

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

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keras_tuner_cv-1.0.1.tar.gz (6.9 kB view details)

Uploaded Source

File details

Details for the file keras_tuner_cv-1.0.1.tar.gz.

File metadata

  • Download URL: keras_tuner_cv-1.0.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.6

File hashes

Hashes for keras_tuner_cv-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fd38ea2b1dec2994b7bee798978bb3dee3fab32251b9a51b057fb70515b8c21c
MD5 2c59e2d1941f47352473c8494f5c17c1
BLAKE2b-256 f625a8440ff8bf6bc3b6ab0faef0d364e8129705bec6c74912d90ff05d5792f0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page