Ejemplo n.º 1
0
    def figureX(self,
                title='Final embedding',
                perspectives=True,
                labels=None,
                edges=None,
                colors=None,
                plot=True,
                save=False):

        if perspectives is True:
            perspectives = []
            for k in range(self.K):
                Q = self.Q[k]
                q = np.cross(Q[0], Q[1])
                perspectives.append(q)
        else:
            perspectives = None

        if edges is not None:
            if isinstance(edges, numbers.Number):
                edges = edges - self.D
        plots.plot3D(self.X,
                     perspectives=perspectives,
                     edges=edges,
                     colors=colors,
                     title=title,
                     save=save)
Ejemplo n.º 2
0
    def plot_embedding(self,title=None,perspectives=True,edges=None,colors=True,
                plot=True,ax=None,**kwargs):

        if perspectives is True:
            perspectives = []
            for k in range(self.n_perspectives):
                Q = self.projections[k]
                q = np.cross(Q[0],Q[1])
                perspectives.append(q)
        else:
            perspectives = None
            
        if edges is not None:
            if isinstance(edges,numbers.Number):
                edges = edges-self.D
                
        if colors is True:
            colors = self.sample_colors
        if isinstance(colors, int):
            assert colors in range(self.n_samples)
            colors = squareform(self.distances[0])[colors]
            
        fig = plots.plot3D(self.embedding,perspectives=perspectives,edges=edges,
                     colors=colors,title=title,ax=ax,**kwargs)
        return fig
Ejemplo n.º 3
0
    def plot_image(self,index,title='embedding',edges=False,colors='default',
                       labels=None,
                       axis=True,plot=True,
                       ax=None,**kwargs):
        assert self.image_dimension >= 2
        if edges is True:
            edges = self.distances['edge_list']
        elif edges is False:
            edges = None
        if colors == 'default':
            colors = self.sample_colors

        if self.image_dimension == 2:
            plots.plot2D(self.images[index],edges=edges,colors=colors,
                         labels=labels,
                         axis=axis,ax=ax,title=title,**kwargs)
        else:
            plots.plot3D(self.X,edges=edges,colors=colors,title=title,
                         ax=ax,**kwargs)
        if plot is True:
            plt.draw()
            plt.pause(1)