add load function for hyper band results
This commit is contained in:
parent
f02e0b7f99
commit
68254d6629
@ -39,7 +39,7 @@ def get_embedding(embedding_size, input_length, filter_size, kernel_size, hidden
|
|||||||
def get_model(cnnDropout, flow_features, domain_features, window_size, domain_length, cnn_dims, kernel_size,
|
def get_model(cnnDropout, flow_features, domain_features, window_size, domain_length, cnn_dims, kernel_size,
|
||||||
dense_dim, cnn, model_output="both"):
|
dense_dim, cnn, model_output="both"):
|
||||||
ipt_domains = Input(shape=(window_size, domain_length), name="ipt_domains")
|
ipt_domains = Input(shape=(window_size, domain_length), name="ipt_domains")
|
||||||
encoded = TimeDistributed(cnn)(ipt_domains)
|
encoded = TimeDistributed(cnn, name="domain_cnn")(ipt_domains)
|
||||||
ipt_flows = Input(shape=(window_size, flow_features), name="ipt_flows")
|
ipt_flows = Input(shape=(window_size, flow_features), name="ipt_flows")
|
||||||
merged = keras.layers.concatenate([encoded, ipt_flows], -1)
|
merged = keras.layers.concatenate([encoded, ipt_flows], -1)
|
||||||
# CNN processing a small slides of flow windows
|
# CNN processing a small slides of flow windows
|
||||||
|
7
utils.py
7
utils.py
@ -1,5 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
|
import joblib
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from sklearn.utils import class_weight
|
from sklearn.utils import class_weight
|
||||||
|
|
||||||
@ -20,3 +22,8 @@ def get_custom_class_weights(client, server):
|
|||||||
|
|
||||||
def get_custom_sample_weights(client, server):
|
def get_custom_sample_weights(client, server):
|
||||||
return class_weight.compute_sample_weight("balanced", np.vstack((client, server)).T)
|
return class_weight.compute_sample_weight("balanced", np.vstack((client, server)).T)
|
||||||
|
|
||||||
|
|
||||||
|
def load_ordered_hyperband_results(path):
|
||||||
|
results = joblib.load(path)
|
||||||
|
return sorted(results, itemgetter("loss"))
|
||||||
|
Loading…
Reference in New Issue
Block a user