I have the following code nested in another function (so this isn't any kind of stand alone file):
train_set_percentages = [0.2,0.5,0.8,1.0]
results = {}
for i in range(len(train_set_percentages)):
kf2_index_percent,kf5_index_percent,loo_index_percent = generate_data_entry(train_set_percentages[i])
results[kf2_index_percent[0]] = kf2_index_percent[1]
results[kf5_index_percent[0]] = kf5_index_percent[1]
results[loo_index_percent[0]] = loo_index_percent[1]
generate_data_entry
returns the three tuples, kf2_index...etc.
. I need all of the tuples (key,data) in my final dictionary.
I have:
import threading
from threading import Thread
However, I have no idea how to build this dictionary from the output of the function. There are only the 5 training set percentages, so how do I run these in parallel and build the dictionary?
for i in range(len(train_set_percentages)):
Thread(target=generate_data_entry(train_set_percentages[i]))
Then...??