-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mark van der Wilk
committed
Jan 23, 2014
1 parent
45a2390
commit e650e59
Showing
4 changed files
with
169 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import sys | ||
import glob | ||
import os | ||
import random | ||
|
||
import numpy as np | ||
import numpy.linalg as linalg | ||
import numpy.random as rnd | ||
from mpl_toolkits.mplot3d.axes3d import Axes3D | ||
|
||
import GPy | ||
|
||
sys.path.append('../tools/') | ||
sys.path.append('..') | ||
|
||
import tools.split_data as split_data | ||
|
||
import parallel_GPLVM | ||
|
||
Q = 7 | ||
max_iters = 200 | ||
N = 1000 | ||
P = 6 | ||
num_inducing = min(40, N / P) - 1 | ||
|
||
# Get oildata and divide up | ||
oildata = GPy.util.datasets.oil() | ||
Y = oildata['X'][:N] | ||
path = './oildata/' | ||
split_data.clean_dir(path) | ||
split_data.split_data(Y, P, path, 'oil') | ||
|
||
# Run the Parallel GPLVM | ||
options = {} | ||
options['input'] = path + '/inputs/' | ||
options['embeddings'] = path + '/embeddings/' | ||
options['parallel'] = 'local' | ||
options['iterations'] = max_iters | ||
options['statistics'] = path + '/tmp' | ||
options['tmp'] = path + '/tmp' | ||
options['M'] = num_inducing | ||
options['Q'] = Q | ||
options['D'] = 12 | ||
options['fixed_embeddings'] = False | ||
options['keep'] = True | ||
options['load'] = False | ||
options['fixed_beta'] = True | ||
options['init'] = 'PCA' | ||
options['optimiser'] = 'SCG_adapted' | ||
options['fixed_beta'] = False | ||
|
||
parallel_GPLVM.main(options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import os | ||
import glob | ||
import shutil | ||
import time | ||
|
||
import numpy as np | ||
|
||
import tools.split_data as split_data | ||
import parallel_GPLVM | ||
|
||
P = 10 | ||
Q = 7 | ||
num_inducing = 40 | ||
path = './flight/' | ||
dname = 'flight' | ||
|
||
# First delete all current inputs & embeddings | ||
split_data.clean_dir(path) | ||
|
||
# Load data | ||
Y = np.loadtxt(path + '/proc/flight', delimiter=',') | ||
split_data.split_data(Y, P, path, dname) | ||
|
||
# Prepare directories | ||
reqdirs = ['inputs', 'embeddings', 'tmp', 'proc'] | ||
for dirname in reqdirs: | ||
if not os.path.exists(path + '/' + dirname): | ||
os.mkdir(path + '/' + dirname) | ||
|
||
# Run the Parallel GPLVM | ||
options = {} | ||
options['input'] = path + '/inputs/' | ||
options['embeddings'] = path + '/embeddings/' | ||
options['parallel'] = 'local' | ||
options['iterations'] = 1000 | ||
options['statistics'] = path + '/tmp' | ||
options['tmp'] = path + '/tmp' | ||
options['M'] = num_inducing | ||
options['Q'] = Q | ||
options['D'] = 12 | ||
options['fixed_embeddings'] = False | ||
options['keep'] = False | ||
options['load'] = False | ||
options['fixed_beta'] = True | ||
options['init'] = 'PCA' | ||
options['optimiser'] = 'SCG_adapted' | ||
options['fixed_beta'] = False | ||
|
||
parallel_GPLVM.main(options) | ||
|
||
# Copy output directory | ||
shutil.copytree(path, '/scratch/mv310/results/' + dname + str(time.time())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import os | ||
import glob | ||
import shutil | ||
import time | ||
import gzip | ||
import cPickle | ||
|
||
import numpy as np | ||
|
||
import tools.split_data as split_data | ||
import parallel_GPLVM | ||
|
||
P = 60 | ||
Q = 20 | ||
num_inducing = 100 | ||
path = './mnist/' | ||
dname = 'mnist' | ||
|
||
# First delete all current inputs & embeddings | ||
split_data.clean_dir(path) | ||
|
||
# Load data | ||
f = gzip.open(path + '/proc/mnist.pkl.gz', 'rb') | ||
train_set, valid_set, test_set = cPickle.load(f) | ||
f.close() | ||
|
||
Y = train_set[0][:N, :] | ||
|
||
split_data.split_data(Y, P, path, dname) | ||
|
||
# Prepare directories | ||
reqdirs = ['inputs', 'embeddings', 'tmp', 'proc'] | ||
for dirname in reqdirs: | ||
if not os.path.exists(path + '/' + dirname): | ||
os.mkdir(path + '/' + dirname) | ||
|
||
# Run the Parallel GPLVM | ||
options = {} | ||
options['input'] = path + '/inputs/' | ||
options['embeddings'] = path + '/embeddings/' | ||
options['parallel'] = 'local' | ||
options['iterations'] = 1000 | ||
options['statistics'] = path + '/tmp' | ||
options['tmp'] = path + '/tmp' | ||
options['M'] = num_inducing | ||
options['Q'] = Q | ||
options['D'] = Y.shape[1] | ||
options['fixed_embeddings'] = False | ||
options['keep'] = False | ||
options['load'] = False | ||
options['fixed_beta'] = True | ||
options['init'] = 'PCA' | ||
options['optimiser'] = 'SCG_adapted' | ||
options['fixed_beta'] = False | ||
|
||
start_time = time.time() | ||
parallel_GPLVM.main(options) | ||
print('Elapsed time:') | ||
print(time.time() - start_time) | ||
|
||
# Copy output directory | ||
shutil.copytree(path, '/scratch/mv310/results/' + dname + str(time.time())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters