Commit 13d5f927 authored by Marco Chierici's avatar Marco Chierici
Browse files

Added LabelEncoder, removed old code chunks

parent 870ddde5
......@@ -51,7 +51,6 @@ parser.add_argument('--cv_k', type=np.int, default=5, help='Number of CV folds (
parser.add_argument('--cv_n', type=np.int, default=10, help='Number of CV cycles (default: %(default)s)')
parser.add_argument('--rankFeats', type=str, default='', help='Ranked features list to be used by Machine Learning [Feats name on 1st column, feats weights on 2nd column, with HEADER]')
parser.add_argument('--reliefk', type=np.int, default=3, help='Number of nearest neighbors for ReliefF (default: %(default)s)')
#parser.add_argument('--plot', action='store_true', help='Plot metric values over all training cycles' )
if len(sys.argv)==1:
parser.print_help()
......@@ -62,7 +61,6 @@ DATAFILE = args.DATAFILE
LABELSFILE = args.LABELSFILE
RANK_METHOD = args.RANK_METHOD
OUTDIR = args.OUTDIR
#plot_out = args.plot
random_labels = args.random
CV_K = args.cv_k
CV_N = args.cv_n
......@@ -96,8 +94,11 @@ TUN_CV_K = 10
TUN_CV_P = 50
sample_names, var_names, x = load_data(DATAFILE)
y = np.loadtxt(LABELSFILE, dtype=np.int)
#print(var_names[:10])
y_orig = np.loadtxt(LABELSFILE, dtype=np.int)
# encode labels
le = preprocessing.LabelEncoder()
y = le.fit_transform(y_orig)
# If ranked list is given as input to DAP, read it and extract features index
if RANK_METHOD == "rankList":
rankedList = np.loadtxt(RANKFEATS, delimiter='\t', dtype=str, skiprows=1)
......@@ -279,14 +280,3 @@ config.set("OUTPUT", "MCC", np.max(AMCC))
config.set("OUTPUT", "N_feats", opt_feats)
config.write(logf)
logf.close()
#if plot_out:
# from metrics_plot import *
# plt_title = (' ').join( [os.path.basename(DATAFILE).replace('.txt', ''), SVM_TYPE] )
# if random_labels:
# metplot(RLFile = (OUTFILE + "_metrics.txt"), title = plt_title)
# elif RANK_METHOD=='random':
# metplot(RRFile = (OUTFILE + "_metrics.txt"), title = plt_title)
# else:
# metplot(normFile = (OUTFILE + "_metrics.txt"), title = plt_title)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment