Skip to content

Commit

Permalink
Added suporte for cylindrical model from config file
Browse files Browse the repository at this point in the history
  • Loading branch information
stonescenter committed Feb 17, 2020
1 parent fbd36e2 commit 94dbe35
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
3 changes: 2 additions & 1 deletion config-cnn.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"data": {
"filename": "./dataset/phi025-025_eta025-025_filtered.csv",
"train_split": 0.70,
"normalise": true
"normalise": true,
"cilyndrical": true
},
"training": {
"epochs": 20,
Expand Down
3 changes: 2 additions & 1 deletion config-lstm-paralel.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"data": {
"filename": "./dataset/phi025-025_eta025-025_filtered.csv",
"train_split": 0.70,
"normalise": true
"normalise": true,
"cilyndrical": false
},
"training": {
"epochs": 20,
Expand Down
3 changes: 2 additions & 1 deletion config-lstm.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"data": {
"filename": "./dataset/phi025-025_eta025-025_filtered.csv",
"train_split": 0.70,
"normalise": true
"normalise": true,
"cilyndrical": false
},
"training": {
"epochs": 20,
Expand Down
7 changes: 4 additions & 3 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@
"data": {
"filename": "./dataset/phi025-025_eta025-025_filtered.csv",
"train_split": 0.70,
"normalise": true
"normalise": true,
"cilyndrical": true
},
"training": {
"epochs": 20,
"batch_size": 32,
"save_model": true,
"load_model": true,
"load_model": false,
"use_gpu": true
},
"model": {
"name": "lstm",
"loss": "mse",
"optimizer": "RMSprop",
"optimizer": "rmsprop",
"layers": [
{
"type": "lstm",
Expand Down
7 changes: 4 additions & 3 deletions main-paralel.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,17 @@ def main():
num_features = configs['model']['layers'][0]['input_features'] # the number of features of each hits

split = configs['data']['train_split'] # the number of features of each hits

cilyndrical = configs['data']['cilyndrical'] # set to polar or cartesian coordenates
normalise = configs['data']['normalise']

# config gpu
#gpu()

# prepare data set
data = Dataset(data_dir, KindNormalization.Zscore)

X, X_, y = data.prepare_training_data(FeatureType.Divided, normalise=True,
cilyndrical=True)
X, X_, y = data.prepare_training_data(FeatureType.Divided, normalise=normalise,
cilyndrical=cilyndrical)

# reshape data
X = data.reshape3d(X, time_steps, num_features)
Expand Down
15 changes: 6 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,20 @@ def main():
num_features = configs['model']['layers'][0]['input_features'] # the number of features of each hits

split = configs['data']['train_split'] # the number of features of each hits

cilyndrical = configs['data']['cilyndrical'] # set to polar or cartesian coordenates
normalise = configs['data']['normalise']

# config gpu
#gpu()

# prepare data set
data = Dataset(data_dir, KindNormalization.Zscore)

X, y = data.prepare_training_data(FeatureType.Positions, normalise=True,
cilyndrical=True)
X, y = data.prepare_training_data(FeatureType.Positions, normalise=normalise,
cilyndrical=cilyndrical)

# reshape data
#X = data.reshape3d(X, time_steps, num_features)
X = data.reshape3d(X, time_steps, num_features)

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=1-split, random_state=42)

Expand All @@ -129,8 +130,6 @@ def main():

model.build_model()

#x_train = [X_train, X_train_]

# in-memory training
history = model.train(
x=X_train,
Expand All @@ -145,9 +144,7 @@ def main():
if not model.load_model():
print ('[Error] please change the config file : load_model')
return

#x_test = [X_test, X_test_]


predicted = model.predict_one_hit(X_test)

y_predicted = np.reshape(predicted, (predicted.shape[0]*predicted.shape[1], 1))
Expand Down

0 comments on commit 94dbe35

Please sign in to comment.