def log_model(keras_model, artifact_path, conda_env=None, custom_objects=None, keras_module=None, registered_model_name=None, signature: ModelSignature=None, input_example: ModelInputExample=None, **kwargs):
    '\n    Log a Keras model as an MLflow artifact for the current run.\n\n    :param keras_model: Keras model to be saved.\n    :param artifact_path: Run-relative artifact path.\n    :param conda_env: Either a dictionary representation of a Conda environment or\n                      the path to a Conda environment yaml file.\n                      If provided, this describes the environment this model should be\n                      run in. At minimum, it should specify the dependencies\n                      contained in :func:`get_default_conda_env()`. If ``None``, the default\n                      :func:`mlflow.keras.get_default_conda_env()` environment is added to\n                      the model. The following is an *example* dictionary representation of a\n                      Conda environment::\n\n                        {\n                            \'name\': \'mlflow-env\',\n                            \'channels\': [\'defaults\'],\n                            \'dependencies\': [\n                                \'python=3.7.0\',\n                                \'keras=2.2.4\',\n                                \'tensorflow=1.8.0\'\n                            ]\n                        }\n\n    :param custom_objects: A Keras ``custom_objects`` dictionary mapping names (strings) to\n                           custom classes or functions associated with the Keras model. MLflow saves\n                           these custom layers using CloudPickle and restores them automatically\n                           when the model is loaded with :py:func:`mlflow.keras.load_model` and\n                           :py:func:`mlflow.pyfunc.load_model`.\n    :param keras_module: Keras module to be used to save / load the model\n                         (``keras`` or ``tf.keras``). If not provided, MLflow will\n                         attempt to infer the Keras module based on the given model.\n    :param registered_model_name: (Experimental) If given, create a model version under\n                                  ``registered_model_name``, also creating a registered model if one\n                                  with the given name does not exist.\n\n    :param signature: (Experimental) :py:class:`ModelSignature <mlflow.models.ModelSignature>`\n                      describes model input and output :py:class:`Schema <mlflow.types.Schema>`.\n                      The model signature can be :py:func:`inferred <mlflow.models.infer_signature>`\n                      from datasets with valid model input (e.g. the training dataset with target\n                      column omitted) and valid model output (e.g. model predictions generated on\n                      the training dataset), for example:\n\n                      .. code-block:: python\n\n                        from mlflow.models.signature import infer_signature\n                        train = df.drop_column("target_label")\n                        predictions = ... # compute model predictions\n                        signature = infer_signature(train, predictions)\n    :param input_example: (Experimental) Input example provides one or several instances of valid\n                          model input. The example can be used as a hint of what data to feed the\n                          model. The given example will be converted to a Pandas DataFrame and then\n                          serialized to json using the Pandas split-oriented format. Bytes are\n                          base64-encoded.\n\n    :param kwargs: kwargs to pass to ``keras_model.save`` method.\n\n    .. code-block:: python\n        :caption: Example\n\n        from keras import Dense, layers\n        import mlflow\n        # Build, compile, and train your model\n        keras_model = ...\n        keras_model.compile(optimizer="rmsprop", loss="mse", metrics=["accuracy"])\n        results = keras_model.fit(\n            x_train, y_train, epochs=20, batch_size = 128, validation_data=(x_val, y_val))\n        # Log metrics and log the model\n        with mlflow.start_run() as run:\n            mlflow.keras.log_model(keras_model, "models")\n    '
    Model.log(artifact_path=artifact_path, flavor=mlflow.keras, keras_model=keras_model, conda_env=conda_env, custom_objects=custom_objects, keras_module=keras_module, registered_model_name=registered_model_name, signature=signature, input_example=input_example, **kwargs)
Log a Keras model as an MLflow artifact for the current run.

:param keras_model: Keras model to be saved.
:param artifact_path: Run-relative artifact path.
:param conda_env: Either a dictionary representation of a Conda environment or
                  the path to a Conda environment yaml file.
                  If provided, this describes the environment this model should be
                  run in. At minimum, it should specify the dependencies
                  contained in :func:`get_default_conda_env()`. If ``None``, the default
                  :func:`mlflow.keras.get_default_conda_env()` environment is added to
                  the model. The following is an *example* dictionary representation of a
                  Conda environment::

                    {
                        'name': 'mlflow-env',
                        'channels': ['defaults'],
                        'dependencies': [
                            'python=3.7.0',
                            'keras=2.2.4',
                            'tensorflow=1.8.0'
                        ]
                    }

:param custom_objects: A Keras ``custom_objects`` dictionary mapping names (strings) to
                       custom classes or functions associated with the Keras model. MLflow saves
                       these custom layers using CloudPickle and restores them automatically
                       when the model is loaded with :py:func:`mlflow.keras.load_model` and
                       :py:func:`mlflow.pyfunc.load_model`.
:param keras_module: Keras module to be used to save / load the model
                     (``keras`` or ``tf.keras``). If not provided, MLflow will
                     attempt to infer the Keras module based on the given model.
:param registered_model_name: (Experimental) If given, create a model version under
                              ``registered_model_name``, also creating a registered model if one
                              with the given name does not exist.

:param signature: (Experimental) :py:class:`ModelSignature <mlflow.models.ModelSignature>`
                  describes model input and output :py:class:`Schema <mlflow.types.Schema>`.
                  The model signature can be :py:func:`inferred <mlflow.models.infer_signature>`
                  from datasets with valid model input (e.g. the training dataset with target
                  column omitted) and valid model output (e.g. model predictions generated on
                  the training dataset), for example:

                  .. code-block:: python

                    from mlflow.models.signature import infer_signature
                    train = df.drop_column("target_label")
                    predictions = ... # compute model predictions
                    signature = infer_signature(train, predictions)
:param input_example: (Experimental) Input example provides one or several instances of valid
                      model input. The example can be used as a hint of what data to feed the
                      model. The given example will be converted to a Pandas DataFrame and then
                      serialized to json using the Pandas split-oriented format. Bytes are
                      base64-encoded.

:param kwargs: kwargs to pass to ``keras_model.save`` method.

.. code-block:: python
    :caption: Example

    from keras import Dense, layers
    import mlflow
    # Build, compile, and train your model
    keras_model = ...
    keras_model.compile(optimizer="rmsprop", loss="mse", metrics=["accuracy"])
    results = keras_model.fit(
        x_train, y_train, epochs=20, batch_size = 128, validation_data=(x_val, y_val))
    # Log metrics and log the model
    with mlflow.start_run() as run:
        mlflow.keras.log_model(keras_model, "models")
def log_model(keras_model, artifact_path, conda_env=None, custom_objects=None, keras_module=None, registered_model_name=None, signature: ModelSignature=None, input_example: ModelInputExample=None, **kwargs):
    '\n    Log a Keras model as an MLflow artifact for the current run.\n\n    :param keras_model: Keras model to be saved.\n    :param artifact_path: Run-relative artifact path.\n    :param conda_env: Either a dictionary representation of a Conda environment or\n                      the path to a Conda environment yaml file.\n                      If provided, this describes the environment this model should be\n                      run in. At minimum, it should specify the dependencies\n                      contained in :func:`get_default_conda_env()`. If ``None``, the default\n                      :func:`mlflow.keras.get_default_conda_env()` environment is added to\n                      the model. The following is an *example* dictionary representation of a\n                      Conda environment::\n\n                        {\n                            \'name\': \'mlflow-env\',\n                            \'channels\': [\'defaults\'],\n                            \'dependencies\': [\n                                \'python=3.7.0\',\n                                \'keras=2.2.4\',\n                                \'tensorflow=1.8.0\'\n                            ]\n                        }\n\n    :param custom_objects: A Keras ``custom_objects`` dictionary mapping names (strings) to\n                           custom classes or functions associated with the Keras model. MLflow saves\n                           these custom layers using CloudPickle and restores them automatically\n                           when the model is loaded with :py:func:`mlflow.keras.load_model` and\n                           :py:func:`mlflow.pyfunc.load_model`.\n    :param keras_module: Keras module to be used to save / load the model\n                         (``keras`` or ``tf.keras``). If not provided, MLflow will\n                         attempt to infer the Keras module based on the given model.\n    :param registered_model_name: (Experimental) If given, create a model version under\n                                  ``registered_model_name``, also creating a registered model if one\n                                  with the given name does not exist.\n\n    :param signature: (Experimental) :py:class:`ModelSignature <mlflow.models.ModelSignature>`\n                      describes model input and output :py:class:`Schema <mlflow.types.Schema>`.\n                      The model signature can be :py:func:`inferred <mlflow.models.infer_signature>`\n                      from datasets with valid model input (e.g. the training dataset with target\n                      column omitted) and valid model output (e.g. model predictions generated on\n                      the training dataset), for example:\n\n                      .. code-block:: python\n\n                        from mlflow.models.signature import infer_signature\n                        train = df.drop_column("target_label")\n                        predictions = ... # compute model predictions\n                        signature = infer_signature(train, predictions)\n    :param input_example: (Experimental) Input example provides one or several instances of valid\n                          model input. The example can be used as a hint of what data to feed the\n                          model. The given example will be converted to a Pandas DataFrame and then\n                          serialized to json using the Pandas split-oriented format. Bytes are\n                          base64-encoded.\n\n    :param kwargs: kwargs to pass to ``keras_model.save`` method.\n\n    .. code-block:: python\n        :caption: Example\n\n        from keras import Dense, layers\n        import mlflow\n        # Build, compile, and train your model\n        keras_model = ...\n        keras_model.compile(optimizer="rmsprop", loss="mse", metrics=["accuracy"])\n        results = keras_model.fit(\n            x_train, y_train, epochs=20, batch_size = 128, validation_data=(x_val, y_val))\n        # Log metrics and log the model\n        with mlflow.start_run() as run:\n            mlflow.keras.log_model(keras_model, "models")\n    '
    Model.log(artifact_path=artifact_path, flavor=mlflow.keras, keras_model=keras_model, conda_env=conda_env, custom_objects=custom_objects, keras_module=keras_module, registered_model_name=registered_model_name, signature=signature, input_example=input_example, **kwargs)