import json import random import numpy as np from src.utils2 import c_ex as c, get_path import src.dataloaders as d from src.logistic import fit_logistic_regression path = get_path(__file__) + '/..' D = d.trainingset_extended() Dt = d.testset_extended() cols = c('sde5', 'v11', 'e9') a = range(D.shape[0]) random.shuffle(a) X = D[:, cols] X = X[a[:320000], :] y = D[a[:320000], c('isalert')] y = y.astype(int)^1 Xt = D[:, cols] Xt = Xt[a[320000:], :] yt = D[a[320000:], c('isalert')] yt = yt.astype(int)^1 num_tests = 1
import json from src.utils2 import get_path root = get_path(__file__) + "/../.." with open(root + "/sessions/18-forward-selection/data/forward-selection-results-2-for-docs.json") as f: data = json.load(f) num_rows = len(data["labels_chosen"]) columns_change = int(num_rows / 2) def print_table_header(): print r"\begin{minipage}[t]{50mm}" print r"\vspace{0pt}" print r"\begin{tabularx}{50mm}{ l R }" print r"Feature added & AUC \\\hline" def print_table_footer(): print r"\end{tabularx}" print r"\end{minipage}" print_table_header() for i, feature in enumerate(data["labels_chosen"]): if i == columns_change: print r"{\itshape continues ...} & " print_table_footer()
import json from src.utils2 import get_path root = get_path(__file__) + '/../..' with open(root+'/sessions/18-forward-selection/data/forward-selection-results-2-for-docs.json') as f: data = json.load(f) def print_table_header(): print r'\begin{tabularx}{40mm}{ l R }' print r'Feature added & AUC \\\hline' def print_table_footer(): print r'\end{tabularx}' features = data['labels_chosen'][:5] + data['labels_chosen'][-2:] aucs = data['max_auc'][:5] + data['max_auc'][-2:] print_table_header() for i, feature in enumerate(features): print r'%s & %.04f \\' % (feature, aucs[i]) if i==4: print r'$\vdots$ & $\vdots$ \\' print_table_footer()