@@ -47,7 +47,7 @@ def plot_decision(features, labels, num_neighbors=1):
4747 model .fit (features [:, (0 ,2 )], labels )
4848 C = model .predict (np .vstack ([X .ravel (), Y .ravel ()]).T ).reshape (X .shape )
4949 if COLOUR_FIGURE :
50- cmap = ListedColormap ([(1. , .6 , .6 ), (.6 , 1. , .6 ), (.6 , .6 , 1. )])
50+ cmap = ListedColormap ([(1. , .7 , .7 ), (.7 , 1. , .7 ), (.7 , .7 , 1. )])
5151 else :
5252 cmap = ListedColormap ([(1. , 1. , 1. ), (.2 , .2 , .2 ), (.6 , .6 , .6 )])
5353 fig ,ax = plt .subplots ()
@@ -57,12 +57,12 @@ def plot_decision(features, labels, num_neighbors=1):
5757 ax .set_ylabel (feature_names [2 ])
5858 ax .pcolormesh (X , Y , C , cmap = cmap )
5959 if COLOUR_FIGURE :
60- cmap = ListedColormap ([(1. , .0 , .0 ), (.0 , 1. , .0 ), (.0 , .0 , 1. )])
61- ax .scatter (features [:, 0 ], features [:, 2 ], c = labels , cmap = cmap )
60+ cmap = ListedColormap ([(1. , .0 , .0 ), (.1 , .6 , .1 ), (.0 , .0 , 1. )])
61+ ax .scatter (features [:, 0 ], features [:, 2 ], c = labels , cmap = cmap , s = 40 )
6262 else :
6363 for lab , ma in zip (range (3 ), "Do^" ):
6464 ax .plot (features [labels == lab , 0 ], features [
65- labels == lab , 2 ], ma , c = (1. , 1. , 1. ))
65+ labels == lab , 2 ], ma , c = (1. , 1. , 1. ), ms = 8 )
6666 return fig ,ax
6767
6868
0 commit comments