def get_model_name(model):
    """
    Detects the model name for a Scikit-Learn model or pipeline.

    Parameters
    ----------
    model: class or instance
        The object to determine the name for. If the model is an estimator it
        returns the class name; if it is a Pipeline it returns the class name
        of the final transformer or estimator in the Pipeline.

    Returns
    -------
    name : string
        The name of the model or pipeline.
    """
    if not is_estimator(model):
        raise YellowbrickTypeError(
            "Cannot detect the model name for non estimator: '{}'".format(
                type(model)
            )
        )

    else:
        if isinstance(model, Pipeline):
            return get_model_name(model.steps[-1][-1])
        else:
            return model.__class__.__name__
def get_model_name ( model ) : if not is_estimator ( model ) : raise YellowbrickTypeError ( "Cannot detect the model name for non estimator: '{}'" . format ( type ( model ) ) ) else : if isinstance ( model , Pipeline ) : return get_model_name ( model . steps [ - 1 ] [ - 1 ] ) else : return model . __class__ . __name__
Detects the model name for a Scikit-Learn model or pipeline.

    Parameters
    ----------
    model: class or instance
        The object to determine the name for. If the model is an estimator it
        returns the class name; if it is a Pipeline it returns the class name
        of the final transformer or estimator in the Pipeline.

    Returns
    -------
    name : string
        The name of the model or pipeline.