def query_for_split_decision(self, inds1, inds2, vectorizer, vectors, vector_names): print display_vector_index_details(inds1, vectors, vector_names, vectorizer) print display_vector_index_details(inds2, vectors, vector_names, vectorizer) print "Overlap:" print display_shared_vector_indeces_details([inds1, inds2], vectors, vector_names, vectorizer) response = raw_input("Should {0} and {1} be in the same cluster? (Y/N)".format(vector_names[inds1], vector_names[inds2])) if response.upper() == "Y" or response.upper() == "YES": return False # If users think the two should be in one cluster, we don't split, so return False if response.upper() == "N" or response.upper() == "NO": return True # vice versa
transformed_vectors = pca.fit_transform(vectors) plot_color = np.array(['#636363'] * n_samples) markers = np.array(["circle"] * n_samples) source = ColumnDataSource( dict( x=clusteringnmap.interactive_state._reduced_vectors[:, 0], y=clusteringnmap.interactive_state._reduced_vectors[:, 1], color=plot_color, size=np.ones(n_samples) * 15, marker=markers, alpha=np.ones(n_samples) * 0.6, ip=clusteringnmap.interactive_state._vector_names, features=[ display_vector_index_details( index, clusteringnmap.interactive_state._vectors, clusteringnmap.interactive_state._vector_names, clusteringnmap.interactive_state._vectorizer ) for index in xrange(len(clusteringnmap.interactive_state._vector_names)) ], ) ) # hover over tool, define what to display when hovering over a point hover = HoverTool( tooltips=""" <div style="font-size:10px;max-width: 640px; border-width:0; background:#2f2f2f; color:rgb(256,256,256); overflow-x: auto;"> <div> <span style="font-size: 17px; font-weight: bold;">@ip</span> <span style="font-size: 15px; color: #966;">($x, $y)</span> </div> <div>
pca = PCA(n_components=2) transformed_vectors = pca.fit_transform(vectors) plot_color = np.array(['#636363'] * n_samples) markers = np.array(["circle"] * n_samples) source = ColumnDataSource( dict( x=clusteringnmap.interactive_state._reduced_vectors[:, 0], y=clusteringnmap.interactive_state._reduced_vectors[:, 1], color=plot_color, size=np.ones(n_samples) * 15, marker=markers, alpha=np.ones(n_samples) * 0.6, ip=clusteringnmap.interactive_state._vector_names, features=[ display_vector_index_details( index, clusteringnmap.interactive_state._vectors, clusteringnmap.interactive_state._vector_names, clusteringnmap.interactive_state._vectorizer) for index in xrange( len(clusteringnmap.interactive_state._vector_names)) ], )) # hover over tool, define what to display when hovering over a point hover = HoverTool(tooltips=""" <div style="font-size:10px;max-width: 640px; border-width:0; background:#2f2f2f; color:rgb(256,256,256); overflow-x: auto;"> <div> <span style="font-size: 17px; font-weight: bold;">@ip</span> <span style="font-size: 15px; color: #966;">($x, $y)</span> </div> <div> <span><div id="feature-data-$index" style="display: none;">@features</div>