mvpa2.misc.plot.base.plot_decision_boundary_2d

mvpa2.misc.plot.base.plot_decision_boundary_2d(dataset, clf=None, targets=None, regions=None, maps=None, maps_res=50, vals=[-1, 0, 1], data_callback=None)

Plot a scatter of a classifier’s decision boundary and data points

Assumes data is 2d (no way to visualize otherwise!!)

Parameters:

dataset : Dataset

Data points to visualize (might be the data clf was train on, or any novel data).

clf : Classifier, optional

Trained classifier

targets : string, optional

What samples attributes to use for targets. If None and clf is provided, then clf.params.targets_attr is used.

regions : string, optional

Plot regions (polygons) around groups of samples with the same attribute (and target attribute) values. E.g. chunks.

maps : string in {‘targets’, ‘estimates’}, optional

Either plot underlying colored maps, such as clf predictions within the spanned regions, or estimates from the classifier (might not work for some).

maps_res : int, optional

Number of points in each direction to evaluate. Points are between axis limits, which are set automatically by matplotlib. Higher number will yield smoother decision lines but come at the cost of O^2 classifying time/memory.

vals : array of floats, optional

Where to draw the contour lines if maps=’estimates’

data_callback : callable, optional

Callable object to preprocess the new data points. Classified points of the form samples = data_callback(xysamples). I.e. this can be a function to normalize them, or cache them before they are classified.