Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import multiprocessing
- ET = ExtraTreesClassifier(n_estimators=10, criterion='gini', max_features='auto', bootstrap=False) # .76
- RF = RandomForestClassifier(n_estimators=25, random_state=1)# .75
- GB = GradientBoostingClassifier() # .74
- ET = ExtraTreesClassifier(n_estimators=10, criterion='gini', max_features='auto', bootstrap=False) # .77 # without this lil fucker, Acc: 0.75 [Ensemble]
- clfList = [ET,RF,GB,ET]
- def spawn(clf):
- clf.fit(x,y)
- print("Done another one!")
- import time
- start = time.time()
- if __name__ == '__main__':
- for i in clfList:
- print(i)
- #spawn(i) # 16 secounds
- # # 16 secounds
- # p = threading.Thread(target=spawn, args=(i,))
- # p.start()
- # p.join()
- p=multiprocessing.Pool(6) # 15.65
- results = p.map(spawn,clfList) # clfList has 4 models, first 2 are fast, last 2 are slow
- results
- end = time.time()
- print(end - start)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement