Skip to content
Snippets Groups Projects
Commit 6e42d70f authored by Jacques Fize's avatar Jacques Fize
Browse files

UPD

parent 54242b2e
No related branches found
No related tags found
No related merge requests found
...@@ -187,8 +187,7 @@ grid = GridSearchModel(\ ...@@ -187,8 +187,7 @@ grid = GridSearchModel(\
grid.run() grid.run()
``` ```
# Authors and Acknowledgment
# Authors and Acknowledgment
Proposed by **Jacques Fize**, **Ludovic Moncla** and **Bruno Martins** Proposed by **Jacques Fize**, **Ludovic Moncla** and **Bruno Martins**
......
...@@ -23,6 +23,7 @@ parser.add_argument("--split-method", default="per_pair", type=str, choices="per ...@@ -23,6 +23,7 @@ parser.add_argument("--split-method", default="per_pair", type=str, choices="per
args = parser.parse_args()#("../data/geonamesData/FR.txt ../data/wikipedia/cooccurrence_FR.txt ../data/geonamesData/hierarchy.txt".split()) args = parser.parse_args()#("../data/geonamesData/FR.txt ../data/wikipedia/cooccurrence_FR.txt ../data/geonamesData/hierarchy.txt".split())
PREFIX = args.geonames_dataset.split("/")[-1].split(".")[0] # Ouch ! PREFIX = args.geonames_dataset.split("/")[-1].split(".")[0] # Ouch !
PREFIX = PREFIX + "_" + args.split_method
# LOAD DATA # LOAD DATA
geonames_data = read_geonames(args.geonames_dataset) geonames_data = read_geonames(args.geonames_dataset)
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
{ "long": "--ngram-word2vec-iter", "type": "int", "default": 50 }, { "long": "--ngram-word2vec-iter", "type": "int", "default": 50 },
{ "short": "-t", "long": "--tolerance-value", "type": "float", "default": 100 }, { "short": "-t", "long": "--tolerance-value", "type": "float", "default": 100 },
{ "short": "-e", "long": "--epochs", "type": "int", "default": 100 }, { "short": "-e", "long": "--epochs", "type": "int", "default": 100 },
{ "short": "-d", "long": "--dimension", "type": "int", "default": 256 } { "short": "-d", "long": "--dimension", "type": "int", "default": 256 },
{ "short": "-l", "long": "--lstm-layer", "type": "int", "default": 2,"choices":[1,2] }
] ]
} }
\ No newline at end of file
...@@ -62,7 +62,7 @@ if args.adjacency: ...@@ -62,7 +62,7 @@ if args.adjacency:
PREFIX_OUTPUT_FN += "_A" PREFIX_OUTPUT_FN += "_A"
if args.inclusion: if args.inclusion:
PREFIX_OUTPUT_FN += "_I" PREFIX_OUTPUT_FN += "_I"
if args.wikipedia_cooc: if args.wikipedia:
PREFIX_OUTPUT_FN += "_C" PREFIX_OUTPUT_FN += "_C"
MODEL_OUTPUT_FN = "outputs/{0}.h5".format(PREFIX_OUTPUT_FN) MODEL_OUTPUT_FN = "outputs/{0}.h5".format(PREFIX_OUTPUT_FN)
...@@ -170,9 +170,15 @@ x1 = embedding_layer(input_1) ...@@ -170,9 +170,15 @@ x1 = embedding_layer(input_1)
x2 = embedding_layer(input_2) x2 = embedding_layer(input_2)
# Each LSTM learn on a permutation of the input toponyms # Each LSTM learn on a permutation of the input toponyms
x1 = Bidirectional(LSTM(100))(x1) if args.lstm_layer == 2:
x2 = Bidirectional(LSTM(100))(x2) x1 = Bidirectional(LSTM(100))(x1)
x = concatenate([x1,x2]) x2 = Bidirectional(LSTM(100))(x2)
x = concatenate([x1,x2])
else:
lstm_unique_layer = Bidirectional(LSTM(100))
x1 = lstm_unique_layer(x1)
x2 = lstm_unique_layer(x2)
x = concatenate([x1,x2])
x1 = Dense(500,activation="relu")(x) x1 = Dense(500,activation="relu")(x)
x1 = Dense(500,activation="relu")(x1) x1 = Dense(500,activation="relu")(x1)
...@@ -188,6 +194,8 @@ output_coord = concatenate([output_lon,output_lat],name="output_coord") ...@@ -188,6 +194,8 @@ output_coord = concatenate([output_lon,output_lat],name="output_coord")
model = Model(inputs = [input_1,input_2], outputs = output_coord)#input_3 model = Model(inputs = [input_1,input_2], outputs = output_coord)#input_3
model.compile(loss={"output_coord":haversine_tf_1circle}, optimizer='adam',metrics={"output_coord":accuracy_k(ACCURACY_TOLERANCE)}) model.compile(loss={"output_coord":haversine_tf_1circle}, optimizer='adam',metrics={"output_coord":accuracy_k(ACCURACY_TOLERANCE)})
print("Neural Network Architecture : ")
print(model.summary())
############################################################################################# #############################################################################################
################################# TRAINING LAUNCH ########################################### ################################# TRAINING LAUNCH ###########################################
############################################################################################# #############################################################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment