aboutsummaryrefslogtreecommitdiffstats
path: root/simulation/utils_blocks.py
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2015-12-02 15:04:43 -0500
committerThibaut Horel <thibaut.horel@gmail.com>2015-12-02 15:04:43 -0500
commitccb192c4190701531094b46df85725158d4e9ffc (patch)
tree31750bbaf1e6785cdb260cb5a2ae22f9f7cf8338 /simulation/utils_blocks.py
parent5e546cb6c96e5e5e575730e27c175f558da5ec82 (diff)
downloadcascades-ccb192c4190701531094b46df85725158d4e9ffc.tar.gz
Fix the mess and use sqlite backend
Diffstat (limited to 'simulation/utils_blocks.py')
-rw-r--r--simulation/utils_blocks.py31
1 files changed, 0 insertions, 31 deletions
diff --git a/simulation/utils_blocks.py b/simulation/utils_blocks.py
index 0d30786..3b29972 100644
--- a/simulation/utils_blocks.py
+++ b/simulation/utils_blocks.py
@@ -121,34 +121,3 @@ def dynamic_data_stream(graph, batch_size):
data_set = LearnedDataset(node_p, graph)
scheme = fuel.schemes.ConstantScheme(batch_size)
return fuel.streams.DataStream(dataset=data_set, iteration_scheme=scheme)
-
-
-if __name__ == "__main__":
- batch_size = 100
- n_obs = 1000
- frequency = 1
- graph = utils.create_wheel(1000)
- print('GRAPH:\n', graph, '\n-------------\n')
-
- g_shared = theano.shared(value=graph, name='graph')
- x, s, params, cost = create_mle_model(graph)
- rmse = rmse_error(g_shared, params)
- error = relative_error(g_shared, params)
-
- alg = algorithms.GradientDescent(
- cost=-cost, parameters=[params], step_rule=blocks.algorithms.AdaDelta()
- )
- data_stream = create_learned_data_stream(graph, batch_size)
- #data_stream = create_fixed_data_stream(n_obs, graph, batch_size)
- loop = main_loop.MainLoop(
- alg, data_stream,
- extensions=[
- be.FinishAfter(after_n_batches=10**4),
- bm.TrainingDataMonitoring([cost, rmse, error],
- every_n_batches=frequency),
- be.Printing(every_n_batches=frequency),
- JSONDump("tmpactive_log.json", every_n_batches=frequency),
- ActiveLearning(data_stream.dataset, every_n_batches=frequency)
- ],
- )
- loop.run()