In [1]:
#import sys
#!{sys.executable} -m pip install --upgrade c-lasso 
from classo import *
import zarr
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy

Data

In [2]:
m,d,d_nonzero,k,sigma =150,100,5,1,0.5
(X,C,y),sol = random_data(m,d,d_nonzero,k,sigma,zerosum=False,seed=None)
plt.bar(range(len(sol)),sol)
plt.show()

np.arange(len(sol))[sol !=0.]
Out[2]:
array([29, 36, 40, 60, 81])

Problems

In [3]:
problem = classo_problem(X,y,C=C)
problem.model_selection.PATH = True
problem.model_selection.CV = True
problem.model_selection.StabSel = True
problem.model_selection.LAMfixed = True

problem1 = deepcopy(problem)
problem2 = deepcopy(problem)
problem3 = deepcopy(problem)

Path

In [4]:
param = problem1.model_selection.PATHparameters
param.numerical_method = ' '
param.n_active = 20
param.lambdas = np.linspace(1.,1e-3,50)
In [5]:
param = problem2.model_selection.PATHparameters
param.numerical_method = 'P-PDS'
param.n_active = 0
param.lambdas = np.linspace(1.,1e-1,50)
In [6]:
param = problem3.model_selection.PATHparameters
param.numerical_method = 'DR'
param.n_active = 0
param.lambdas = np.linspace(1.,1e-1,20)

Cross validation

In [7]:
param = problem1.model_selection.CVparameters
param.seed = None
param.numerical_method = ' '
param.Nsubset = 5
param.oneSE = True
param.lambdas = np.linspace(1.,1e-3,100)
In [8]:
param = problem2.model_selection.CVparameters
param.seed = None
param.numerical_method = ' '
param.Nsubset = 7
param.oneSE = False
param.lambdas = np.linspace(1.,1e-3,100)
In [9]:
param = problem3.model_selection.CVparameters
param.seed = 2
param.numerical_method = 'P-PDS'
param.Nsubset = 3
param.oneSE = True
param.lambdas = np.linspace(1.,1e-1,20)

Stability Selection

In [10]:
param = problem1.model_selection.StabSelparameters
param.seed = None
param.numerical_method = ' '
param.method = 'first'
param.B = 50
param.q = 10
param.percent_nS = 0.5
param.lamin = 0.01
param.hd = False
param.lam = 'theoretical'
param.true_lam = True
param.threshold = 0.7 
param.threshold_label = 0.2
In [11]:
param = problem2.model_selection.StabSelparameters
param.seed = None
param.numerical_method = ' '
param.method = 'max'
param.B = 70
param.q = 20
param.percent_nS = 0.8
param.lamin = 0.01
param.hd = False
param.lam = 'theoretical'
param.true_lam = True
param.threshold = 0.5 
param.threshold_label = 0.2
In [12]:
param = problem3.model_selection.StabSelparameters
param.seed = None
param.numerical_method = ' '
param.method = 'lam'
param.B = 50
param.q = 1000
param.percent_nS = 0.4
param.lamin = 1.
param.hd = False
param.lam = 'theoretical'
param.true_lam = True
param.threshold = 0.8
param.threshold_label = 0.2

Lambda fixed

In [13]:
param = problem1.model_selection.LAMfixedparameters
param.numerical_method = 'P-PDS'
param.lam = 'theoretical'
param.true_lam = True
In [14]:
param = problem2.model_selection.LAMfixedparameters
param.numerical_method = 'DR'
param.lam = 0.1
param.true_lam = False
In [15]:
param = problem3.model_selection.LAMfixedparameters
param.numerical_method = 'Path-Alg'
param.lam = 30.
param.true_lam = True

R1

In [16]:
problem1.formulation.concomitant = False
problem1.formulation.huber = False
problem1.formulation.classification = False

problem2.formulation.concomitant = False
problem2.formulation.huber = False
problem2.formulation.classification = False

problem3.formulation.concomitant = False
problem3.formulation.huber = False
problem3.formulation.classification = False
In [17]:
problem1.solve()
print(problem1)
problem1.solution.CV.graphic(ratio_mse_max = 10.)
print(problem1.solution)


problem2.solve()
print(problem2)
problem2.solution.CV.graphic(ratio_mse_max = 10.)
print(problem2.solution)


problem3.solve()
print(problem3)
problem3.solution.CV.graphic(ratio_mse_max = 10.)
print(problem3.solution)
 
 
FORMULATION: R1
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 5
     lamin = 0.001
     n_lam = 100
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = first
     lamin = 0.01
     lam = theoretical
     B = 50
     q = 10
     percent_nS = 0.5
     threshold = 0.7
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = theoretical
     theoretical_lam = 24.421
     numerical_method = P-PDS
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 20
     lamin = 0.001
     numerical_method = Path-Alg

SELECTED VARIABLES : 
29
36
40
60
81
Running time : 
Running time for Path computation    : 0.028s
Running time for Cross Validation    : 0.335s
Running time for Stability Selection : 0.771s
Running time for Fixed LAM           : 0.017s
 
 
FORMULATION: R1
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 7
     lamin = 0.001
     n_lam = 100
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = max
     lamin = 0.01
     lam = theoretical
     B = 70
     q = 20
     percent_nS = 0.8
     threshold = 0.5
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = 0.1
     theoretical_lam = 0.1628
     numerical_method = DR
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 0
     lamin = 0.1
     numerical_method = P-PDS

SELECTED VARIABLES : 
1
29
36
40
60
75
81
Running time : 
Running time for Path computation    : 0.005s
Running time for Cross Validation    : 0.552s
Running time for Stability Selection : 0.606s
Running time for Fixed LAM           : 0.092s
 
 
FORMULATION: R1
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 3
     lamin = 0.1
     n_lam = 20
     numerical_method = P-PDS
 
STABILITY SELECTION PARAMETERS: 
     method = lam
     lamin = 1.0
     lam = theoretical
     B = 50
     q = 1000
     percent_nS = 0.4
     threshold = 0.8
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = 30.0
     theoretical_lam = 24.421
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 20
     n_active = 0
     lamin = 0.1
     numerical_method = DR

SELECTED VARIABLES : 
29
36
40
60
81
Running time : 
Running time for Path computation    : 0.016s
Running time for Cross Validation    : 0.013s
Running time for Stability Selection : 0.531s
Running time for Fixed LAM           : 0.007s

Reset the numerical methods

In [18]:
problem1.model_selection.PATHparameters.numerical_method = ' '
problem2.model_selection.PATHparameters.numerical_method = 'P-PDS'
problem3.model_selection.PATHparameters.numerical_method = 'DR'

problem1.model_selection.CVparameters.numerical_method = ' '
problem2.model_selection.CVparameters.numerical_method = ' '
problem3.model_selection.CVparameters.numerical_method = 'P-PDS' 

problem1.model_selection.StabSelparameters.numerical_method = ' '
problem2.model_selection.StabSelparameters.numerical_method = ' '
problem3.model_selection.StabSelparameters.numerical_method = ' '

problem3.model_selection.StabSelparameters.lam = 'theoretical'

problem1.model_selection.LAMfixedparameters.numerical_method = 'P-PDS'
problem2.model_selection.LAMfixedparameters.numerical_method = 'DR'
problem3.model_selection.LAMfixedparameters.numerical_method = 'Path-Alg'

problem1.model_selection.LAMfixedparameters.lam = 'theoretical'

R2

In [19]:
problem1.formulation.concomitant = False
problem1.formulation.huber = True
problem1.formulation.classification = False

problem2.formulation.concomitant = False
problem2.formulation.huber = True
problem2.formulation.classification = False

problem3.formulation.concomitant = False
problem3.formulation.huber = True
problem3.formulation.classification = False
In [20]:
problem1.solve()
print(problem1)
problem1.solution.CV.graphic(ratio_mse_max = 10.)
print(problem1.solution)


problem2.solve()
print(problem2)
problem2.solution.CV.graphic(ratio_mse_max = 10.)
print(problem2.solution)


problem3.solve()
print(problem3)
problem3.solution.CV.graphic(ratio_mse_max = 10.)
print(problem3.solution)
 
 
FORMULATION: R2
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 5
     lamin = 0.001
     n_lam = 100
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = first
     lamin = 0.01
     lam = theoretical
     B = 50
     q = 10
     percent_nS = 0.5
     threshold = 0.7
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = theoretical
     theoretical_lam = 24.421
     numerical_method = P-PDS
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 20
     lamin = 0.001
     numerical_method = Path-Alg

SELECTED VARIABLES : 
29
36
40
60
81
Running time : 
Running time for Path computation    : 0.363s
Running time for Cross Validation    : 2.437s
Running time for Stability Selection : 6.408s
Running time for Fixed LAM           : 0.024s
 
 
FORMULATION: R2
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 7
     lamin = 0.001
     n_lam = 100
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = max
     lamin = 0.01
     lam = theoretical
     B = 70
     q = 20
     percent_nS = 0.8
     threshold = 0.5
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = 0.1
     theoretical_lam = 0.1628
     numerical_method = DR
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 0
     lamin = 0.1
     numerical_method = P-PDS

SELECTED VARIABLES : 
1
2
29
30
34
36
37
40
54
60
64
71
75
81
90
Running time : 
Running time for Path computation    : 3.222s
Running time for Cross Validation    : 3.855s
Running time for Stability Selection : 27.224s
Running time for Fixed LAM           : 0.164s
 
 
FORMULATION: R2
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 3
     lamin = 0.1
     n_lam = 20
     numerical_method = P-PDS
 
STABILITY SELECTION PARAMETERS: 
     method = lam
     lamin = 1.0
     lam = theoretical
     B = 50
     q = 1000
     percent_nS = 0.4
     threshold = 0.8
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = 30.0
     theoretical_lam = 24.421
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 20
     n_active = 0
     lamin = 0.1
     numerical_method = DR

SELECTED VARIABLES : 
29
36
40
60
81
Running time : 
Running time for Path computation    : 3.257s
Running time for Cross Validation    : 4.718s
Running time for Stability Selection : 6.958s
Running time for Fixed LAM           : 0.292s

Reset the numerical methods

In [21]:
problem1.model_selection.PATHparameters.numerical_method = ' '
problem2.model_selection.PATHparameters.numerical_method = 'P-PDS'
problem3.model_selection.PATHparameters.numerical_method = 'DR'

problem1.model_selection.CVparameters.numerical_method = ' '
problem2.model_selection.CVparameters.numerical_method = ' '
problem3.model_selection.CVparameters.numerical_method = 'P-PDS' 

problem1.model_selection.StabSelparameters.numerical_method = ' '
problem2.model_selection.StabSelparameters.numerical_method = ' '
problem3.model_selection.StabSelparameters.numerical_method = ' '

problem3.model_selection.StabSelparameters.lam = 'theoretical'

problem1.model_selection.LAMfixedparameters.numerical_method = 'P-PDS'
problem2.model_selection.LAMfixedparameters.numerical_method = 'DR'
problem3.model_selection.LAMfixedparameters.numerical_method = 'Path-Alg'

problem1.model_selection.LAMfixedparameters.lam = 'theoretical'


problem1.formulation.e = ' '
problem2.formulation.e = ' '
problem3.formulation.e = ' '

R3

In [22]:
problem1.formulation.concomitant = True
problem1.formulation.huber = False
problem1.formulation.classification = False

problem2.formulation.concomitant = True
problem2.formulation.huber = False
problem2.formulation.classification = False

problem3.formulation.concomitant = True
problem3.formulation.huber = False
problem3.formulation.classification = False
In [23]:
problem1.solve()
print(problem1)
problem1.solution.CV.graphic(ratio_mse_max = 10.)
print(problem1.solution)


problem2.solve()
print(problem2)
problem2.solution.CV.graphic(ratio_mse_max = 10.)
print(problem2.solution)


problem3.solve()
print(problem3)
problem3.solution.CV.graphic(ratio_mse_max = 10.)
print(problem3.solution)
 
 
FORMULATION: R3
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 5
     lamin = 0.001
     n_lam = 100
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = first
     lamin = 0.01
     lam = theoretical
     B = 50
     q = 10
     percent_nS = 0.5
     threshold = 0.7
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = theoretical
     theoretical_lam = 24.421
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 20
     lamin = 0.001
     numerical_method = Path-Alg

SELECTED VARIABLES : 
29
36
40
60
81
SIGMA FOR LAMFIXED  :  0.907654444633207
Running time : 
Running time for Path computation    : 0.033s
Running time for Cross Validation    : 0.622s
Running time for Stability Selection : 1.912s
Running time for Fixed LAM           : 0.02s
 
 
FORMULATION: R3
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 7
     lamin = 0.001
     n_lam = 100
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = max
     lamin = 0.01
     lam = theoretical
     B = 70
     q = 20
     percent_nS = 0.8
     threshold = 0.5
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = 0.1
     theoretical_lam = 0.1628
     numerical_method = DR
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 0
     lamin = 0.1
     numerical_method = Path-Alg

SELECTED VARIABLES : 
1
2
29
36
37
40
60
64
71
72
75
81
SIGMA FOR LAMFIXED  :  9.960823297909933
Running time : 
Running time for Path computation    : 0.043s
Running time for Cross Validation    : 0.884s
Running time for Stability Selection : 7.449s
Running time for Fixed LAM           : 0.566s
 
 
FORMULATION: R3
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 3
     lamin = 0.1
     n_lam = 20
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = lam
     lamin = 1.0
     lam = theoretical
     B = 50
     q = 1000
     percent_nS = 0.4
     threshold = 0.8
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = 30.0
     theoretical_lam = 24.421
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 20
     n_active = 0
     lamin = 0.1
     numerical_method = DR

SELECTED VARIABLES : 
29
36
40
60
81
SIGMA FOR LAMFIXED  :  0.9784268177945492
Running time : 
Running time for Path computation    : 2.901s
Running time for Cross Validation    : 0.177s
Running time for Stability Selection : 0.994s
Running time for Fixed LAM           : 0.012s

Reset the numerical methods

In [24]:
problem1.model_selection.PATHparameters.numerical_method = ' '
problem2.model_selection.PATHparameters.numerical_method = 'P-PDS'
problem3.model_selection.PATHparameters.numerical_method = 'DR'

problem1.model_selection.CVparameters.numerical_method = ' '
problem2.model_selection.CVparameters.numerical_method = ' '
problem3.model_selection.CVparameters.numerical_method = 'P-PDS' 

problem1.model_selection.StabSelparameters.numerical_method = ' '
problem2.model_selection.StabSelparameters.numerical_method = ' '
problem3.model_selection.StabSelparameters.numerical_method = ' '

problem3.model_selection.StabSelparameters.lam = 'theoretical'

problem1.model_selection.LAMfixedparameters.numerical_method = 'P-PDS'
problem2.model_selection.LAMfixedparameters.numerical_method = 'DR'
problem3.model_selection.LAMfixedparameters.numerical_method = 'Path-Alg'

problem1.model_selection.LAMfixedparameters.lam = 'theoretical'

problem1.formulation.e = ' '
problem2.formulation.e = ' '
problem3.formulation.e = ' '

R4

In [25]:
problem1.formulation.concomitant = True
problem1.formulation.huber = True
problem1.formulation.classification = False

problem2.formulation.concomitant = True
problem2.formulation.huber = True
problem2.formulation.classification = False

problem3.formulation.concomitant = True
problem3.formulation.huber = True
problem3.formulation.classification = False
In [26]:
problem1.solve()
print(problem1)
problem1.solution.CV.graphic(ratio_mse_max = 10.)
print(problem1.solution)


problem2.solve()
print(problem2)
problem2.solution.CV.graphic(ratio_mse_max = 10.)
print(problem2.solution)


problem3.solve()
print(problem3)
problem3.solution.CV.graphic(ratio_mse_max = 10.)
print(problem3.solution)
 
 
FORMULATION: R4
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 5
     lamin = 0.001
     n_lam = 100
     numerical_method = DR
 
STABILITY SELECTION PARAMETERS: 
     method = first
     lamin = 0.01
     lam = theoretical
     B = 50
     q = 10
     percent_nS = 0.5
     threshold = 0.7
     numerical_method = DR
 
LAMBDA FIXED PARAMETERS: 
     lam = theoretical
     theoretical_lam = 24.421
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 20
     lamin = 0.001
     numerical_method = DR

SELECTED VARIABLES : 
29
36
40
60
81
SIGMA FOR LAMFIXED  :  0.3214780436670166
Running time : 
Running time for Path computation    : 46.13s
Running time for Cross Validation    : 190.437s
Running time for Stability Selection : 2889.108s
Running time for Fixed LAM           : 0.164s
 
 
FORMULATION: R4
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 7
     lamin = 0.001
     n_lam = 100
     numerical_method = DR
 
STABILITY SELECTION PARAMETERS: 
     method = max
     lamin = 0.01
     lam = theoretical
     B = 70
     q = 20
     percent_nS = 0.8
     threshold = 0.5
     numerical_method = DR
 
LAMBDA FIXED PARAMETERS: 
     lam = 0.1
     theoretical_lam = 0.1628
     numerical_method = DR
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 0
     lamin = 0.1
     numerical_method = DR

SELECTED VARIABLES : 
1
2
29
32
36
37
40
60
64
71
75
81
90
SIGMA FOR LAMFIXED  :  7.18349409243879
Running time : 
Running time for Path computation    : 39.519s
Running time for Cross Validation    : 270.306s
Running time for Stability Selection : 2552.493s
Running time for Fixed LAM           : 8.246s
 
 
FORMULATION: R4
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 3
     lamin = 0.1
     n_lam = 20
     numerical_method = DR
 
STABILITY SELECTION PARAMETERS: 
     method = lam
     lamin = 1.0
     lam = theoretical
     B = 50
     q = 1000
     percent_nS = 0.4
     threshold = 0.8
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = 30.0
     theoretical_lam = 24.421
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 20
     n_active = 0
     lamin = 0.1
     numerical_method = DR

SELECTED VARIABLES : 
1
29
36
40
60
75
81
SIGMA FOR LAMFIXED  :  0.36048440917923075
Running time : 
Running time for Path computation    : 39.854s
Running time for Cross Validation    : 97.018s
Running time for Stability Selection : 5.145s
Running time for Fixed LAM           : 0.156s

Reset the numerical methods

In [27]:
problem1.model_selection.PATHparameters.numerical_method = ' '
problem2.model_selection.PATHparameters.numerical_method = 'P-PDS'
problem3.model_selection.PATHparameters.numerical_method = 'DR'

problem1.model_selection.CVparameters.numerical_method = ' '
problem2.model_selection.CVparameters.numerical_method = ' '
problem3.model_selection.CVparameters.numerical_method = 'P-PDS' 

problem1.model_selection.StabSelparameters.numerical_method = ' '
problem2.model_selection.StabSelparameters.numerical_method = ' '
problem3.model_selection.StabSelparameters.numerical_method = ' '

problem3.model_selection.StabSelparameters.lam = 'theoretical'

problem1.model_selection.LAMfixedparameters.numerical_method = 'P-PDS'
problem2.model_selection.LAMfixedparameters.numerical_method = 'DR'
problem3.model_selection.LAMfixedparameters.numerical_method = 'Path-Alg'

problem1.model_selection.LAMfixedparameters.lam = 'theoretical'

C1

In [28]:
problem1.formulation.concomitant = False
problem1.formulation.huber = False
problem1.formulation.classification = True
problem1.data.y = np.sign(problem1.data.y)

problem2.formulation.concomitant = False
problem2.formulation.huber = False
problem2.formulation.classification = True
problem2.data.y = np.sign(problem2.data.y)

problem3.formulation.concomitant = False
problem3.formulation.huber = False
problem3.formulation.classification = True
problem3.data.y = np.sign(problem3.data.y)
In [29]:
problem1.solve()
print(problem1)
problem1.solution.CV.graphic(ratio_mse_max = 10.)
print(problem1.solution)


problem2.solve()
print(problem2)
problem2.solution.CV.graphic(ratio_mse_max = 10.)
print(problem2.solution)


problem3.solve()
print(problem3)
problem3.solution.CV.graphic(ratio_mse_max = 10.)
print(problem3.solution)
 
 
FORMULATION: C1
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 5
     lamin = 0.001
     n_lam = 100
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = first
     lamin = 0.01
     lam = theoretical
     B = 50
     q = 10
     percent_nS = 0.5
     threshold = 0.7
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = theoretical
     theoretical_lam = 24.421
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 20
     lamin = 0.001
     numerical_method = Path-Alg

SELECTED VARIABLES : 
29
36
81
Running time : 
Running time for Path computation    : 0.048s
Running time for Cross Validation    : 2.603s
Running time for Stability Selection : 1.389s
Running time for Fixed LAM           : 0.048s
 
 
FORMULATION: C1
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 7
     lamin = 0.001
     n_lam = 100
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = max
     lamin = 0.01
     lam = theoretical
     B = 70
     q = 20
     percent_nS = 0.8
     threshold = 0.5
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = 0.1
     theoretical_lam = 0.1628
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 0
     lamin = 0.1
     numerical_method = Path-Alg

SELECTED VARIABLES : 
29
34
50
72
77
Running time : 
Running time for Path computation    : 0.063s
Running time for Cross Validation    : 2.987s
Running time for Stability Selection : 23.01s
Running time for Fixed LAM           : 0.062s
 
 
FORMULATION: C1
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 3
     lamin = 0.1
     n_lam = 20
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = lam
     lamin = 1.0
     lam = theoretical
     B = 50
     q = 1000
     percent_nS = 0.4
     threshold = 0.8
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = 30.0
     theoretical_lam = 24.421
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 20
     n_active = 0
     lamin = 0.1
     numerical_method = Path-Alg

SELECTED VARIABLES : 
29
36
40
81
Running time : 
Running time for Path computation    : 0.083s
Running time for Cross Validation    : 0.238s
Running time for Stability Selection : 1.14s
Running time for Fixed LAM           : 0.03s

Reset the numerical methods

In [30]:
problem1.model_selection.PATHparameters.numerical_method = ' '
problem2.model_selection.PATHparameters.numerical_method = 'P-PDS'
problem3.model_selection.PATHparameters.numerical_method = 'DR'

problem1.model_selection.CVparameters.numerical_method = ' '
problem2.model_selection.CVparameters.numerical_method = ' '
problem3.model_selection.CVparameters.numerical_method = 'P-PDS' 

problem1.model_selection.StabSelparameters.numerical_method = ' '
problem2.model_selection.StabSelparameters.numerical_method = ' '
problem3.model_selection.StabSelparameters.numerical_method = ' '

problem3.model_selection.StabSelparameters.lam = 'theoretical'

problem1.model_selection.LAMfixedparameters.numerical_method = 'P-PDS'
problem2.model_selection.LAMfixedparameters.numerical_method = 'DR'
problem3.model_selection.LAMfixedparameters.numerical_method = 'Path-Alg'

problem1.model_selection.LAMfixedparameters.lam = 'theoretical'

C2

In [31]:
problem1.formulation.concomitant = False
problem1.formulation.huber = True
problem1.formulation.classification = True

problem2.formulation.concomitant = False
problem2.formulation.huber = True
problem2.formulation.classification = True

problem3.formulation.concomitant = False
problem3.formulation.huber = True
problem3.formulation.classification = True
In [32]:
problem1.solve()
print(problem1)
problem1.solution.CV.graphic(ratio_mse_max = 10.)
print(problem1.solution)


problem2.solve()
print(problem2)
problem2.solution.CV.graphic(ratio_mse_max = 10.)
print(problem2.solution)


problem3.solve()
print(problem3)
problem3.solution.CV.graphic(ratio_mse_max = 10.)
print(problem3.solution)
 
 
FORMULATION: C2
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 5
     lamin = 0.001
     n_lam = 100
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = first
     lamin = 0.01
     lam = theoretical
     B = 50
     q = 10
     percent_nS = 0.5
     threshold = 0.7
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = theoretical
     theoretical_lam = 24.421
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 20
     lamin = 0.001
     numerical_method = Path-Alg

SELECTED VARIABLES : 
29
36
81
Running time : 
Running time for Path computation    : 0.129s
Running time for Cross Validation    : 3.761s
Running time for Stability Selection : 2.539s
Running time for Fixed LAM           : 0.084s
 
 
FORMULATION: C2
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 7
     lamin = 0.001
     n_lam = 100
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = max
     lamin = 0.01
     lam = theoretical
     B = 70
     q = 20
     percent_nS = 0.8
     threshold = 0.5
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = 0.1
     theoretical_lam = 0.1628
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 50
     n_active = 0
     lamin = 0.1
     numerical_method = Path-Alg

SELECTED VARIABLES : 
34
40
54
62
Running time : 
Running time for Path computation    : 0.127s
Running time for Cross Validation    : 5.811s
Running time for Stability Selection : 39.56s
Running time for Fixed LAM           : 0.163s
 
 
FORMULATION: C2
 
MODEL SELECTION COMPUTED:  
     Path
     Cross Validation
     Stability selection
     Lambda fixed
 
CROSS VALIDATION PARAMETERS: 
     Nsubset = 3
     lamin = 0.1
     n_lam = 20
     numerical_method = Path-Alg
 
STABILITY SELECTION PARAMETERS: 
     method = lam
     lamin = 1.0
     lam = theoretical
     B = 50
     q = 1000
     percent_nS = 0.4
     threshold = 0.8
     numerical_method = Path-Alg
 
LAMBDA FIXED PARAMETERS: 
     lam = 30.0
     theoretical_lam = 24.421
     numerical_method = Path-Alg
 
PATH PARAMETERS: 
     Npath = 20
     n_active = 0
     lamin = 0.1
     numerical_method = Path-Alg

SELECTED VARIABLES : 
29
36
40
60
81
Running time : 
Running time for Path computation    : 0.107s
Running time for Cross Validation    : 0.358s
Running time for Stability Selection : 2.375s
Running time for Fixed LAM           : 0.081s