(stability_selection, threshold_highlight=None,
                        **kwargs)
return fig, ax
Plots stability path.

    Parameters
    ----------
    stability_selection : StabilitySelection
        Fitted instance of StabilitySelection.

    threshold_highlight : float
        Threshold defining the cutoff for the stability scores for the
        variables that need to be highlighted.

    kwargs : dict
        Arguments passed to matplotlib plot function.
Plots stability path.
Plots stability path .
def plot_stability_path(stability_selection, threshold_highlight=None,
                        **kwargs):
    """Plots stability path.

    Parameters
    ----------
    stability_selection : StabilitySelection
        Fitted instance of StabilitySelection.

    threshold_highlight : float
        Threshold defining the cutoff for the stability scores for the
        variables that need to be highlighted.

    kwargs : dict
        Arguments passed to matplotlib plot function.
    """
    check_is_fitted(stability_selection, 'stability_scores_')

    threshold = stability_selection.threshold if threshold_highlight is None else threshold_highlight
    paths_to_highlight = stability_selection.get_support(threshold=threshold)

    x_grid = stability_selection.lambda_grid / np.max(stability_selection.lambda_grid)

    fig, ax = plt.subplots(1, 1, **kwargs)
    if not paths_to_highlight.all():
        ax.plot(x_grid, stability_selection.stability_scores_[~paths_to_highlight].T,
                'k:', linewidth=0.5)

    if paths_to_highlight.any():
        ax.plot(x_grid, stability_selection.stability_scores_[paths_to_highlight].T,
                'r-', linewidth=0.5)

    if threshold is not None:
        ax.plot(x_grid, threshold * np.ones_like(stability_selection.lambda_grid),
                'b--', linewidth=0.5)

    ax.set_ylabel('Stability score')
    ax.set_xlabel('Lambda / max(Lambda)')

    fig.tight_layout()

    return fig, ax
def plot_stability_path ( stability_selection , threshold_highlight = None , * * kwargs ) : check_is_fitted ( stability_selection , 'stability_scores_' ) threshold = stability_selection . threshold if threshold_highlight is None else threshold_highlight paths_to_highlight = stability_selection . get_support ( threshold = threshold ) x_grid = stability_selection . lambda_grid / np . max ( stability_selection . lambda_grid ) fig , ax = plt . subplots ( 1 , 1 , * * kwargs ) if not paths_to_highlight . all ( ) : ax . plot ( x_grid , stability_selection . stability_scores_ [ ~ paths_to_highlight ] . T , 'k:' , linewidth = 0.5 ) if paths_to_highlight . any ( ) : ax . plot ( x_grid , stability_selection . stability_scores_ [ paths_to_highlight ] . T , 'r-' , linewidth = 0.5 ) if threshold is not None : ax . plot ( x_grid , threshold * np . ones_like ( stability_selection . lambda_grid ) , 'b--' , linewidth = 0.5 ) ax . set_ylabel ( 'Stability score' ) ax . set_xlabel ( 'Lambda / max(Lambda)' ) fig . tight_layout ( ) return fig , ax