def plot_mdr_grid(mdr_instance):
var1_levels = list(set([variables[<NUM_LIT:0>] for variables in mdr_instance.feature_map]))<EOL>var2_levels = list(set([variables[<NUM_LIT:1>] for variables in mdr_instance.feature_map]))<EOL>max_count = np.array(list(mdr_instance.class_count_matrix.values())).flatten().max()<EOL>"""<STR_LIT>"""<EOL>fig, splots = plt.subplots(ncols=len(var1_levels), nrows=len(var2_levels), sharey=True, sharex=True)<EOL>fig.set_figwidth(<NUM_LIT:6>)<EOL>fig.set_figheight(<NUM_LIT:6>)<EOL>for (var1, var2) in itertools.product(var1_levels, var2_levels):<EOL><INDENT>class_counts = mdr_instance.class_count_matrix[(var1, var2)]<EOL>splot = splots[var2_levels.index(var2)][var1_levels.index(var1)]<EOL>splot.set_yticks([])<EOL>splot.set_xticks([])<EOL>splot.set_ylim(<NUM_LIT:0>, max_count * <NUM_LIT>)<EOL>splot.set_xlim(-<NUM_LIT:0.5>, <NUM_LIT>)<EOL>if var2_levels.index(var2) == <NUM_LIT:0>:<EOL><INDENT>splot.set_title('<STR_LIT>'.format(var1), fontsize=<NUM_LIT:12>)<EOL><DEDENT>if var1_levels.index(var1) == <NUM_LIT:0>:<EOL><INDENT>splot.set_ylabel('<STR_LIT>'.format(var2), fontsize=<NUM_LIT:12>)<EOL><DEDENT>bars = splot.bar(left=range(class_counts.shape[<NUM_LIT:0>]),<EOL>height=class_counts, width=<NUM_LIT:0.5>,<EOL>color='<STR_LIT>', align='<STR_LIT>')<EOL>bgcolor = '<STR_LIT>' if mdr_instance.feature_map[(var1, var2)] == <NUM_LIT:0> else '<STR_LIT>'<EOL>splot.set_axis_bgcolor(bgcolor)<EOL>for index, bar in enumerate(bars):<EOL><INDENT>splot.text(index, class_counts[index] + (max_count * <NUM_LIT:0.1>), class_counts[index], ha='<STR_LIT>')<EOL><DEDENT><DEDENT>fig.tight_layout()<EOL>return fig<EOL>
Visualizes the MDR grid of a given fitted MDR instance. Only works for 2-way MDR models.

    This function is currently incomplete.

    Parameters
    ----------
    mdr_instance: object
        A fitted instance of the MDR type to visualize.

    Returns
    ----------
    fig: matplotlib.figure
        Figure object for the visualized MDR grid.