pymks/tools.py
def draw_gridscores(grid_scores, param, score_label=None, colors=None,
                    data_labels=None, param_label=None, fontsize=20):
    """
    Visualize the score values and standard deviations from grids
    scores result from GridSearchCV while varying 1 parameters.

    Args:
        grid_scores (list, grid_scores): `grid_scores_` attribute from
            GridSearchCV
        param (list, str): parameters used in grid_scores
        score_label (str): label for score value axis
        colors (list): colors used for this specified parameter
        param_label (list): parameter titles to appear on plot
    """
    plt.close('all')
    if type(grid_scores[0]) is not list:
        grid_scores = [grid_scores]
    if data_labels is None:
        data_labels = [None for l in range(len(grid_scores))]
    if score_label is None:
        score_label = ''
    if param_label is None:
        param_label is ''
    if colors is None:
        colors = _get_color_list(len(grid_scores))
    if len(grid_scores) != len(data_labels) or len(data_labels) != len(colors):
        raise RuntimeError(
            "grid_scores, colors, and param_lables must have the same length.")
    mins, maxes = [], []
    for grid_score, data_label, color in zip(grid_scores, data_labels, colors):
        tmp = [[params[param], mean_score, scores.std()]
               for params, mean_score, scores in grid_score]
        _param, errors, stddev = list(zip(*tmp))
        _mins = np.array(errors) - np.array(stddev)
        _maxes = np.array(errors) + np.array(stddev)
        plt.fill_between(_param, _mins, _maxes, alpha=0.1,
                         color=color)
        plt.plot(_param, errors, 'o-', color=color, label=data_label,
                 linewidth=2)
        mins.append(min(_mins))
        maxes.append(max(_maxes))
    if data_labels[0] is not None:
        plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.,
                   fontsize=15)
    _min, _max = min(mins), max(maxes)
    y_epsilon = (_max - _min) * 0.05
    plt.ylim((_min - y_epsilon, _max + y_epsilon))
    plt.ticklabel_format(style='sci', axis='y')
    plt.ylabel(score_label, fontsize=fontsize)
    plt.xlabel(param_label, fontsize=fontsize)
    plt.show()

    Visualize the score values and standard deviations from grids
    scores result from GridSearchCV while varying 1 parameters.

    Args:
        grid_scores (list, grid_scores): `grid_scores_` attribute from
            GridSearchCV
        param (list, str): parameters used in grid_scores
        score_label (str): label for score value axis
        colors (list): colors used for this specified parameter
        param_label (list): parameter titles to appear on plot
    
Visualize the score values and standard deviations from grids
scores result from GridSearchCV while varying 1 parameters.
Visualize the score values and standard deviations from grids scores result from GridSearchCV while varying 1 parameters .
def draw_gridscores(grid_scores, param, score_label=None, colors=None,
                    data_labels=None, param_label=None, fontsize=20):
    plt.close('all')
    if type(grid_scores[0]) is not list:
        grid_scores = [grid_scores]
    if data_labels is None:
        data_labels = [None for l in range(len(grid_scores))]
    if score_label is None:
        score_label = ''
    if param_label is None:
        param_label is ''
    if colors is None:
        colors = _get_color_list(len(grid_scores))
    if len(grid_scores) != len(data_labels) or len(data_labels) != len(colors):
        raise RuntimeError(
            "grid_scores, colors, and param_lables must have the same length.")
    mins, maxes = [], []
    for grid_score, data_label, color in zip(grid_scores, data_labels, colors):
        tmp = [[params[param], mean_score, scores.std()]
               for params, mean_score, scores in grid_score]
        _param, errors, stddev = list(zip(*tmp))
        _mins = np.array(errors) - np.array(stddev)
        _maxes = np.array(errors) + np.array(stddev)
        plt.fill_between(_param, _mins, _maxes, alpha=0.1,
                         color=color)
        plt.plot(_param, errors, 'o-', color=color, label=data_label,
                 linewidth=2)
        mins.append(min(_mins))
        maxes.append(max(_maxes))
    if data_labels[0] is not None:
        plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.,
                   fontsize=15)
    _min, _max = min(mins), max(maxes)
    y_epsilon = (_max - _min) * 0.05
    plt.ylim((_min - y_epsilon, _max + y_epsilon))
    plt.ticklabel_format(style='sci', axis='y')
    plt.ylabel(score_label, fontsize=fontsize)
    plt.xlabel(param_label, fontsize=fontsize)
    plt.show()
def draw_gridscores ( grid_scores , param , score_label = None , colors = None , data_labels = None , param_label = None , fontsize = 20 ) : plt . close ( 'all' ) if type ( grid_scores [ 0 ] ) is not list : grid_scores = [ grid_scores ] if data_labels is None : data_labels = [ None for l in range ( len ( grid_scores ) ) ] if score_label is None : score_label = '' if param_label is None : param_label is '' if colors is None : colors = _get_color_list ( len ( grid_scores ) ) if len ( grid_scores ) != len ( data_labels ) or len ( data_labels ) != len ( colors ) : raise RuntimeError ( "grid_scores, colors, and param_lables must have the same length." ) mins , maxes = [ ] , [ ] for grid_score , data_label , color in zip ( grid_scores , data_labels , colors ) : tmp = [ [ params [ param ] , mean_score , scores . std ( ) ] for params , mean_score , scores in grid_score ] _param , errors , stddev = list ( zip ( * tmp ) ) _mins = np . array ( errors ) - np . array ( stddev ) _maxes = np . array ( errors ) + np . array ( stddev ) plt . fill_between ( _param , _mins , _maxes , alpha = 0.1 , color = color ) plt . plot ( _param , errors , 'o-' , color = color , label = data_label , linewidth = 2 ) mins . append ( min ( _mins ) ) maxes . append ( max ( _maxes ) ) if data_labels [ 0 ] is not None : plt . legend ( bbox_to_anchor = ( 1.05 , 1 ) , loc = 2 , borderaxespad = 0. , fontsize = 15 ) _min , _max = min ( mins ) , max ( maxes ) y_epsilon = ( _max - _min ) * 0.05 plt . ylim ( ( _min - y_epsilon , _max + y_epsilon ) ) plt . ticklabel_format ( style = 'sci' , axis = 'y' ) plt . ylabel ( score_label , fontsize = fontsize ) plt . xlabel ( param_label , fontsize = fontsize ) plt . show ( )
Visualize the score values and standard deviations from grids
scores result from GridSearchCV while varying 1 parameters.
Visualize the score values and standard deviations from grids scores result from GridSearchCV while varying 1 parameters .
"""
    Visualize the score values and standard deviations from grids
    scores result from GridSearchCV while varying 1 parameters.

    Args:
        grid_scores (list, grid_scores): `grid_scores_` attribute from
            GridSearchCV
        param (list, str): parameters used in grid_scores
        score_label (str): label for score value axis
        colors (list): colors used for this specified parameter
        param_label (list): parameter titles to appear on plot
    """
grid_scores
`grid_scores_` attribute from
GridSearchCV
` grid_scores_ ` attribute from GridSearchCV
param
parameters used in grid_scores
parameters used in grid_scores
score_label
label for score value axis
label for score value axis
colors
colors used for this specified parameter
colors used for this specified parameter
data_labels
param_label
parameter titles to appear on plot
parameter titles to appear on plot
fontsize