def plot_contours(ax, clf, xx, yy, proba=False, **params):
    'Plot the decision boundaries for a classifier.\n\n        Parameters\n        ----------\n        ax: matplotlib axes object\n        clf: a classifier\n        xx: meshgrid ndarray\n        yy: meshgrid ndarray\n        params: dictionary of params to pass to contourf, optional\n        '
    if proba:
        Z = clf.predict_proba(np.c_[(xx.ravel(), yy.ravel())])[:, (- 1)]
    else:
        Z = clf.predict(np.c_[(xx.ravel(), yy.ravel())])
    Z = Z.reshape(xx.shape)
    out = ax.contourf(xx, yy, Z, 20, **params)
    return out
Plot the decision boundaries for a classifier.

Parameters
----------
ax: matplotlib axes object
clf: a classifier
xx: meshgrid ndarray
yy: meshgrid ndarray
params: dictionary of params to pass to contourf, optional
def plot_contours(ax, clf, xx, yy, proba=False, **params):
    'Plot the decision boundaries for a classifier.\n\n        Parameters\n        ----------\n        ax: matplotlib axes object\n        clf: a classifier\n        xx: meshgrid ndarray\n        yy: meshgrid ndarray\n        params: dictionary of params to pass to contourf, optional\n        '
    if proba:
        Z = clf.predict_proba(np.c_[(xx.ravel(), yy.ravel())])[:, (- 1)]
    else:
        Z = clf.predict(np.c_[(xx.ravel(), yy.ravel())])
    Z = Z.reshape(xx.shape)
    out = ax.contourf(xx, yy, Z, 20, **params)
    return out