Пример #1
0
def overproductionRf(XProd,YProd, XMeta, XSel, XTest, nrOfCls = 5, folder = "data/dataForMeta/"):
    #produces lot of cls for problem
    #metoda izdelana za testiranje metaDes, ne potrebujemo, ker pridobimo klasifikatorje od ostalih
    for i in range(nrOfCls):
        cls = RandomForestClassifier(n_estimators=np.random.randint(1000,1200), n_jobs=8)
        cls.name1 = "rf"+str(i)+"_"+str(cls.n_estimators)
        print("Producing " + cls.name1)
        YCaProduction, YCaMeta, YCaSel, YCaTest = trainClsForMeta(XProd, YProd, XMeta, XSel, XTest, cls)
        #save in file
        if(not os.path.isdir(folder + "classifiers/"+cls.name1)): os.makedirs(folder + "classifiers/"+cls.name1)
        # np.savetxt(folder + "classifiers/"+cls.name1+"/YCaProd.csv", YCaProduction, delimiter="\n")
        np.savetxt(folder + "classifiers/"+cls.name1+"/YCaMeta.csv", YCaMeta, delimiter="\n")
        np.savetxt(folder + "classifiers/"+cls.name1+"/YCaSel.csv", YCaSel, delimiter="\n")
        np.savetxt(folder + "classifiers/"+cls.name1+"/YCaTest.csv", YCaTest, delimiter="\n")