Esempio n. 1
0
 def gmrf():
   global gmrf_
   if not gmrf_:
     if not os.path.exists(gmrf_fname):
       tic("creating empty gmrf", experiment_name)
       gmrf_ = emptyValues(tt_graph())
     else:
       tic("reading gmrf from %s"%gmrf_fname, experiment_name)
       gmrf_ = pickle.load(open(gmrf_fname,'r'))
   return gmrf_
Esempio n. 2
0
  if graph_type == 'simple':
    hmm_graph = model.createHMMGraphFromNetwork(net, mode_counts=traj_conv.modeCounts())
    hmm_graph_one_mode = model.createHMMGraphFromNetwork(net, mode_counts=traj_conv_one_mode.modeCounts())
    # hmm_graph = model.createHMMGraphFromNetwork(net, mode_counts=mode_counts)
  else:
    # Complex model not implemented
    assert False

  tt_graph = createTravelTimeGraph(hmm_graph, radius=2e-4)
  tt_graph.checkInvariants()

  tt_graph_one_mode = createTravelTimeGraph(hmm_graph_one_mode, radius=2e-4)
  tt_graph_one_mode.checkInvariants()


  gmrf = emptyValues(tt_graph)
  gmrf_one_mode = emptyValues(tt_graph)

  # Checkpoint: save the structures

  save_ttg_structure(tt_graph, experiment_name=experiment_name)
  # The TTG structure is required when loading the GMRF (and the GMRF estimators)
  # Make sure they are saved in all the directories
  save_ttg_structure(tt_graph_one_mode, experiment_name='{0}_one_mode'.format(experiment_name))
  save_ttg_structure(tt_graph_one_mode, experiment_name='{0}_one_mode_indep'.format(experiment_name))
  save_ttg_structure(tt_graph, experiment_name='{0}_indep'.format(experiment_name))


  # Loading the learning data

  data_source = experiment_design['data_source']