class_docstr: Takes in a callable function to instantiate a Keras Model (using Keras functional API)
  that is compatible with :py:class:`CleanLearning <cleanlab.classification.CleanLearning>` and sklearn.
  
  The instance methods of this class work in the same way as those of any ``keras.Model`` object, see the `Keras documentation <https://keras.io/>`_ for details.
  For using Keras sequential instead of functional API, see the :py:class:`KerasWrapperSequential<cleanlab.experimental.keras.KerasWrapperSequential>` class.
  
  Parameters
  ----------
  model: Callable
      A callable function to construct the Keras Model (using functional API). Pass in the function here, not the constructed model!
  
      For example::
  
          def model(num_features, num_classes):
              inputs = tf.keras.Input(shape=(num_features,))
              outputs = tf.keras.layers.Dense(num_classes)(inputs)
              return tf.keras.Model(inputs=inputs, outputs=outputs, name="my_keras_model")
  
  model_kwargs: dict, default = {}
      Dict of optional keyword arguments to pass into ``model()`` when instantiating the ``keras.Model``.
  
  compile_kwargs: dict, default = {"loss": tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)}
      Dict of optional keyword arguments to pass into ``model.compile()`` for declaring loss, metrics, optimizer, etc.
class_docstr_tok: ["Takes","in","a","callable","function","to","instantiate","a","Keras","Model","(","using","Keras","functional","API",")","that","is","compatible","with",":","py",":","class",":","`","CleanLearning","<","cleanlab.classification.CleanLearning",">","`","and","sklearn",".","The","instance","methods","of","this","class","work","in","the","same","way","as","those","of","any","``","keras.Model","``","object",",","see","the","`","Keras","documentation","<","https",":","\/\/keras.io\/",">","`","_","for","details",".","For","using","Keras","sequential","instead","of","functional","API",",","see","the",":","py",":","class",":","`","KerasWrapperSequential","<","cleanlab.experimental.keras.KerasWrapperSequential",">","`","class",".","Parameters","--","--","--","--","--","model",":","Callable","A","callable","function","to","construct","the","Keras","Model","(","using","functional","API",")",".","Pass","in","the","function","here",",","not","the","constructed","model","!","For","example",":",":","def","model","(","num_features",",","num_classes",")",":","inputs","=","tf.keras.Input","(","shape=","(","num_features",",",")",")","outputs","=","tf.keras.layers.Dense","(","num_classes",")","(","inputs",")","return","tf.keras.Model","(","inputs=inputs",",","outputs=outputs",",","name=","''","my_keras_model","''",")","model_kwargs",":","dict",",","default","=","{","}","Dict","of","optional","keyword","arguments","to","pass","into","``","model","(",")","``","when","instantiating","the","``","keras.Model","``",".","compile_kwargs",":","dict",",","default","=","{","``","loss","''",":","tf.keras.losses.SparseCategoricalCrossentropy","(","from_logits=True",")","}","Dict","of","optional","keyword","arguments","to","pass","into","``","model.compile","(",")","``","for","declaring","loss",",","metrics",",","optimizer",",","etc","."]
code: def __init__(
      self,
      model: Callable,
      model_kwargs: dict = {},
      compile_kwargs: dict = {
          "loss": tf.keras.losses.SparseCategoricalCrossentropy(
              from_logits=True
          )
      },
      params: Optional[dict] = None,
  ):
      if params is None:
          params = {}
  
      self.model = model
      self.model_kwargs = model_kwargs
      self.compile_kwargs = compile_kwargs
      self.params = params
      self.net = None
  
imports: import tensorflow
  import keras
  import numpy
  from typing import Callable, Optional
label_desc: Use image node_id 1 to create a new KerasWrapperModel object  with example: obj = KerasWrapperModel(model, model_kwargs, compile_kwargs, params)