(save_location, verbose=True)
return model
Load a parametric UMAP model consisting of a umap-learn UMAP object
    and corresponding keras models.

    Parameters
    ----------
    save_location : str
        the folder that the model was saved in
    verbose : bool, optional
        Whether to print the loading steps, by default True

    Returns
    -------
    parametric_umap.ParametricUMAP
        Parametric UMAP objects
Load a parametric UMAP model consisting of a umap-learn UMAP object
    and corresponding keras models.
Load a parametric UMAP model consisting of a umap - learn UMAP object and corresponding keras models .
def load_ParametricUMAP(save_location, verbose=True):
    """
    Load a parametric UMAP model consisting of a umap-learn UMAP object
    and corresponding keras models.

    Parameters
    ----------
    save_location : str
        the folder that the model was saved in
    verbose : bool, optional
        Whether to print the loading steps, by default True

    Returns
    -------
    parametric_umap.ParametricUMAP
        Parametric UMAP objects
    """

    ## Loads a ParametricUMAP model and its related keras models

    model_output = os.path.join(save_location, "model.pkl")
    model = pickle.load((open(model_output, "rb")))
    if verbose:
        print("Pickle of ParametricUMAP model loaded from {}".format(model_output))

    # Work around optimizer not pickling anymore (since tf 2.4)
    class_name = model._optimizer_dict["name"]
    OptimizerClass = getattr(tf.keras.optimizers, class_name)
    model.optimizer = OptimizerClass.from_config(model._optimizer_dict)

    # load encoder
    encoder_output = os.path.join(save_location, "encoder")
    if os.path.exists(encoder_output):
        model.encoder = tf.keras.models.load_model(encoder_output)
        if verbose:
            print("Keras encoder model loaded from {}".format(encoder_output))

    # save decoder
    decoder_output = os.path.join(save_location, "decoder")
    if os.path.exists(decoder_output):
        model.decoder = tf.keras.models.load_model(decoder_output)
        print("Keras decoder model loaded from {}".format(decoder_output))

    # get the custom loss function
    umap_loss_fn = umap_loss(
        model.batch_size,
        model.negative_sample_rate,
        model._a,
        model._b,
        model.edge_weight,
        model.parametric_embedding,
    )

    # save parametric_model
    parametric_model_output = os.path.join(save_location, "parametric_model")
    if os.path.exists(parametric_model_output):
        model.parametric_model = tf.keras.models.load_model(
            parametric_model_output, custom_objects={"loss": umap_loss_fn}
        )
        print("Keras full model loaded from {}".format(parametric_model_output))

    return model
def load_ParametricUMAP ( save_location , verbose = True ) : ## Loads a ParametricUMAP model and its related keras models model_output = os . path . join ( save_location , "model.pkl" ) model = pickle . load ( ( open ( model_output , "rb" ) ) ) if verbose : print ( "Pickle of ParametricUMAP model loaded from {}" . format ( model_output ) ) # Work around optimizer not pickling anymore (since tf 2.4) class_name = model . _optimizer_dict [ "name" ] OptimizerClass = getattr ( tf . keras . optimizers , class_name ) model . optimizer = OptimizerClass . from_config ( model . _optimizer_dict ) # load encoder encoder_output = os . path . join ( save_location , "encoder" ) if os . path . exists ( encoder_output ) : model . encoder = tf . keras . models . load_model ( encoder_output ) if verbose : print ( "Keras encoder model loaded from {}" . format ( encoder_output ) ) # save decoder decoder_output = os . path . join ( save_location , "decoder" ) if os . path . exists ( decoder_output ) : model . decoder = tf . keras . models . load_model ( decoder_output ) print ( "Keras decoder model loaded from {}" . format ( decoder_output ) ) # get the custom loss function umap_loss_fn = umap_loss ( model . batch_size , model . negative_sample_rate , model . _a , model . _b , model . edge_weight , model . parametric_embedding , ) # save parametric_model parametric_model_output = os . path . join ( save_location , "parametric_model" ) if os . path . exists ( parametric_model_output ) : model . parametric_model = tf . keras . models . load_model ( parametric_model_output , custom_objects = { "loss" : umap_loss_fn } ) print ( "Keras full model loaded from {}" . format ( parametric_model_output ) ) return model