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.3.tar.gz (7.1 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: keras_tuner_cv-1.0.3.tar.gz
  • Upload date:
  • Size: 7.1 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.3.tar.gz
Algorithm Hash digest
SHA256 fd59234e1b748764d906fd78daf86a0da6059005cf2928ed2e06358765b19885
MD5 011718eb53b33df565ca7c71e02768f0
BLAKE2b-256 acac0ce5f6d656c28840b9c7ce8dcb7a2408e5638b8245e148e8a24e6e9dc5bd

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