Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
 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()
Exemplo n.º 3
0
 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()
Exemplo n.º 4
0
 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 ""
Exemplo n.º 5
0
 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 ""
Exemplo n.º 6
0
 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()
Exemplo n.º 7
0
 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()
Exemplo n.º 8
0
 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()
Exemplo n.º 9
0
# 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']
Y[Y == -1] = 0
Exemplo n.º 10
0
# 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']