def sample(graphs): sampler =GraphLearnSampler() graphs, graphs_ = itertools.tee(graphs) sampler.fit(graphs) return unpack(sampler.sample(graphs_, same_radius=False, max_size_diff=False, sampling_interval=9999, select_cip_max_tries=100, batch_size=30, n_steps=100, n_jobs=-1, improving_threshold=0.9 ))
def sample(graphs): sampler = GraphLearnSampler() graphs, graphs_ = itertools.tee(graphs) sampler.fit(graphs) return unpack( sampler.transform( graphs_, same_radius=False, size_constrained_core_choice=False, sampling_interval=9999, select_cip_max_tries=100, batch_size=30, n_steps=100, n_jobs=-1, improving_threshold=0.9, ) )
for perc in percentages: # we work with count many graphs count = int(lenpo*perc) # make copy of graphiterator # select count random elements # triplicate the count long iterator graphs_pos, graphs_pos_ = itertools.tee(graphs_pos) x=range(count) random.shuffle(x) graphs_pos_ = picker(graphs_pos_, x ) graphs_pos_,graphs_pos__,graphs_pos___ = itertools.tee(graphs_pos_,3) # do sampling sampler.fit(graphs_pos__, grammar_n_jobs=4) improved_graphs = sampler.sample(graphs_pos_, same_radius=False, max_size_diff=True, sampling_interval=9999, select_cip_max_tries=100, batch_size=int(count/4)+1, n_steps=100, n_jobs=-1, improving_threshold=0.9) #calculate the score of the improved versions #calculate score of the originals
for perc in percentages: # we work with count many graphs count = int(lenpo*perc) # make copy of graphiterator # select count random elements # triplicate the count long iterator graphs_pos, graphs_pos_ = itertools.tee(graphs_pos) x=range(count) random.shuffle(x) graphs_pos_ = picker(graphs_pos_, x ) graphs_pos_,graphs_pos__,graphs_pos___ = itertools.tee(graphs_pos_,3) # do sampling sampler.fit(graphs_pos__, grammar_n_jobs=4) improved_graphs = sampler.transform(graphs_pos_, same_radius=False, size_constrained_core_choice=True, sampling_interval=9999, select_cip_max_tries=100, batch_size=int(count/4)+1, n_steps=100, n_jobs=-1, improving_threshold=0.9) #calculate the score of the improved versions #calculate score of the originals