コード例 #1
0
            #NewtopdocveccategoryMat_train,NewtopdocveccategoryMat_test, 
            #target_train, target_test,NewpreW,NewpreWdict,NewDimentionN,DimentionN,n_epoch = 10,batchsize = 50)

#pararelで計算
#k = IIalgorithm_model.caluculatemodel_without_kf(IIalgorithm_simple_pararell(NewpreW,NewpreWdict,NewDimentionN,DimentionN),
            #NewtopdocveccategoryMat_train,NewtopdocveccategoryMat_test, 
            #target_train, target_test,NewpreW,NewpreWdict,NewDimentionN,DimentionN,n_epoch = 10,batchsize = 50)
     
result_dic = defaultdict(list)
for dic_key in newl_dic.keys():
    print dic_key
    target_train,target_test,NewtopdocveccategoryMat_train, NewtopdocveccategoryMat_test,NewpreWdict, NewpreW, NewpreW_namelist_dic,NewDimentionN  = preprocess_NewCategoryVec(
                                                                                                                                                        newl_dic, toptarget_dic, dic_key,"09302015")
    for index in range(5):
        k = IIalgorithm_model.caluculatemodel_without_kf(
            IIalgorithm_model.IIalgorithm(NewpreW,NewpreWdict,NewDimentionN,DimentionN),
            NewtopdocveccategoryMat_train,NewtopdocveccategoryMat_test, 
            target_train, target_test,NewpreW,NewpreWdict,NewDimentionN,DimentionN,n_epoch = 10,batchsize = 50)
        result_dic[dic_key].append(k)

for dic_key in newl_dic.keys():
    all_result_pred = []
    all_result_true = []
    for k in result_dic[dic_key]:
        all_result_pred += k[-1]
        all_result_true += k[-2]
    print dic_key
    print classification_report(all_result_true, all_result_pred, digits = 4)
    print confusion_matrix(all_result_true, all_result_pred)
    print accuracy_score(all_result_true, all_result_pred)