def synthetic_run_params(m, w, n, p, gamma, sigma_step, sigma, tol_cg,
                         MAXIT_cg, DENSITY, power):
    # Data LOAD
    X_train, y_train, X_test, y_test, w_true = gen_data.gen_data_SVM(
        m, n, p, DENSITY)

    m, N = np.shape(X_train)
    n = 2 * N + 1

    # form l1-SVM constraint matrix
    A, b, c = svm_func.formL1SVM(X_train, y_train)

    # IPM Standard
    t_stan_1 = time.time()
    x, y, s, iter_out_stan, iter_in_cg_vec_stan, kap_AD_vec, time_ls_stan = ipm_func.ipm_standard(
        m, n, A, b, c, tol_cg)
    t_stan_2 = time.time()
    # IPM Ours
    t_ipm_1 = time.time()
    x, y, s, iter_out_ipm, iter_in_cg_vec_ipm, kap_ADW_vec, v_vec, time_ls_ipm = ipm_func.ipm(
        m, n, w, A, b, c, tol_cg)
    t_ipm_2 = time.time()

    results = dict()
    results['ipm_time'] = t_ipm_2 - t_ipm_1
    results['stan_time'] = t_stan_2 - t_stan_1
    results['niter_out_stan'] = iter_out_stan
    results['niter__out_ipm'] = iter_out_ipm
    results['niter_inner_stan'] = iter_in_cg_vec_stan
    results['niter_inner_cg'] = iter_in_cg_vec_ipm
    results['inner_cg_vec'] = iter_in_cg_vec_stan
    results['kap_AD_vec'] = kap_AD_vec
    results['kap_ADW_vec'] = kap_ADW_vec
    results['v_vec'] = v_vec

    return results
Esempio n. 2
0
# Sketched IPM vs Standard IPM, 1 Run, number of iterations, condition number
#------------------------------------------------------------

directory = '/Users/grego/GitProjects/SketchIPM_python/ipm_figures'

#------------------------------------------------------------
if __name__ == '__main__':
    print('---------------------------', '\n')
    print('Test IPM SVM real or synthetic dataset, 1 Run', '\n')
    #------------------------------------------------------------

    #------------------------------------------------------------
    # Data LOAD
    t_data_1 = time.time()
    #X_train, y_train, X_test, y_test, w_true = gen_data.gen_data_1
    X_train, y_train, X_test, y_test, w_true = gen_data.gen_data_SVM(
        m, n, p, DENSITY)

    #X_train,y_train,X_test,y_test = load_real_data.load_ARCENE()
    #X_train,y_train,X_test,y_test = load_real_data.load_DEXTER()
    #X_train,y_train = load_real_data.load_DrivFace() # 606 x 6400
    #X_train,y_train,X_test,y_test = load_real_data.load_DOROTHEA() # (800 x 100k)

    t_data_2 = time.time()
    print('time data load    = ', t_data_2 - t_data_1, ' secs')

    data_desc = 's'  # s for synthetic
    #data_desc = 'ARCENE'
    print('data_desc    = ', data_desc)

    #------------------------------------------------------------
    # Parameters (for real data)