Example #1
0
def basic_selection(common_path,binary_path,clf="LR"):
    datasets=ens.read_dataset(common_path,binary_path)
    acc=np.array([ validate_acc(data_i).get_acc() 
                        for data_i in datasets])
    s_clf=dataset_selection(datasets,acc)
    print(len(s_clf))
    return ens.ensemble(common_path,binary_path,True,clf,s_clf)[0]
Example #2
0
def selection_exp(common,binary,cf_path=None):
	s_clf=random_selection(common,binary,1000,27,clf="LR")
	print(s_clf)
	result,votes=ens.ensemble(common,binary,
		clf="LR",binary=False,s_clf=s_clf)
	result.report()
	if(cf_path):
		result.get_cf(cf_path)
Example #3
0
def select_ens(common, binary):
    best_set = selection.random_selection(common, binary, 1000, 27)
    result_i = ens.ensemble(common,
                            binary,
                            s_clf=best_set,
                            clf="LR",
                            binary=False)[0]
    desc_i = exp.exp_info(common, binary, result_i)
    return "%d,%s" % (len(best_set), desc_i[-1])
Example #4
0
def exp_person(common, binary, n, n_clf, clf="LR"):
    fun = person.total_person_selection
    #	fun=basic.total_basic_selection
    all_clf = fun(common, binary, n, n_clf, clf)
    acc = []
    for all_clf_i in all_clf:
        result = ens.ensemble(common, binary, clf, False, all_clf_i)[0]
        acc.append(result.get_acc())
    for acc_i, clf_set_i in zip(acc, all_clf):
        print(clf_set_i)
        print(acc_i)
Example #5
0
def inliner_exp(dtw, deep, binary1, binary2):
    paths = [(deep, binary1), (deep + dtw, binary1), (deep, [binary1,
                                                             binary2]),
             (deep + dtw, [binary1, binary2])]
    results = []
    for common_i, binary_i in paths:
        basic_i = ens.ensemble(common_i, binary_i, clf="LR", binary=False)
        results.append((False, common_i, binary_i, basic_i))
        inline_i = inliner_voting(common_i, binary_i, clf="LR")
        results.append((True, common_i, binary_i, inline_i))
    for inline_i, common_i, binary_i, result_i in results:
        desc_common, desc_binary, metrics = exp.exp_info(
            common_i, binary_i, result_i)
        line_i = (int(inline_i), desc_common, desc_binary, metric)
        print("%d,%s,%s,%s" % line_i)
Example #6
0
def reduced_selection(common, binary, n_feats):
    def helper(common, binary, clf="LR"):
        read = reduction.SepSelected(n_feats, 0)
        return ens.make_votes(common, binary, "LR", read)

    s_clf = selection.random_selection(common,
                                       binary,
                                       1000,
                                       27,
                                       clf="LR",
                                       fun=helper)
    read = reduction.SepSelected(n_feats, 0)
    result, votes = ens.ensemble(common,
                                 binary,
                                 clf="LR",
                                 binary=False,
                                 s_clf=s_clf,
                                 read=read)
    return result, s_clf
Example #7
0
def basic_exp(in_path):
    paths = files.get_paths(in_path, name="dtw")
    result = ens.ensemble(paths[0], None, clf="LR", binary=False)[0]
    result.report()
Example #8
0
def person_selection(common_path, binary_path, clf="LR"):
    datasets = ens.read_dataset(common_path, binary_path)
    clf_acc = np.array([person_acc(data_i).get_acc() for data_i in datasets])
    s_clf = acc.dataset_selection(datasets, clf_acc)
    print(len(s_clf))
    return ens.ensemble(common_path, binary_path, True, clf, s_clf)[0]
Example #9
0
def simple_ens(common, binary):
    result_i = ens.ensemble(common, binary, clf="LR", binary=False)[0]
    desc_i = exp.exp_info(common, binary, result_i)
    return desc_i[-1]
Example #10
0
def acc_curve(common,binary,clf,clfs):
	clf_selction=range(2,len(clfs))
	results=[ens.ensemble(common,binary,False,clf,clfs[:k])[0]
	 			for k in clf_selction]
	acc=[result_i.get_acc() for result_i in results]
	print(acc)