rng=np.random.RandomState(0)iris=datasets.load_iris()X=iris.data[:,:2]y=iris.target# step size in the meshh=.02y_30=np.copy(y)y_30[rng.rand(len(y))<0.3]=-1y_50=np.copy(y)y_50[rng.rand(len(y))<0.5]=-1# we create an instance of SVM and fit out data. We do not scale our# data since we want to plot the support vectorsls30=(label_propagation.LabelSpreading().fit(X,y_30),y_30)ls50=(label_propagation.LabelSpreading().fit(X,y_50),y_50)ls100=(label_propagation.LabelSpreading().fit(X,y),y)rbf_svc=(svm.SVC(kernel='rbf').fit(X,y),y)# create a mesh to plot inx_min,x_max=X[:,0].min()-1,X[:,0].max()+1y_min,y_max=X[:,1].min()-1,X[:,1].max()+1x_=np.arange(x_min,x_max,h)y_=np.arange(y_min,y_max,h)xx,yy=np.meshgrid(x_,y_)# title for the plotstitles=['Label Spreading 30% data','Label Spreading 50% data','Label Spreading 100% data','SVC with rbf kernel']

fori,(clf,y_train)inenumerate((ls30,ls50,ls100,rbf_svc)):# Plot the decision boundary. For that, we will assign a color to each# point in the mesh [x_min, x_max]x[y_min, y_max].Z=clf.predict(np.c_[xx.ravel(),yy.ravel()])# Put the result into a color plotZ=Z.reshape(xx.shape)trace1=go.Heatmap(x=x_,y=y_,z=Z,colorscale=cmap,showscale=False)fig.append_trace(trace1,i/2+1,i%2+1)
# Plot also the training pointstrace2=go.Scatter(x=X[:,0],y=X[:,1],mode='markers',showlegend=False,marker=dict(color=X[:,0],colorscale=cmap,line=dict(width=1,color='black')))fig.append_trace(trace2,i/2+1,i%2+1)
foriinmap(str,range(1,5)):y='yaxis'+ix='xaxis'+ifig['layout'][y].update(showticklabels=False,ticks='')fig['layout'][x].update(showticklabels=False,ticks='')fig['layout'].update(height=700)