def pima(self, dims=[1, 5, 6, 7], depth=4, width=2): data = pods.datasets.pima(dims=dims) X, Y, XLabel = data['X'], data['Y'], data['XLabel'] d = GPCData(X, Y, XLabel=XLabel, YLabel=['not diabetic', 'diabetic']) print "\n\nPima Indian Diabetes dataset" print "=====\nData size: D = %d, N = %d." % (d.getDim(), d.getNum()) search = GPCSearch(data=d, max_depth=depth, beam_width=width) best, best1d = search.search() constker = search.baseline() report = GPCReport(name='Pima', history=best, best1d=best1d, constkernel=constker) report.export() print ""
def bupa(self, dims=range(5), depth=4, width=2): data = pods.datasets.bupa(dims=dims) X, Y, XLabel = data['X'], data['Y'], data['XLabel'] d = GPCData(X, Y, XLabel=XLabel, YLabel=['$\\leq 5$ drink units', '$> 5$ drink units']) print "\n\nBUPA Liver Disorders dataset" print "=====\nData size: D = %d, N = %d." % (d.getDim(), d.getNum()) search = GPCSearch(data=d, max_depth=depth, beam_width=width) best, best1d = search.search() constker = search.baseline() report = GPCReport(name='BUPA', history=best, best1d=best1d, constkernel=constker) report.export()
def wisconsin(self, dims=[0, 1, 4, 5, 7], depth=4, width=2): data = pods.datasets.breastoriginal(dims=dims) X, Y, XLabel = data['X'], data['Y'], data['XLabel'] d = GPCData(X, Y, XLabel=XLabel, YLabel=['no breast cancer', 'with breast cancer']) print "\n\nWisconsin Breast Cancer dataset" print "=====\nData size: D = %d, N = %d." % (d.getDim(), d.getNum()) search = GPCSearch(data=d, max_depth=depth, beam_width=width) best, best1d = search.search() constker = search.baseline() report = GPCReport(name='Wisconsin', history=best, best1d=best1d, constkernel=constker) report.export()
def cleveland(self, dims=[0, 3, 4, 7, 9, 11], depth=5, width=2): data = pods.datasets.cleveland(dims=dims) X, Y, XLabel = data['X'], data['Y'], data['XLabel'] d = GPCData(X, Y, XLabel=XLabel, YLabel=['no heart disease', 'with heart disease']) print "\n\nCleveland Heart Disease dataset" print "=====\nData size: D = %d, N = %d." % (d.getDim(), d.getNum()) search = GPCSearch(data=d, max_depth=4, beam_width=2) best, best1d = search.search() constker = search.baseline() report = GPCReport(name='Cleveland', history=best, best1d=best1d, constkernel=constker) report.export()
# Department of Engineering, University of Cambridge import numpy as np import pods from gpcdata import GPCData from gpcsearch import GPCSearch # 1D print "\n=====\n1D test:" X = np.random.uniform(1, 10, (200, 1)) Y = np.zeros((200, 1)) Y[150:, :] = 1 d = GPCData(X, Y) print d search = GPCSearch(data=d, max_depth=5, beam_width=2) best, best1d = search.search() print "\n=====\nBaseline:" ck = search.baseline() print ck print ck.getGPyKernel() ck.draw('./imgs/gpcsearchtest', active_dims_only=True) print "cverror = {}".format(ck.error()) print "error = {}".format(ck.misclassifiedPoints()['X'].shape[0] / float(ck.data.X.shape[0])) # 2D print "\n=====\n2D test:" data = pods.datasets.crescent_data(seed=496) X = data['X'] Y = data['Y']
# Department of Engineering, University of Cambridge import numpy as np import pods from gpcdata import GPCData from gpcreport import GPCReport from gpcsearch import GPCSearch data = pods.datasets.pima() X = data['X'][:250,[1,5,6,7]] Y = data['Y'][:250] d = GPCData(X, Y, XLabel=['plasma glucose', 'BMI', 'pedigree function', 'age']) print "\n=====\nData size: D = %d, N = %d." % (d.getDim(), d.getNum()) search = GPCSearch(data=d, max_depth=3, beam_width=1) best, best1d = search.search() print "\n=====\nBaseline:" ck = search.baseline() print ck print "error = {}".format(ck.error()) report = GPCReport(name='Pima', history=best, best1d=best1d, constkernel=ck) report.export() # data = pods.datasets.iris() # X = data['X'] # Y = data['Y'] # versi_ind = np.where(Y == 'Iris-versicolor')