Esempio 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()
Esempio 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()
Esempio 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()
Esempio 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 ""
Esempio 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 ""
Esempio 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()
Esempio 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()
Esempio 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()
Esempio n. 9
0
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')
# virgi_ind = np.where(Y == 'Iris-virginica')
# X = np.hstack((X[versi_ind,:], X[virgi_ind,:])).squeeze()
# Ynum = np.zeros(Y.size)
# Ynum[virgi_ind] = 1
# Ynum = np.hstack((Ynum[versi_ind], Ynum[virgi_ind])).reshape(X.shape[0], 1)
# d = GPCData(X, Ynum, XLabel=['Sepal Length', 'Sepal Width', 'Petal Length', 'Petal Width'], YLabel=['Versicolor', 'Virginica'])
# print "Data size = %d" % (d.getDim() * d.getNum())
# search = GPCSearch(data=d, max_depth=4, beam_width=2)
# best, best1d = search.search()