Skip to content

Commit

Permalink
reduces the fluctuation, add pbs submit file
Browse files Browse the repository at this point in the history
  • Loading branch information
vicentebolea committed Jun 18, 2018
1 parent 41a55e6 commit 4ef314b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
11 changes: 9 additions & 2 deletions driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from model_factory_method import model_create
from extract_features import prepare_features
from IPython import embed
from os import environ

tests = [
["model_time", "./dataset/NN_test_Y_ADO.mat", "sWave_ADO"],
Expand All @@ -14,13 +15,19 @@
]

BATCH_SIZE = 1000
EPOCHS = 20000

EPOCHS = 2000
if 'EPOCHS' in environ:
EPOCHS = int(environ['EPOCHS'])


for setup in tests:
train_x, train_y, test_x, test_y = prepare_features(setup[1], setup[2])
model_factory = model_create(setup[0],39)
model_factory = model_create(setup[0],53)
model = model_factory.model

#embed()

model.compile(loss='mean_squared_error', optimizer='adam', metrics=['accuracy'])

model.fit(train_x, train_y,
Expand Down
5 changes: 5 additions & 0 deletions extract_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

def prepare_features(labels_file, filekey):
dataset_x = sio.loadmat(FILE1)['data']
extra1 = sio.loadmat(FILE2)['data_1statn']
extra2 = sio.loadmat(FILE3)['data_3statns']

dataset_x = np.hstack((dataset_x, extra1))
dataset_x = np.hstack((dataset_x, extra2))
dataset_y = sio.loadmat(labels_file)[filekey]

train_x, test_x, train_y, test_y = train_test_split(dataset_x, dataset_y, test_size=0.4)
Expand Down
11 changes: 7 additions & 4 deletions model_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ class ModelTime(ModelFactory):
def create(self):
self.model = Sequential()
model = Sequential()
model.add(Dense(78, input_shape=(self.dim,), activation='relu'))
model.add(Dense(39, activation='relu'))
model.add(Dense(20, activation='relu'))
model.add(Dense(1))
model.add(Dense(53, input_shape=(self.dim,), activation='relu'))
# model.add(Dropout(0.25))
model.add(Dense(25))
#model.add(Dropout(0.25))
#model.add(Dense(20))
#model.add(Dense(10))
model.add(Dense(1)) #, activation='sigmoid'))
return model
9 changes: 9 additions & 0 deletions quakes-keras.pbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
#PBS -l nodes=ferrari01:gpus=1:ppn=1,walltime=00:05:00

source ~vicente/.bash_independent
export EPOCHS=40000
#PATH=~vicente/.local/bin:$PATH
cd ~/ml-quakes-project/

pipenv run python ./driver.py

0 comments on commit 4ef314b

Please sign in to comment.