In [1]:
%matplotlib inline
In [2]:
import skprocrustes as skp
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
In [3]:
gkbsolver = skp.GKBSolver(verbose=0)
spgsolver = skp.SPGSolver(verbose=0)
gpisolver = skp.GPISolver(verbose=0)
ebsolver = skp.EBSolver(verbose=0)
In [4]:
problem1 = skp.ProcrustesProblem((5000,5000,10,10), problemnumber=1)
In [5]:
t0 = time.time(); results1_gkb = gkbsolver.solve(problem1); t1_gkb = time.time()-t0; print(t1_gkb)
In [6]:
results1_gkb.show()
In [7]:
t0 = time.time(); results1_spg = spgsolver.solve(problem1); t1_spg = time.time()-t0; print(t1_spg)
In [8]:
results1_spg.show()
In [9]:
t0 = time.time(); results1_gpi = gpisolver.solve(problem1); t1_gpi = time.time()-t0; print(t1_gpi)
In [10]:
results1_gpi.show()
In [11]:
t0 = time.time(); results1_eb = ebsolver.solve(problem1); t1_eb = time.time()-t0; print(t1_eb)
In [12]:
results1_eb.show()
In [13]:
gkb, spg, gpi, eb = plt.bar([0,1,2,3], [t1_gkb, t1_spg, t1_gpi, t1_eb])
gkb.set_facecolor('r')
spg.set_facecolor('g')
gpi.set_facecolor('b')
eb.set_facecolor('m')
ax = plt.gca()
ax.set_xticks([0,1,2,3])
ax.set_xticklabels(['GKB', 'SPG', 'GPI', 'EB'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 1')
Out[13]:
In [14]:
results = pd.DataFrame({ 'GKB' : [t1_gkb], 'SPG' : [t1_spg], 'GPI' : [t1_gpi], 'EB' : [t1_eb]}, index=['problem1'])
results = results.T
results
Out[14]:
In [15]:
problem2 = skp.ProcrustesProblem((500,500,5,5), problemnumber=2)
In [16]:
t0 = time.time(); results2_gkb = gkbsolver.solve(problem2); t2_gkb = time.time()-t0; print(t2_gkb)
In [17]:
results2_gkb.show()
In [18]:
t0 = time.time(); results2_spg = spgsolver.solve(problem2); t2_spg = time.time()-t0; print(t2_spg)
In [19]:
results2_spg.show()
In [20]:
t0 = time.time(); results2_gpi = gpisolver.solve(problem2); t2_gpi = time.time()-t0; print(t2_gpi)
In [21]:
results2_gpi.show()
In [22]:
t0 = time.time(); results2_eb = ebsolver.solve(problem2); t2_eb = time.time()-t0; print(t2_eb)
In [23]:
results2_eb.show()
In [24]:
gkb, spg, gpi, eb = plt.bar([0,1,2,3], [t2_gkb, t2_spg, t2_gpi, t2_eb])
gkb.set_facecolor('r')
spg.set_facecolor('g')
gpi.set_facecolor('b')
eb.set_facecolor('m')
ax = plt.gca()
ax.set_xticks([0,1,2,3])
ax.set_xticklabels(['GKB', 'SPG', 'GPI', 'EB'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 2')
Out[24]:
In [25]:
results['problem2'] = pd.Series([t2_gkb, t2_spg, t2_gpi, t2_eb], index=results.index)
results
Out[25]:
In [34]:
problem3 = skp.ProcrustesProblem((1000, 1000, 5, 5), problemnumber=3)
In [35]:
t0 = time.time(); results3_gkb = gkbsolver.solve(problem3); t3_gkb = time.time()-t0; print(t3_gkb)
In [36]:
results3_gkb.show()
In [37]:
t0 = time.time(); results3_spg = spgsolver.solve(problem3); t3_spg = time.time()-t0; print(t3_spg)
In [38]:
results3_spg.show()
In [39]:
t0 = time.time(); results3_gpi = gpisolver.solve(problem3); t3_gpi = time.time()-t0; print(t3_gpi)
In [40]:
results3_gpi.show()
In [41]:
t0 = time.time(); results3_eb = ebsolver.solve(problem3); t3_eb = time.time()-t0; print(t3_eb)
In [42]:
results3_eb.show()
In [43]:
gkb, spg, gpi, eb = plt.bar([0,1,2,3], [t3_gkb, t3_spg, t3_gpi, t3_eb])
gkb.set_facecolor('r')
spg.set_facecolor('g')
gpi.set_facecolor('b')
eb.set_facecolor('m')
ax = plt.gca()
ax.set_xticks([0,1,2,3])
ax.set_xticklabels(['GKB', 'SPG', 'GPI', 'EB'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 3')
Out[43]:
In [44]:
results['problem3'] = pd.Series([t3_gkb, t3_spg, t3_gpi, t3_eb], index=results.index)
results
Out[44]:
In [45]:
gkbsolver_blobop = skp.GKBSolver(verbose=0, bloboptest = True)
In [46]:
t0 = time.time(); results1_gkbblobop = gkbsolver_blobop.solve(problem1); t1_blobop = time.time()-t0
In [47]:
results1_gkbblobop.show()
In [48]:
results1_gkb.show()
In [49]:
gkb, blobop = plt.bar([0,1], [t1_gkb, t1_blobop])
gkb.set_facecolor('r')
blobop.set_facecolor('y')
ax = plt.gca()
ax.set_xticks([0,1])
ax.set_xticklabels(['GKB', 'BLOBOP'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 1')
Out[49]:
In [50]:
gkb, spg, gpi, eb, blobop = plt.bar([0,1,2,3,4], [t1_gkb, t1_spg, t1_gpi, t1_eb, t1_blobop])
gkb.set_facecolor('r')
spg.set_facecolor('g')
gpi.set_facecolor('b')
eb.set_facecolor('m')
blobop.set_facecolor('y')
ax = plt.gca()
ax.set_xticks([0,1,2,3,4])
ax.set_xticklabels(['GKB', 'SPG', 'GPI', 'EB', 'BLOBOP'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 1')
Out[50]:
In [51]:
t0 = time.time(); results2_gkbblobop = gkbsolver_blobop.solve(problem2); t2_blobop = time.time()-t0
In [52]:
results2_gkbblobop.show()
In [53]:
results2_gkb.show()
In [54]:
gkb, blobop = plt.bar([0,1], [t2_gkb, t2_blobop])
gkb.set_facecolor('r')
blobop.set_facecolor('y')
ax = plt.gca()
ax.set_xticks([0,1])
ax.set_xticklabels(['GKB', 'BLOBOP'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 2')
Out[54]:
In [55]:
gkb, spg, gpi, eb, blobop = plt.bar([0,1,2,3,4], [t2_gkb, t2_spg, t2_gpi, t2_eb, t2_blobop])
gkb.set_facecolor('r')
spg.set_facecolor('g')
gpi.set_facecolor('b')
eb.set_facecolor('m')
blobop.set_facecolor('y')
ax = plt.gca()
ax.set_xticks([0,1,2,3,4])
ax.set_xticklabels(['GKB', 'SPG', 'GPI', 'EB', 'BLOBOP'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 2')
Out[55]:
In [56]:
t0 = time.time(); results3_gkbblobop = gkbsolver_blobop.solve(problem3); t3_blobop = time.time()-t0
In [57]:
results3_gkbblobop.show()
In [58]:
results3_gkb.show()
In [59]:
gkb, blobop = plt.bar([0,1], [t3_gkb, t3_blobop])
gkb.set_facecolor('r')
blobop.set_facecolor('y')
ax = plt.gca()
ax.set_xticks([0,1])
ax.set_xticklabels(['GKB', 'BLOBOP'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 3')
Out[59]:
In [60]:
gkb, spg, gpi, eb, blobop = plt.bar([0,1,2,3,4], [t3_gkb, t3_spg, t3_gpi, t3_eb, t3_blobop])
gkb.set_facecolor('r')
spg.set_facecolor('g')
gpi.set_facecolor('b')
eb.set_facecolor('m')
blobop.set_facecolor('y')
ax = plt.gca()
ax.set_xticks([0,1,2,3,4])
ax.set_xticklabels(['GKB', 'SPG', 'GPI', 'EB', 'BLOBOP'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 3')
Out[60]:
In [61]:
r = pd.DataFrame({'problem1' : t1_blobop, 'problem2' : t2_blobop, 'problem3' : t3_blobop}, index=['BLOBOP'])
results = results.append(r)
results
Out[61]:
In [62]:
gkbpolar = skp.GKBSolver(verbose=0, polar="ns")
gkbpolarblobop = skp.GKBSolver(verbose=0, polar="ns", bloboptest=True)
In [63]:
t0 = time.time(); results1_gkbpolar = gkbpolar.solve(problem1); t1_gkbpolar = time.time()-t0
In [64]:
results1_gkbpolar.show()
In [65]:
t0 = time.time(); results1_gkbpolarblobop = gkbpolarblobop.solve(problem1); t1_gkbpolarblobop = time.time()-t0
In [66]:
results1_gkbpolarblobop.show()
In [67]:
gkb, polarblobop, polar = plt.bar([0,1,2], [t1_gkb, t1_gkbpolarblobop, t1_gkbpolar])
gkb.set_facecolor('r')
polarblobop.set_facecolor('g')
polar.set_facecolor('b')
ax = plt.gca()
ax.set_xticks([0,1,2])
ax.set_xticklabels(['GKB', 'POLAR+BLOBOP', 'POLAR'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 1')
Out[67]:
In [69]:
t0 = time.time(); results2_gkbpolar = gkbpolar.solve(problem2); t2_gkbpolar = time.time()-t0
In [70]:
results2_gkbpolar.show()
In [71]:
t0 = time.time(); results2_gkbpolarblobop = gkbpolarblobop.solve(problem2); t2_gkbpolarblobop = time.time()-t0
In [72]:
results2_gkbpolarblobop.show()
In [73]:
gkb, polarblobop, polar = plt.bar([0,1,2], [t2_gkb, t2_gkbpolarblobop, t2_gkbpolar])
gkb.set_facecolor('r')
polarblobop.set_facecolor('g')
polar.set_facecolor('b')
ax = plt.gca()
ax.set_xticks([0,1,2])
ax.set_xticklabels(['GKB', 'POLAR+BLOBOP', 'POLAR'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 2')
Out[73]:
In [75]:
t0 = time.time(); results3_gkbpolar = gkbpolar.solve(problem3); t3_gkbpolar = time.time()-t0
In [76]:
results3_gkbpolar.show()
In [77]:
t0 = time.time(); results3_gkbpolarblobop = gkbpolarblobop.solve(problem3); t3_gkbpolarblobop = time.time()-t0
In [78]:
results3_gkbpolarblobop.show()
In [79]:
gkb, polarblobop, polar = plt.bar([0,1,2], [t3_gkb, t3_gkbpolarblobop, t3_gkbpolar])
gkb.set_facecolor('r')
polarblobop.set_facecolor('g')
polar.set_facecolor('b')
ax = plt.gca()
ax.set_xticks([0,1,2])
ax.set_xticklabels(['GKB', 'POLAR+BLOBOP', 'POLAR'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 3')
Out[79]:
In [82]:
r = pd.DataFrame({'problem1' : t1_gkbpolar, 'problem2' : t2_gkbpolar, 'problem3' : t3_gkbpolar}, index=['POLAR'])
results = results.append(r)
r = pd.DataFrame({'problem1' : t1_gkbpolarblobop, 'problem2' : t2_gkbpolarblobop, 'problem3' : t3_gkbpolarblobop}, index=['POLAR+BLOBOP'])
results = results.append(r)
results
Out[82]:
In [83]:
gkb, blobop, polarblobop, polar, spg, gpi, eb = plt.bar([0, 1, 2, 3, 4, 5, 6], [t1_gkb, t1_blobop, t1_gkbpolarblobop, t1_gkbpolar, t1_spg, t1_gpi, t1_eb])
gkb.set_facecolor('r')
blobop.set_facecolor('k')
polarblobop.set_facecolor('g')
polar.set_facecolor('b')
spg.set_facecolor('y')
gpi.set_facecolor('m')
eb.set_facecolor('c')
ax = plt.gca()
ax.set_xticks([0,1,2,3,4,5,6])
ax.set_xticklabels(['GKB', 'BLOBOP', 'POLAR+BLOBOP', 'POLAR', 'SPG', 'GPI', 'EB'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 1')
Out[83]:
In [84]:
gkb, blobop, polarblobop, polar, spg, gpi, eb = plt.bar([0, 1, 2, 3, 4, 5, 6], [t2_gkb, t2_blobop, t2_gkbpolarblobop, t2_gkbpolar, t2_spg, t2_gpi, t2_eb])
gkb.set_facecolor('r')
blobop.set_facecolor('k')
polarblobop.set_facecolor('g')
polar.set_facecolor('b')
spg.set_facecolor('y')
gpi.set_facecolor('m')
eb.set_facecolor('c')
ax = plt.gca()
ax.set_xticks([0,1,2,3,4,5,6])
ax.set_xticklabels(['GKB', 'BLOBOP', 'POLAR+BLOBOP', 'POLAR', 'SPG', 'GPI', 'EB'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 2')
Out[84]:
In [85]:
gkb, blobop, polarblobop, polar, spg, gpi, eb = plt.bar([0, 1, 2, 3, 4, 5, 6], [t3_gkb, t3_blobop, t3_gkbpolarblobop, t3_gkbpolar, t3_spg, t3_gpi, t3_eb])
gkb.set_facecolor('r')
blobop.set_facecolor('k')
polarblobop.set_facecolor('g')
polar.set_facecolor('b')
spg.set_facecolor('y')
gpi.set_facecolor('m')
eb.set_facecolor('c')
ax = plt.gca()
ax.set_xticks([0,1,2,3,4,5,6])
ax.set_xticklabels(['GKB', 'BLOBOP', 'POLAR+BLOBOP', 'POLAR', 'SPG', 'GPI', 'EB'])
#ax.set_ylim([0, 100])
ax.set_ylabel('CPU Time')
ax.set_title('Problem 3')
Out[85]:
In [ ]: