print "# Loaded hypotheses: ", len(hypotheses) # - - logging - - - - - - - - with open(LOG+"/hypotheses.txt", 'w') as f: for i, h in enumerate(hypotheses): print >>f, i, qq(h) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Load the human data # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Load the concepts from the human data from Data import load_human_data human_nyes, human_ntrials = load_human_data() print "# Loaded human data" observed_sets = set([ k[0] for k in human_nyes.keys() ]) ## TRIM TO FEWER # observed_sets = set(list(observed_sets)[:100]) print "# Loaded %s observed sets" % len(observed_sets) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Get the rule count matrices # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ from LOTlib.GrammarInference.GrammarInference import create_counts
print "# Finished %s" % str(observed_set) return set(tn.get_all()) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # define the running function # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if __name__ == "__main__": # Load the concepts from the human data from Data import load_human_data human_nyes, _ = load_human_data() print "# Loaded human data" observed_sets = set([k[0] for k in human_nyes.keys()]) # And now map from LOTlib.MPI.MPI_map import MPI_unorderedmap, is_master_process from LOTlib.Miscellaneous import display_option_summary if is_master_process(): display_option_summary(options) hypotheses = set() for s in MPI_unorderedmap(myrun, [[s] for s in observed_sets] * options.CHAINS): hypotheses.update(s)
print "# Loaded hypotheses: ", len(hypotheses) # - - logging - - - - - - - - with open(LOG + "/hypotheses.txt", 'w') as f: for i, h in enumerate(hypotheses): print >> f, i, qq(h) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Load the human data # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Load the concepts from the human data from Data import load_human_data human_nyes, human_ntrials = load_human_data() print "# Loaded human data" observed_sets = set([k[0] for k in human_nyes.keys()]) ## TRIM TO FEWER # observed_sets = set(list(observed_sets)[:100]) print "# Loaded %s observed sets" % len(observed_sets) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Get the rule count matrices # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ from LOTlib.GrammarInference.GrammarInference import create_counts
# print "#", h print "# Finished %s" % str(observed_set) return set(tn.get_all()) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # define the running function # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if __name__ == "__main__": # Load the concepts from the human data from Data import load_human_data human_nyes, _ = load_human_data() print "# Loaded human data" observed_sets = set([ k[0] for k in human_nyes.keys() ]) # And now map from LOTlib.MPI.MPI_map import MPI_unorderedmap, is_master_process from LOTlib.Miscellaneous import display_option_summary if is_master_process(): display_option_summary(options) hypotheses = set() for s in MPI_unorderedmap(myrun, [ [s] for s in observed_sets ]*options.CHAINS ): hypotheses.update(s)