def similarity_plot(self, ssp, n_grid=100, plot_type='heatmap', cmap='YlGnBu', ax=None, **kwargs):
    if (ax is None):
        fig = plt.figure()
        ax = fig.add_subplot(111)
    if (self.domain_dim == 1):
        xs = np.linspace(self.domain_bounds[(0, 0)], self.domain_bounds[(0, 1)], n_grid)
        im = ax.plot(xs, (self.encode(xs.reshape(1, (- 1))).T @ self.data))
        ax.set_xlim(self.domain_bounds[(0, 0)], self.domain_bounds[(0, 1)])
    elif (self.domain_dim == 2):
        xs = np.linspace(self.domain_bounds[(0, 0)], self.domain_bounds[(0, 1)], n_grid)
        ys = np.linspace(self.domain_bounds[(1, 0)], self.domain_bounds[(1, 1)], n_grid)
        (X, Y) = np.meshgrid(xs, ys)
        sims = (self.encode(np.vstack([X.reshape((- 1)), Y.reshape((- 1))])).T @ ssp)
        if (plot_type == 'heatmap'):
            im = ax.pcolormesh(X, Y, sims.reshape(X.shape), cmap=cmap, **kwargs)
        elif (plot_type == 'contour'):
            im = ax.contour(X, Y, sims.reshape(X.shape), cmap=cmap, **kwargs)
        elif (plot_type == 'contourf'):
            im = ax.contourf(X, Y, sims.reshape(X.shape), cmap=cmap, **kwargs)
        ax.set_xlim(self.domain_bounds[(0, 0)], self.domain_bounds[(0, 1)])
        ax.set_ylim(self.domain_bounds[(1, 0)], self.domain_bounds[(1, 1)])
    else:
        raise NotImplementedError()
    return im
def similarity_plot(self, ssp, n_grid=100, plot_type='heatmap', cmap='YlGnBu', ax=None, **kwargs):
    if (ax is None):
        fig = plt.figure()
        ax = fig.add_subplot(111)
    if (self.domain_dim == 1):
        xs = np.linspace(self.domain_bounds[(0, 0)], self.domain_bounds[(0, 1)], n_grid)
        im = ax.plot(xs, (self.encode(xs.reshape(1, (- 1))).T @ self.data))
        ax.set_xlim(self.domain_bounds[(0, 0)], self.domain_bounds[(0, 1)])
    elif (self.domain_dim == 2):
        xs = np.linspace(self.domain_bounds[(0, 0)], self.domain_bounds[(0, 1)], n_grid)
        ys = np.linspace(self.domain_bounds[(1, 0)], self.domain_bounds[(1, 1)], n_grid)
        (X, Y) = np.meshgrid(xs, ys)
        sims = (self.encode(np.vstack([X.reshape((- 1)), Y.reshape((- 1))])).T @ ssp)
        if (plot_type == 'heatmap'):
            im = ax.pcolormesh(X, Y, sims.reshape(X.shape), cmap=cmap, **kwargs)
        elif (plot_type == 'contour'):
            im = ax.contour(X, Y, sims.reshape(X.shape), cmap=cmap, **kwargs)
        elif (plot_type == 'contourf'):
            im = ax.contourf(X, Y, sims.reshape(X.shape), cmap=cmap, **kwargs)
        ax.set_xlim(self.domain_bounds[(0, 0)], self.domain_bounds[(0, 1)])
        ax.set_ylim(self.domain_bounds[(1, 0)], self.domain_bounds[(1, 1)])
    else:
        raise NotImplementedError()
    return im