Example #1
0
    def draw(self, filename, active_dims_only=False, draw_posterior=True):
        """
        Plot the model and data points

        :param filename: the output file (path and) name, without extension
        :param active_dims_only: True if want to present only the active
        dimensions (defaults to False)
        :param draw_posterior: True if want to draw the posterior contour
        (defaults to True)
        """
        if active_dims_only:
            plot = GPCPlot.create(self.model, xlabels=self.data.XLabel, usetex=True,
                active_dims=self.getActiveDims())
        else:
            plot = GPCPlot.create(self.model, xlabels=self.data.XLabel, usetex=True)

        plot.draw(draw_posterior=draw_posterior)
        plot.save(filename)
Example #2
0
    def draw(self, filename, active_dims_only=False, draw_posterior=True):
        """
        Plot the model and data points

        :param filename: the output file (path and) name, without extension
        :param active_dims_only: True if want to present only the active
        dimensions (defaults to False)
        :param draw_posterior: True if want to draw the posterior contour
        (defaults to True)
        """
        if active_dims_only:
            plot = GPCPlot.create(self.model,
                                  xlabels=self.data.XLabel,
                                  usetex=True,
                                  active_dims=self.getActiveDims())
        else:
            plot = GPCPlot.create(self.model,
                                  xlabels=self.data.XLabel,
                                  usetex=True)

        plot.draw(draw_posterior=draw_posterior)
        plot.save(filename)
Example #3
0
ipython gpcplottest.py
"""

import GPy
import numpy as np
import pods
from gpcplot import GPCPlot as gpcplt

# 1D
data = pods.datasets.toy_linear_1d_classification(seed=497)
X = data["X"]
Y = data["Y"][:, 0:1]
Y[Y.flatten() == -1] = 0
m = GPy.models.GPClassification(X, Y)

plotobj = gpcplt.create(m, xlabels=(r"Toy x",))
plotobj.draw()
plotobj.save("./imgs/test1d_before")
m.optimize()
plotobj.draw()
plotobj.save("./imgs/test1d_after")

# 2D
data = pods.datasets.crescent_data(seed=400)
X = data["X"]
Y = data["Y"]
Y[Y.flatten() == -1] = 0
m = GPy.models.GPClassification(X, Y, kernel=None)

plotobj = gpcplt.create(m, xlabels=(r"Crescent $x_1$", r"Crescent $x_2$"), usetex=True)
plotobj.draw()
Example #4
0
ipython gpcplottest.py
"""

import GPy
import numpy as np
import pods
from gpcplot import GPCPlot as gpcplt

# 1D
data = pods.datasets.toy_linear_1d_classification(seed=497)
X = data['X']
Y = data['Y'][:, 0:1]
Y[Y.flatten() == -1] = 0
m = GPy.models.GPClassification(X, Y)

plotobj = gpcplt.create(m, xlabels=(r'Toy x',))
plotobj.draw()
plotobj.save('./imgs/test1d_before')
m.optimize()
plotobj.draw()
plotobj.save('./imgs/test1d_after')

# 2D
data = pods.datasets.crescent_data(seed=400)
X = data['X']
Y = data['Y']
Y[Y.flatten()==-1] = 0
m = GPy.models.GPClassification(X, Y, kernel=None)

plotobj = gpcplt.create(m, xlabels=(r'Crescent $x_1$', r'Crescent $x_2$'), usetex=True)
plotobj.draw()