Achieving Generalization

Testing and cross-validation

Train-test split


In [1]:
import pandas as pd
from sklearn.datasets import load_boston
boston = load_boston() 
dataset = pd.DataFrame(boston.data, columns=boston.feature_names)
dataset['target'] = boston.target
observations = len(dataset)
variables = dataset.columns[:-1]
X = dataset.ix[:,:-1]
y = dataset['target'].values

In [2]:
from sklearn.cross_validation import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.30, random_state=101)
print ("Train dataset sample size: %i" % len(X_train))
print ("Test dataset sample size: %i" % len(X_test))


Train dataset sample size: 354
Test dataset sample size: 152

In [3]:
X_train, X_out_sample, y_train, y_out_sample = train_test_split(X, y, test_size=0.40, random_state=101)
X_validation, X_test, y_validation, y_test = train_test_split(X_out_sample, y_out_sample, test_size=0.50, random_state=101)
print ("Train dataset sample size: %i" % len(X_train))
print ("Validation dataset sample size: %i" % len(X_validation))
print ("Test dataset sample size: %i" % len(X_test))


Train dataset sample size: 303
Validation dataset sample size: 101
Test dataset sample size: 102

Cross validation


In [4]:
from sklearn.cross_validation import cross_val_score, KFold, StratifiedKFold
from sklearn.metrics import make_scorer
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
import numpy as np

def RMSE(y_true, y_pred):
    return np.sum((y_true -y_pred)**2)

lm = LinearRegression()
cv_iterator = KFold(n=len(X), n_folds=10, shuffle=True, random_state=101)

edges = np.histogram(y, bins=5)[1]
binning = np.digitize(y, edges)
stratified_cv_iterator = StratifiedKFold(binning, n_folds=10, shuffle=True, random_state=101)

second_order=PolynomialFeatures(degree=2, interaction_only=False)
third_order=PolynomialFeatures(degree=3, interaction_only=True)

over_param_X = second_order.fit_transform(X)
extra_over_param_X = third_order.fit_transform(X)
cv_score = cross_val_score(lm, over_param_X, y, cv=cv_iterator, scoring='mean_squared_error', n_jobs=1)

In [5]:
print (cv_score)


[-12.8000684  -22.90015303  -9.22630415 -16.02192008 -11.66012284
  -8.97715779 -12.8285135  -18.1867082  -35.08897165 -14.23988285]

In [6]:
print ('Cv score: mean %0.3f std %0.3f' % (np.mean(np.abs(cv_score)), np.std(cv_score)))


Cv score: mean 16.193 std 7.442

In [7]:
cv_score = cross_val_score(lm, over_param_X, y, cv=stratified_cv_iterator, scoring='mean_squared_error', n_jobs=1)
print ('Cv score: mean %0.3f std %0.3f' % (np.mean(np.abs(cv_score)), np.std(cv_score)))


Cv score: mean 16.404 std 8.003

Valid options are ['accuracy', 'adjusted_rand_score', 'average_precision', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', 'log_loss', 'mean_absolute_error', 'mean_squared_error', 'median_absolute_error', 'precision', 'precision_macro', 'precision_micro', 'precision_samples', 'precision_weighted', 'r2', 'recall', 'recall_macro', 'recall_micro', 'recall_samples', 'recall_weighted', 'roc_auc'

Bootstrapping


In [8]:
import random
def Bootstrap(n, n_iter=3, random_state=None):
    """
    Random sampling with replacement cross-validation generator.
    For each iter a sample bootstrap of the indexes [0, n) is
    generated and the function returns the obtained sample
    and a list of all the excluded indexes.
    """
    if random_state:
        random.seed(random_state)
    for j in range(n_iter):
        bs = [random.randint(0, n-1) for i in range(n)]
        out_bs = list({i for i in range(n)} - set(bs))
        yield bs, out_bs
        
boot = Bootstrap(n=10, n_iter=5, random_state=101)
for train_idx, validation_idx in boot:
    print (train_idx, validation_idx)


[9, 3, 8, 5, 7, 0, 8, 3, 9, 3] [1, 2, 4, 6]
[4, 7, 3, 5, 7, 1, 4, 3, 2, 1] [0, 8, 9, 6]
[7, 8, 5, 3, 7, 5, 3, 6, 6, 3] [0, 1, 2, 9, 4]
[1, 6, 7, 4, 3, 1, 9, 5, 4, 6] [0, 8, 2]
[6, 3, 6, 1, 6, 6, 0, 7, 3, 8] [9, 2, 4, 5]

In [9]:
import numpy as np
boot = Bootstrap(n=len(X), n_iter=10, random_state=101)
lm = LinearRegression()
bootstrapped_coef = np.zeros((10,13))
for k, (train_idx, validation_idx) in enumerate(boot):
    lm.fit(X.ix[train_idx,:],y[train_idx])
    bootstrapped_coef[k,:] = lm.coef_

In [10]:
print(bootstrapped_coef[:,10])


[-1.04150741 -0.93651754 -1.09205904 -1.10422447 -0.9982515  -0.79789273
 -0.89421685 -0.92320895 -1.0276369  -0.79189224]

In [11]:
print(bootstrapped_coef[:,6])


[-0.01930727  0.00053026 -0.00026774  0.00607945  0.02225979 -0.00089469
  0.01922754  0.02164681  0.01243348 -0.02693115]

Greedy selection of features

Controlling for over-parameterization


In [12]:
from sklearn.metrics import mean_squared_error
from sklearn.linear_model import LinearRegression
from sklearn.cross_validation import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.30, random_state=3)
lm = LinearRegression()
lm.fit(X_train,y_train)
print ('Train (cases, features) = %s' % str(X_train.shape))
print ('Test  (cases, features) = %s' % str(X_test.shape))
print ('In-sample  mean squared error %0.3f' % mean_squared_error(y_train,lm.predict(X_train)))
print ('Out-sample mean squared error %0.3f' % mean_squared_error(y_test,lm.predict(X_test)))


Train (cases, features) = (354, 13)
Test  (cases, features) = (152, 13)
In-sample  mean squared error 22.420
Out-sample mean squared error 22.440

In [13]:
from sklearn.preprocessing import PolynomialFeatures
second_order=PolynomialFeatures(degree=2, interaction_only=False)
third_order=PolynomialFeatures(degree=3, interaction_only=True)

In [14]:
lm.fit(second_order.fit_transform(X_train),y_train)
print ('(cases, features) = %s' % str(second_order.fit_transform(X_train).shape))
print ('In-sample  mean squared error %0.3f' % mean_squared_error(y_train,lm.predict(second_order.fit_transform(X_train))))
print ('Out-sample mean squared error %0.3f' % mean_squared_error(y_test,lm.predict(second_order.fit_transform(X_test))))


(cases, features) = (354, 105)
In-sample  mean squared error 14.599
Out-sample mean squared error 29.197

In [15]:
lm.fit(third_order.fit_transform(X_train),y_train)
print ('(cases, features) = %s' % str(third_order.fit_transform(X_train).shape))
print ('In-sample  mean squared error %0.3f' % mean_squared_error(y_train,lm.predict(third_order.fit_transform(X_train))))
print ('Out-sample mean squared error %0.3f' % mean_squared_error(y_test,lm.predict(third_order.fit_transform(X_test))))


(cases, features) = (354, 378)
In-sample  mean squared error 0.438
Out-sample mean squared error 85784.749

Madelon dataset


In [16]:
try:
    import urllib.request as urllib2 
except:
    import urllib2 
import numpy as np
train_data = 'https://archive.ics.uci.edu/ml/machine-learning-databases/madelon/MADELON/madelon_train.data'
validation_data = 'https://archive.ics.uci.edu/ml/machine-learning-databases/madelon/MADELON/madelon_valid.data'
train_response = 'https://archive.ics.uci.edu/ml/machine-learning-databases/madelon/MADELON/madelon_train.labels'
validation_response = 'https://archive.ics.uci.edu/ml/machine-learning-databases/madelon/madelon_valid.labels'
try:
    Xt = np.loadtxt(urllib2.urlopen(train_data))
    yt = np.loadtxt(urllib2.urlopen(train_response))
    Xv = np.loadtxt(urllib2.urlopen(validation_data))
    yv = np.loadtxt(urllib2.urlopen(validation_response))
except:
    # In case downloading the data doesn't works, 
    # just manually download the files into the working directory
    Xt = np.loadtxt('madelon_train.data')
    yt = np.loadtxt('madelon_train.labels')
    Xv = np.loadtxt('madelon_valid.data')
    yv = np.loadtxt('madelon_valid.labels')

In [17]:
print ('Training set: %i observations %i feature' % (Xt.shape))
print ('Validation set: %i observations %i feature' % (Xv.shape))


Training set: 2000 observations 500 feature
Validation set: 600 observations 500 feature

In [18]:
from scipy.stats import describe
print (describe(Xt))


DescribeResult(nobs=2000, minmax=(array([ 462.,  381.,  370.,  453.,  371.,  459.,  334.,  471.,  430.,
        455.,  354.,  389.,  347.,  352.,  444.,  410.,  433.,  377.,
        408.,  441.,  426.,  412.,  456.,  438.,  343.,  416.,  421.,
        441.,  438.,  417.,  451.,  382.,  369.,  363.,  384.,  342.,
        441.,  396.,  464.,  471.,  463.,  362.,  392.,  438.,  406.,
        392.,  371.,  373.,  367.,  382.,  381.,  382.,  399.,  465.,
        401.,  409.,  288.,  377.,  378.,  408.,  400.,  462.,  377.,
        458.,  214.,  385.,  373.,  395.,  462.,  452.,  362.,  427.,
        402.,  354.,  456.,  371.,  446.,  396.,  379.,  424.,  415.,
        385.,  396.,  430.,  372.,  391.,  458.,  406.,  454.,  377.,
        474.,  395.,  399.,  438.,  452.,  384.,  468.,  406.,  412.,
        355.,  448.,  448.,  460.,  428.,  361.,    0.,  349.,  370.,
        391.,  442.,  392.,  356.,  450.,  385.,  353.,  413.,  418.,
        441.,  389.,  414.,  469.,  380.,  437.,  355.,  406.,  389.,
        440.,  387.,  435.,  347.,  401.,  420.,  402.,  461.,  403.,
        382.,  369.,  425.,  461.,  430.,  427.,  376.,  443.,  452.,
        421.,  398.,  468.,  369.,  462.,  343.,  325.,  447.,  437.,
        182.,  472.,  398.,  406.,  382.,  419.,  400.,  379.,  443.,
        438.,  458.,  335.,  414.,  471.,  466.,  473.,  369.,  350.,
        375.,  380.,  473.,  414.,  368.,  446.,  457.,  347.,  378.,
        381.,  393.,  397.,  387.,  438.,  407.,  362.,  383.,  327.,
        457.,  372.,  400.,  428.,  359.,  350.,  451.,  461.,  449.,
        472.,  393.,  417.,  409.,  430.,  332.,  376.,  471.,  374.,
        466.,  427.,  423.,  444.,  374.,  402.,  358.,  443.,  358.,
        403.,  449.,  396.,  450.,  381.,  350.,  399.,  364.,  360.,
        408.,  409.,  470.,  473.,  412.,  427.,  420.,  430.,  422.,
        427.,  420.,  430.,  468.,  410.,  458.,  385.,  333.,  402.,
        430.,  371.,  394.,  343.,  468.,  453.,  401.,  383.,  379.,
        464.,  395.,  453.,  389.,  350.,  330.,  455.,  447.,  419.,
        461.,  432.,  355.,  450.,  425.,  332.,  431.,  393.,  421.,
        440.,  369.,  318.,  354.,  423.,  442.,  474.,  387.,  394.,
        387.,  473.,  317.,  420.,  472.,  374.,  363.,  361.,  342.,
        465.,  420.,  386.,  399.,  427.,  455.,  325.,  385.,  394.,
        372.,  406.,  421.,  345.,  433.,  463.,  422.,  378.,  378.,
        436.,  450.,  415.,  347.,  401.,  414.,  392.,  390.,  445.,
        385.,  448.,  457.,  346.,  338.,  440.,  373.,  426.,  438.,
        424.,  462.,  385.,  389.,  444.,  395.,  368.,  437.,  473.,
        383.,  352.,  447.,  180.,  356.,  207.,  368.,  383.,  401.,
        389.,  407.,  358.,  452.,  457.,  327.,  409.,  398.,  453.,
        347.,  351.,  436.,  431.,  420.,  366.,  471.,  392.,  359.,
        368.,  416.,  293.,  410.,  459.,  361.,  407.,  447.,  440.,
        367.,  374.,  342.,  421.,  391.,  406.,  381.,  456.,  410.,
        347.,  361.,  462.,  404.,  383.,  441.,  424.,  442.,  404.,
        471.,  424.,  344.,  459.,  350.,  468.,  377.,  469.,  407.,
        454.,  346.,  347.,  461.,  461.,  381.,  471.,  387.,  474.,
        368.,  354.,  459.,  381.,  451.,  419.,  369.,  378.,  426.,
        398.,  385.,  448.,  375.,  361.,  387.,  461.,  427.,  443.,
        474.,  445.,  436.,  435.,  362.,  362.,  463.,  398.,  404.,
        383.,  263.,  418.,  363.,  436.,  393.,  368.,  452.,  349.,
        417.,  207.,  345.,  433.,  472.,  435.,  449.,  343.,  435.,
        433.,  450.,  417.,   84.,  460.,  265.,  461.,  384.,  350.,
        383.,  376.,  403.,  379.,  347.,  424.,  426.,  452.,  364.,
        408.,  333.,  398.,  464.,  347.,  472.,  455.,  276.,  428.,
        423.,  347.,  450.,  418.,  391.,  439.,  375.,  376.,  444.,
        444.,  355.,  411.,  449.,  407.,  463.,  391.,  130.,  368.,
        398.,  457.,  435.,  363.,  403.]), array([ 503.,  600.,  654.,  519.,  688.,  505.,  611.,  481.,  536.,
        503.,  620.,  603.,  593.,  632.,  523.,  551.,  523.,  601.,
        566.,  513.,  526.,  571.,  499.,  516.,  653.,  597.,  573.,
        528.,  520.,  573.,  510.,  628.,  668.,  637.,  557.,  619.,
        517.,  564.,  496.,  482.,  487.,  643.,  568.,  548.,  602.,
        557.,  641.,  619.,  614.,  571.,  658.,  641.,  577.,  498.,
        598.,  561.,  644.,  617.,  675.,  554.,  558.,  504.,  641.,
        505.,  768.,  647.,  641.,  569.,  498.,  501.,  668.,  537.,
        568.,  629.,  508.,  651.,  513.,  581.,  640.,  551.,  584.,
        674.,  613.,  534.,  647.,  587.,  494.,  567.,  507.,  654.,
        478.,  612.,  551.,  557.,  508.,  622.,  492.,  554.,  545.,
        603.,  510.,  510.,  506.,  533.,  645.,  999.,  577.,  608.,
        608.,  518.,  610.,  630.,  506.,  586.,  617.,  545.,  564.,
        522.,  592.,  577.,  485.,  574.,  518.,  615.,  553.,  612.,
        530.,  574.,  516.,  613.,  618.,  588.,  558.,  491.,  562.,
        651.,  648.,  555.,  503.,  535.,  566.,  641.,  524.,  525.,
        549.,  563.,  495.,  624.,  497.,  618.,  612.,  529.,  517.,
        814.,  481.,  583.,  554.,  573.,  589.,  602.,  563.,  521.,
        518.,  500.,  661.,  579.,  481.,  493.,  481.,  668.,  639.,
        637.,  633.,  481.,  524.,  616.,  527.,  504.,  620.,  654.,
        625.,  664.,  593.,  571.,  542.,  575.,  631.,  591.,  673.,
        498.,  560.,  611.,  559.,  661.,  680.,  516.,  502.,  512.,
        481.,  609.,  558.,  557.,  564.,  647.,  625.,  481.,  641.,
        493.,  542.,  562.,  542.,  649.,  574.,  611.,  523.,  639.,
        630.,  520.,  585.,  524.,  589.,  649.,  599.,  636.,  628.,
        601.,  553.,  485.,  479.,  556.,  535.,  568.,  530.,  565.,
        564.,  583.,  529.,  488.,  542.,  499.,  603.,  653.,  601.,
        530.,  642.,  626.,  592.,  492.,  515.,  584.,  586.,  590.,
        493.,  643.,  506.,  628.,  688.,  647.,  520.,  527.,  551.,
        502.,  560.,  610.,  513.,  571.,  632.,  554.,  605.,  590.,
        529.,  639.,  613.,  692.,  531.,  529.,  478.,  613.,  576.,
        593.,  482.,  646.,  536.,  481.,  609.,  619.,  571.,  653.,
        495.,  561.,  583.,  605.,  574.,  499.,  650.,  614.,  561.,
        679.,  578.,  563.,  597.,  536.,  492.,  576.,  602.,  571.,
        530.,  512.,  606.,  568.,  577.,  548.,  634.,  605.,  520.,
        621.,  510.,  506.,  607.,  650.,  525.,  571.,  564.,  524.,
        556.,  498.,  564.,  591.,  526.,  658.,  605.,  522.,  480.,
        586.,  632.,  529.,  828.,  626.,  829.,  643.,  643.,  584.,
        606.,  628.,  678.,  512.,  507.,  634.,  566.,  620.,  507.,
        624.,  619.,  525.,  561.,  545.,  667.,  482.,  621.,  651.,
        597.,  561.,  638.,  573.,  501.,  642.,  582.,  527.,  529.,
        650.,  622.,  645.,  570.,  567.,  599.,  594.,  507.,  560.,
        661.,  630.,  502.,  569.,  653.,  532.,  548.,  514.,  581.,
        485.,  561.,  619.,  496.,  626.,  487.,  600.,  490.,  548.,
        522.,  616.,  648.,  504.,  491.,  606.,  480.,  579.,  479.,
        593.,  598.,  492.,  601.,  500.,  562.,  645.,  602.,  547.,
        617.,  721.,  531.,  634.,  657.,  635.,  500.,  530.,  518.,
        478.,  526.,  542.,  556.,  633.,  593.,  494.,  568.,  604.,
        584.,  719.,  558.,  657.,  517.,  653.,  603.,  521.,  626.,
        542.,  794.,  651.,  575.,  483.,  517.,  532.,  631.,  510.,
        536.,  505.,  569.,  807.,  500.,  735.,  501.,  586.,  650.,
        592.,  639.,  560.,  625.,  615.,  547.,  566.,  510.,  670.,
        540.,  633.,  666.,  493.,  621.,  484.,  506.,  680.,  535.,
        548.,  630.,  528.,  554.,  587.,  509.,  623.,  619.,  523.,
        512.,  618.,  606.,  513.,  549.,  497.,  566.,  920.,  615.,
        661.,  500.,  535.,  644.,  583.])), mean=array([ 481.7225,  483.4525,  510.166 ,  483.3845,  501.6125,  479.259 ,
        480.1095,  476.565 ,  486.7935,  478.789 ,  486.5175,  490.6535,
        478.1645,  481.5245,  485.0385,  479.4235,  479.287 ,  494.9475,
        484.173 ,  477.427 ,  484.7145,  494.239 ,  476.573 ,  479.2605,
        499.4075,  504.719 ,  484.7835,  482.0995,  480.5975,  491.9145,
        481.9315,  500.037 ,  500.6095,  489.5455,  486.713 ,  489.128 ,
        479.046 ,  480.67  ,  479.8   ,  476.153 ,  476.4925,  489.484 ,
        476.566 ,  487.8925,  500.304 ,  480.439 ,  496.6275,  494.7715,
        485.0005,  479.5405,  517.853 ,  505.752 ,  485.356 ,  480.0735,
        497.1905,  495.199 ,  479.694 ,  484.8665,  509.3415,  477.958 ,
        487.8915,  481.494 ,  494.046 ,  478.842 ,  497.9675,  510.147 ,
        503.78  ,  490.034 ,  480.947 ,  476.239 ,  514.45  ,  488.665 ,
        481.6865,  484.1835,  480.5825,  501.8625,  478.6855,  483.38  ,
        513.136 ,  482.684 ,  490.3455,  511.958 ,  483.933 ,  482.126 ,
        504.2045,  489.4665,  477.116 ,  483.074 ,  479.275 ,  512.0915,
        476.046 ,  508.1215,  479.3155,  492.583 ,  480.407 ,  497.4185,
        479.262 ,  478.9505,  476.9515,  480.3495,  479.9765,  480.666 ,
        481.1645,  477.7095,  483.968 ,  502.088 ,  484.469 ,  490.4405,
        499.5235,  480.871 ,  488.2285,  478.0985,  477.3175,  492.1145,
        478.242 ,  478.8695,  489.2055,  483.115 ,  496.691 ,  488.6225,
        476.114 ,  479.278 ,  480.853 ,  481.369 ,  478.5475,  504.4605,
        483.387 ,  499.286 ,  479.121 ,  483.6795,  500.1915,  485.749 ,
        488.435 ,  477.5635,  484.4205,  504.0635,  498.9705,  491.3995,
        479.6845,  483.25  ,  492.711 ,  508.3605,  482.1675,  483.3815,
        483.1915,  487.1515,  479.776 ,  497.1775,  479.985 ,  497.4085,
        487.688 ,  483.7415,  482.1165,  501.899 ,  476.951 ,  487.1095,
        483.235 ,  477.897 ,  499.64  ,  500.025 ,  478.222 ,  478.557 ,
        481.08  ,  479.968 ,  488.793 ,  487.943 ,  476.06  ,  479.0265,
        476.868 ,  510.7215,  494.6405,  510.7705,  506.9805,  477.0855,
        476.551 ,  500.073 ,  482.6145,  480.2765,  483.849 ,  504.674 ,
        503.0315,  514.425 ,  476.999 ,  478.6255,  488.305 ,  486.7675,
        498.4885,  492.6735,  517.823 ,  478.5525,  481.929 ,  490.175 ,
        495.424 ,  506.3265,  512.8235,  484.078 ,  479.2955,  483.295 ,
        476.512 ,  486.612 ,  490.862 ,  488.2055,  489.9225,  508.1945,
        488.9565,  476.0375,  506.0325,  479.153 ,  481.32  ,  490.8695,
        487.7495,  492.2825,  480.39  ,  487.7755,  480.4005,  503.113 ,
        504.4315,  480.5115,  487.0045,  485.109 ,  478.314 ,  498.9485,
        492.968 ,  487.1575,  493.691 ,  500.5205,  485.061 ,  477.522 ,
        476.366 ,  493.6285,  479.8745,  482.5665,  478.3985,  484.104 ,
        491.527 ,  496.1055,  483.171 ,  478.0915,  475.712 ,  477.9965,
        497.687 ,  498.8435,  490.276 ,  478.936 ,  507.5225,  511.2025,
        476.962 ,  479.153 ,  481.7825,  498.7185,  489.5925,  494.1805,
        476.894 ,  508.236 ,  478.4365,  491.7135,  500.578 ,  490.548 ,
        485.392 ,  485.672 ,  490.729 ,  478.612 ,  494.284 ,  484.7655,
        478.9815,  493.9425,  500.5455,  489.2975,  484.4605,  492.415 ,
        484.031 ,  498.962 ,  484.4285,  487.131 ,  477.009 ,  484.427 ,
        476.1785,  495.793 ,  496.173 ,  492.347 ,  476.8725,  479.5875,
        481.681 ,  476.0165,  504.158 ,  491.0155,  477.9205,  483.394 ,
        479.695 ,  493.411 ,  491.212 ,  503.5085,  496.582 ,  476.1655,
        485.8825,  497.187 ,  475.175 ,  500.917 ,  496.791 ,  496.6555,
        481.085 ,  489.6075,  477.869 ,  491.8145,  494.5   ,  485.4805,
        480.5725,  480.8795,  499.6585,  476.398 ,  486.3575,  480.1225,
        501.3715,  499.0755,  480.8245,  487.399 ,  477.3155,  481.239 ,
        486.4   ,  512.029 ,  483.2285,  483.13  ,  490.474 ,  480.2915,
        489.816 ,  479.957 ,  482.1945,  481.9935,  486.498 ,  516.454 ,
        487.0335,  479.2035,  476.164 ,  488.269 ,  495.761 ,  487.8995,
        480.874 ,  487.78  ,  500.472 ,  501.569 ,  506.5205,  494.014 ,
        496.5045,  503.0535,  500.203 ,  482.594 ,  481.4135,  490.4035,
        481.192 ,  504.3015,  481.306 ,  478.2335,  484.8145,  482.4985,
        493.3315,  484.054 ,  502.819 ,  476.518 ,  507.2765,  498.2075,
        483.038 ,  491.274 ,  477.6885,  486.1715,  480.9   ,  494.749 ,
        495.613 ,  483.873 ,  484.5355,  499.7195,  487.873 ,  489.589 ,
        496.8745,  487.605 ,  500.981 ,  491.8215,  480.3305,  483.4535,
        496.464 ,  481.9015,  480.9125,  479.3125,  496.465 ,  483.9735,
        479.9145,  477.888 ,  492.0245,  477.197 ,  495.3845,  483.292 ,
        476.8165,  493.4595,  476.4445,  487.539 ,  478.077 ,  484.3455,
        484.1565,  482.131 ,  509.9355,  481.2205,  477.0235,  489.583 ,
        476.069 ,  487.5755,  476.6135,  476.7805,  482.005 ,  477.864 ,
        482.865 ,  478.0995,  489.6855,  490.68  ,  487.8875,  484.6165,
        492.143 ,  517.588 ,  484.355 ,  507.623 ,  511.244 ,  497.346 ,
        480.4315,  478.779 ,  477.7445,  476.0565,  484.764 ,  489.302 ,
        490.8545,  484.27  ,  484.324 ,  476.8805,  493.8275,  505.586 ,
        479.232 ,  498.727 ,  489.329 ,  499.9885,  477.441 ,  517.1085,
        485.46  ,  485.1755,  489.851 ,  479.605 ,  495.7895,  502.5115,
        492.5215,  477.2465,  479.7015,  486.1325,  484.0565,  476.577 ,
        487.96  ,  477.5935,  489.007 ,  481.426 ,  479.801 ,  501.817 ,
        479.6465,  481.1315,  490.8905,  485.6815,  502.708 ,  482.687 ,
        494.4275,  480.4285,  485.115 ,  490.432 ,  480.8425,  510.821 ,
        481.478 ,  481.114 ,  516.0075,  478.712 ,  480.398 ,  477.6405,
        479.411 ,  486.371 ,  481.366 ,  487.735 ,  483.676 ,  486.632 ,
        485.4965,  478.4575,  477.3605,  497.97  ,  501.877 ,  482.779 ,
        478.7155,  482.5695,  489.9115,  479.6215,  482.4585,  478.8115,
        486.3565,  496.5655,  493.4995,  510.893 ,  478.2195,  483.309 ,
        507.977 ,  490.266 ]), variance=array([  4.12391133e+01,   9.11212350e+02,   1.51314502e+03,
         8.20817006e+01,   1.71308389e+03,   4.61850115e+01,
         1.64640571e+03,   1.91673337e+00,   2.26317016e+02,
         5.17093337e+01,   1.33640189e+03,   7.95150013e+02,
         1.16755021e+03,   1.81624152e+03,   1.47263650e+02,
         4.83322809e+02,   1.81807535e+02,   9.20484986e+02,
         5.46131137e+02,   9.91452436e+01,   1.61907944e+02,
         4.99267513e+02,   4.67900660e+01,   9.29671233e+01,
         1.95784837e+03,   8.13943011e+02,   4.65406331e+02,
         1.42441821e+02,   2.16204596e+02,   4.82475427e+02,
         5.88162159e+01,   1.33105016e+03,   1.31036419e+03,
         1.66105346e+03,   5.49141202e+02,   1.83148436e+03,
         1.32038903e+02,   5.24587394e+02,   2.22811406e+01,
         2.50184192e+00,   1.18068472e+01,   1.49627288e+03,
         4.96308798e+02,   2.60752320e+02,   7.99641405e+02,
         5.74993776e+02,   1.31853901e+03,   1.07118888e+03,
         1.84991846e+03,   6.53330025e+02,   1.86601540e+03,
         1.33613256e+03,   5.12309419e+02,   2.54428192e+01,
         8.35481951e+02,   4.35760279e+02,   1.73195634e+03,
         1.08793264e+03,   1.70073725e+03,   4.60144308e+02,
         3.75263359e+02,   4.25992636e+01,   1.35572775e+03,
         4.40860790e+01,   7.99076783e+03,   1.35018648e+03,
         1.37093607e+03,   4.46826257e+02,   2.86195008e+01,
         4.61729655e+01,   1.78005053e+03,   2.03884717e+02,
         5.78522479e+02,   1.35527647e+03,   4.56099987e+01,
         1.71933326e+03,   9.78405100e+01,   6.46077639e+02,
         1.46441371e+03,   3.95386837e+02,   6.21373817e+02,
         1.69085466e+03,   8.97457240e+02,   1.62308278e+02,
         1.57835686e+03,   1.01095435e+03,   2.67619250e+01,
         4.06762905e+02,   3.89498499e+01,   1.82813419e+03,
         3.51059530e-01,   1.13805076e+03,   4.40121020e+02,
         3.51724973e+02,   6.42464742e+01,   1.10639756e+03,
         1.38682901e+01,   5.37374737e+02,   3.69312804e+02,
         1.24830150e+03,   7.61080018e+01,   7.52330605e+01,
         4.25257026e+01,   1.96914567e+02,   1.24523960e+03,
         1.81049307e+04,   7.50556317e+02,   1.10469581e+03,
         1.05798544e+03,   1.01932325e+02,   1.04896877e+03,
         1.75433396e+03,   6.08181028e+01,   6.20845813e+02,
         1.37335111e+03,   2.92315628e+02,   3.95744142e+02,
         1.53110330e+02,   7.43297168e+02,   5.51499744e+02,
         4.70035418e+00,   5.77678555e+02,   1.14011397e+02,
         1.61689028e+03,   4.81505496e+02,   1.23709499e+03,
         1.66952707e+02,   6.02676542e+02,   1.32368543e+02,
         1.41221789e+03,   7.65201428e+02,   4.52643321e+02,
         4.68603077e+02,   1.69834595e+01,   6.28153757e+02,
         1.78475485e+03,   1.69707617e+03,   3.74239019e+02,
         4.45062129e+01,   2.30024512e+02,   4.95230094e+02,
         1.46801255e+03,   1.29770329e+02,   8.31425290e+01,
         3.24971313e+02,   4.74409753e+02,   1.49292886e+01,
         1.33014106e+03,   2.67591546e+01,   1.64539032e+03,
         1.72515023e+03,   1.54072714e+02,   1.11656756e+02,
         9.63332246e+03,   1.88053927e+00,   6.67865442e+02,
         4.54436993e+02,   5.71600191e+02,   6.65954377e+02,
         6.86867809e+02,   7.00016724e+02,   1.25958730e+02,
         1.40861031e+02,   3.75317419e+01,   1.63595613e+03,
         6.11341422e+02,   2.33056528e+00,   1.67331643e+01,
         1.49132166e+00,   1.89827107e+03,   1.84544998e+03,
         1.65773970e+03,   1.47952888e+03,   1.55696823e+00,
         2.45664231e+02,   1.56467301e+03,   1.81170475e+02,
         4.83082019e+01,   1.42141791e+03,   1.68062304e+03,
         1.33502402e+03,   1.57357616e+03,   7.37469734e+02,
         5.04042271e+02,   2.23677814e+02,   6.05249068e+02,
         1.61407090e+03,   7.91305551e+02,   1.81125330e+03,
         1.77511193e+01,   6.13487703e+02,   6.13866308e+02,
         3.86959704e+02,   1.81533356e+03,   1.87354812e+03,
         7.78218269e+01,   3.73398497e+01,   7.15327414e+01,
         1.97184192e+00,   9.19677295e+02,   4.75485699e+02,
         4.42143341e+02,   4.00883936e+02,   1.82355745e+03,
         1.29317620e+03,   1.80299525e+00,   1.42973231e+03,
         1.54693257e+01,   2.59377289e+02,   3.99750345e+02,
         1.91966733e+02,   1.60750945e+03,   6.18754277e+02,
         1.35790105e+03,   1.29468834e+02,   1.62914981e+03,
         1.25906884e+03,   1.06767251e+02,   7.45996478e+02,
         1.08923581e+02,   9.06260534e+02,   1.72244307e+03,
         8.00382167e+02,   1.48815377e+03,   1.32723113e+03,
         7.65076118e+02,   3.74977768e+02,   3.34018609e+00,
         8.71479740e-01,   3.83848412e+02,   2.12684092e+02,
         3.79091123e+02,   1.89243319e+02,   3.37731050e+02,
         4.53217880e+02,   5.02378559e+02,   1.32925222e+02,
         1.08625590e+01,   3.88690401e+02,   3.19794775e+01,
         8.23758910e+02,   2.88129065e+03,   7.68847248e+02,
         2.16057933e+02,   1.36615457e+03,   1.15709104e+03,
         1.32234773e+03,   1.21466643e+01,   6.43273574e+01,
         7.58484500e+02,   9.73509198e+02,   8.52710275e+02,
         1.28471876e+01,   1.17155508e+03,   6.06212784e+01,
         9.64845841e+02,   1.68306445e+03,   1.75556148e+03,
         9.58692706e+01,   1.24217525e+02,   2.73394256e+02,
         3.39974547e+01,   3.51031860e+02,   1.16635769e+03,
         7.98610883e+01,   4.56499443e+02,   1.69126656e+03,
         2.17321655e+02,   8.11247063e+02,   4.22738144e+02,
         2.00906492e+02,   1.68868590e+03,   1.81401189e+03,
         1.70854711e+03,   2.32319079e+02,   1.19225284e+02,
         4.65870685e-01,   1.01388609e+03,   4.76360251e+02,
         9.39880531e+02,   1.89218984e+00,   2.63304687e+03,
         2.74197338e+02,   1.66606078e+00,   1.09210609e+03,
         9.71507013e+02,   8.73680020e+02,   1.63743448e+03,
         1.56648074e+01,   3.74421290e+02,   8.83041577e+02,
         8.07613735e+02,   5.11434993e+02,   3.97409802e+01,
         1.73908023e+03,   1.17344575e+03,   6.23299025e+02,
         1.05025524e+03,   5.82369504e+02,   4.65870755e+02,
         1.14919237e+03,   2.12269579e+02,   1.62159470e+01,
         6.08246213e+02,   1.12557979e+03,   8.89427333e+02,
         1.75273380e+02,   8.07313454e+01,   8.29347552e+02,
         4.89803498e+02,   7.40620004e+02,   2.94284636e+02,
         1.06350524e+03,   8.39529565e+02,   1.20857128e+02,
         9.72263931e+02,   1.02343131e+02,   5.32404992e+01,
         2.15950175e+03,   1.91672852e+03,   1.51788182e+02,
         8.30572386e+02,   3.79832240e+02,   1.37968512e+02,
         3.40294291e+02,   2.79051036e+01,   5.55491415e+02,
         7.40252584e+02,   1.66463228e+02,   1.64962470e+03,
         1.06732604e+03,   1.73941058e+02,   8.97552776e-01,
         9.06351815e+02,   1.33422899e+03,   1.51895347e+02,
         1.09288415e+04,   1.21548034e+03,   9.40024334e+03,
         1.43148698e+03,   1.54892304e+03,   5.48334971e+02,
         9.16606283e+02,   1.00258693e+03,   1.89733946e+03,
         7.28826053e+01,   4.65988172e+01,   1.84977458e+03,
         5.27831052e+02,   1.06754137e+03,   4.97942611e+01,
         1.61843419e+03,   1.22849033e+03,   1.53847922e+02,
         3.67566391e+02,   2.67460814e+02,   1.59238543e+03,
         2.70602901e+00,   1.27214312e+03,   1.68979634e+03,
         1.02173943e+03,   4.43246547e+02,   1.75737115e+03,
         5.95242709e+02,   2.64582291e+01,   1.69755478e+03,
         6.70737600e+02,   1.45781762e+02,   1.56171826e+02,
         1.50348556e+03,   1.13420697e+03,   1.71135976e+03,
         4.88880190e+02,   5.54229090e+02,   7.43667473e+02,
         7.37648462e+02,   5.05855625e+01,   4.09547612e+02,
         3.36989365e+03,   1.09363462e+03,   2.98497686e+01,
         4.62777232e+02,   1.22454605e+03,   1.73339467e+02,
         3.02780580e+02,   1.31648280e+02,   6.98552176e+02,
         2.86862531e+00,   3.74323822e+02,   1.33334841e+03,
         2.00978767e+01,   1.28534403e+03,   7.28156053e+00,
         1.08364930e+03,   8.94254227e+00,   4.25266763e+02,
         8.88234195e+01,   1.65142055e+03,   1.42387728e+03,
         3.65231413e+01,   1.56017486e+01,   9.73950086e+02,
         1.81714757e+00,   7.88515558e+02,   6.25430465e-01,
         1.15349307e+03,   1.25568482e+03,   2.04177129e+01,
         7.65439495e+02,   4.91251623e+01,   3.90011596e+02,
         1.78180550e+03,   8.88255972e+02,   3.19571213e+02,
         1.03401056e+03,   1.85821336e+03,   1.36924437e+02,
         1.48131053e+03,   1.76580337e+03,   1.23365011e+03,
         3.20213184e+01,   1.75566942e+02,   1.32151295e+02,
         3.99507504e-01,   1.34011310e+02,   2.21386489e+02,
         3.73121891e+02,   1.37457539e+03,   1.24997101e+03,
         1.95529962e+01,   4.70236862e+02,   9.73627418e+02,
         7.62778565e+02,   4.76563929e+03,   4.40149834e+02,
         1.44122398e+03,   1.37696367e+02,   1.76124135e+03,
         9.90571686e+02,   1.07144272e+02,   1.57973267e+03,
         2.98288119e+02,   9.46464151e+03,   1.94582978e+03,
         3.64602839e+02,   2.75511531e+00,   1.21905350e+02,
         1.26907397e+02,   1.67615138e+03,   1.19652897e+02,
         2.02178489e+02,   8.59132144e+01,   3.40670286e+02,
         1.28748259e+04,   3.71049515e+01,   6.10580541e+03,
         3.18864810e+01,   9.84152284e+02,   1.88471587e+03,
         1.03137575e+03,   1.27118033e+03,   5.30364213e+02,
         1.14563156e+03,   1.84323651e+03,   2.93249400e+02,
         3.86782767e+02,   7.10282079e+01,   1.31550471e+03,
         3.78807920e+02,   1.62148875e+03,   1.66535812e+03,
         2.06293707e+01,   1.97635277e+03,   3.19585768e+00,
         4.07244412e+01,   5.55301387e+03,   2.52915502e+02,
         2.89788669e+02,   1.44308457e+03,   1.36791972e+02,
         3.98295135e+02,   7.74007197e+02,   9.55463129e+01,
         1.20173797e+03,   1.26942358e+03,   1.27146732e+02,
         1.03010065e+02,   1.15949992e+03,   5.16636986e+02,
         7.85815285e+01,   4.36393474e+02,   1.60940148e+01,
         5.74434625e+02,   1.62908061e+04,   1.21236418e+03,
         1.40320315e+03,   3.45816106e+01,   1.83869454e+02,
         1.38564830e+03,   6.66944716e+02]), skewness=array([ 0.01145853,  0.04811456, -0.02897218, -0.01199208,  0.136755  ,
        0.07621198,  0.00254086,  0.00203618,  0.03808169, -0.06239648,
        0.00938016,  0.01774709, -0.02387445, -0.01095325,  0.03037737,
        0.13631238,  0.07996439,  0.02801106,  0.05903677, -0.05372047,
       -0.05567533,  0.10024688,  0.02164022, -0.0530323 ,  0.05095316,
        0.01352428,  0.10330334,  0.07043156,  0.03374897,  0.18005237,
        0.06149423, -0.03061827,  0.05708731, -0.00346488,  0.01967889,
       -0.0925753 , -0.01748724, -0.03717412,  0.10062365,  0.07754878,
       -0.0447432 ,  0.03781635,  0.02248924,  0.02971563,  0.04742743,
        0.12185194,  0.05938885,  0.01850439,  0.03043868, -0.02272073,
        0.02171862,  0.06242905,  0.0023591 ,  0.11507966,  0.00973333,
        0.05246087,  0.04345258,  0.09871192,  0.01115748, -0.06070132,
       -0.03964776,  0.06678537,  0.09111131,  0.09203851, -0.03567124,
        0.11178093,  0.0956777 , -0.01273457, -0.0023637 , -0.04382308,
        0.11445298, -0.05342043,  0.00377941, -0.03066506,  0.09579768,
        0.08496678, -0.05600704,  0.13146101,  0.00368436,  0.08407633,
        0.14621707, -0.03317698,  0.05375538,  0.08491819, -0.022127  ,
        0.05441597,  0.0011128 , -0.00158127, -0.03875768,  0.0271111 ,
        0.06004718,  0.08589656,  0.0833626 ,  0.02318657, -0.11646158,
        0.05913599,  0.05107814, -0.01193247,  0.04246247, -0.00958588,
       -0.06386983,  0.00728015,  0.142334  , -0.04459282,  0.10456546,
       -0.02616307, -0.02903806, -0.02713893,  0.06999807,  0.04368465,
        0.09460376,  0.00401636,  0.06447695,  0.00207668,  0.02335059,
       -0.0797472 ,  0.02828897, -0.13455963, -0.07623061,  0.03595212,
       -0.03154307,  0.01221708, -0.00333093,  0.08464439, -0.01248339,
        0.01869185,  0.05988123, -0.0280625 , -0.07833042,  0.00050443,
        0.09786454,  0.12362419, -0.04360793,  0.01933694, -0.00366565,
        0.07788925,  0.00781588,  0.00312559,  0.09706031,  0.03940784,
        0.04565451,  0.02600926,  0.0408686 ,  0.06896469, -0.00265589,
        0.000795  ,  0.11531174,  0.08564899,  0.08561035,  0.00262255,
       -0.075992  ,  0.05914331, -0.02456608,  0.01601794,  0.00908793,
        0.02504928,  0.05873728, -0.088434  ,  0.06171593, -0.00323511,
       -0.00378904,  0.04815645, -0.05902788, -0.10258025,  0.02864947,
        0.10756744, -0.08508848,  0.03213355,  0.0206437 ,  0.03919642,
        0.01474058, -0.02308017,  0.11690392,  0.11935903, -0.0177372 ,
        0.00436033,  0.02247723,  0.00218695,  0.01148077,  0.05042761,
       -0.07048603,  0.1209105 ,  0.03984231, -0.03844966,  0.11819087,
        0.13341748,  0.05912557,  0.11537025, -0.00082906, -0.01708645,
        0.02053176,  0.07240662,  0.0056251 ,  0.14443686,  0.01894334,
        0.03583702,  0.09715159,  0.05266654,  0.02043764,  0.101684  ,
       -0.01350947,  0.04459427,  0.02092171, -0.00401956, -0.02853464,
       -0.04972299,  0.04339574,  0.09327039,  0.04389368,  0.03418357,
        0.13636455,  0.06179694, -0.00050234,  0.0231637 ,  0.09083006,
       -0.01056045,  0.1795966 ,  0.073591  ,  0.03218832,  0.03369664,
        0.07691202,  0.12735928,  0.02130047, -0.02827966, -0.03324352,
       -0.02368595, -0.03308256, -0.02218895,  0.08065238, -0.04744771,
        0.03414991,  0.06802652,  0.11201329,  0.083781  ,  0.00943738,
        0.0664435 ,  0.04090697,  0.02715496, -0.03597793,  0.02649066,
        0.07126821, -0.00396047,  0.06482117, -0.03534794,  0.05116242,
        0.12426058, -0.06931625,  0.05448663,  0.15864605,  0.03438452,
       -0.03909384, -0.00183402,  0.10608935,  0.1575461 ,  0.05737933,
        0.03339234,  0.00139944, -0.02855487,  0.07086495,  0.09581032,
        0.05161875,  0.10425339,  0.0187414 ,  0.05285297,  0.08347628,
        0.03465495, -0.02339808,  0.0878409 ,  0.02219381,  0.12512721,
        0.01826682,  0.05688296, -0.02620229,  0.04317118,  0.09204713,
       -0.04103943,  0.16511464,  0.05449809,  0.06648942, -0.00275931,
        0.1226403 ,  0.01431006, -0.01492679,  0.00980363, -0.03101347,
        0.00654609, -0.00314539,  0.03751332,  0.02436535,  0.05258227,
        0.02737837,  0.13550199,  0.15306799, -0.06411479,  0.00173967,
       -0.03729661,  0.03752931,  0.11080211,  0.05848174, -0.02400756,
       -0.03121573, -0.01515323,  0.10125395,  0.1042422 ,  0.02357621,
       -0.06361882, -0.04756275,  0.0086117 ,  0.11722027, -0.03312494,
        0.00679183,  0.04410116,  0.01534531,  0.05135178,  0.06736683,
        0.02977686,  0.08295165,  0.09685875,  0.03474924,  0.02922786,
        0.01611997, -0.10925398,  0.05679073, -0.02313281,  0.11426547,
        0.02584566, -0.06622726, -0.04362177,  0.06343518,  0.11160808,
        0.07712304,  0.00359073,  0.08851846, -0.02558534,  0.10045834,
        0.10550868, -0.01943691,  0.11030782,  0.0935019 ,  0.081673  ,
        0.12289621,  0.03556977,  0.07356382,  0.13007118,  0.0615584 ,
        0.10523911,  0.02549505, -0.05981057, -0.02153972, -0.02975585,
        0.05606811,  0.03536613,  0.06247626,  0.03301246,  0.03397658,
       -0.12481508, -0.01155331,  0.04202747, -0.00932519,  0.08977776,
       -0.04534437,  0.09885404, -0.07490424,  0.08505362,  0.02849052,
        0.00076745,  0.12525046,  0.10769426,  0.00600573,  0.14862495,
        0.06439802,  0.00975921,  0.081635  , -0.04560662,  0.11867374,
        0.04418863,  0.02635205,  0.01871889,  0.02292045,  0.07214434,
        0.0629523 ,  0.06619308,  0.15992527,  0.02309594,  0.0992384 ,
        0.09605444,  0.10670688,  0.11634404,  0.07930765, -0.03556378,
        0.09146725, -0.038882  ,  0.17401207,  0.00678229,  0.13172201,
        0.09408718,  0.0863706 , -0.0175035 ,  0.00728587,  0.02545705,
       -0.0370074 , -0.07056599, -0.02258848, -0.00323568,  0.07903009,
       -0.05399252,  0.03639477,  0.00702653,  0.11167364, -0.03826697,
        0.04887923,  0.01720824, -0.03534842,  0.02792982,  0.12485939,
        0.07446406,  0.10495876,  0.0778369 ,  0.0134052 , -0.03282042,
        0.09162093, -0.06710621,  0.12505884,  0.03819259,  0.03195966,
       -0.0764938 ,  0.07441924,  0.0164773 , -0.06064053,  0.04344467,
       -0.05759021,  0.06777811,  0.0182433 ,  0.01100906,  0.07191499,
        0.14267967,  0.0255052 ,  0.17435153, -0.08019284, -0.03329305,
        0.00182422,  0.07709321, -0.05787205,  0.06465493,  0.13834858,
        0.07705892, -0.13007945,  0.10822194,  0.0020578 , -0.06050886,
        0.02385161,  0.04935543, -0.02729224, -0.12709502, -0.02962812,
       -0.01124215,  0.10066244,  0.00971211, -0.02293605,  0.01254948,
        0.11192064, -0.03199438,  0.09613732, -0.04160448,  0.09701412,
        0.14117765,  0.03244001,  0.10512924,  0.01659026,  0.02138341,
        0.09134836, -0.03100851, -0.03909747, -0.02627967,  0.07604208,
        0.00313914, -0.06064009,  0.11932961,  0.03926882, -0.1061982 ,
        0.05197405,  0.06006754, -0.08274582,  0.08180343, -0.04248415,
        0.03721001, -0.04356382,  0.12574848, -0.03067982,  0.0622096 ,
        0.15836543, -0.01731631,  0.06689412, -0.08031647,  0.07482134,
        0.03264257,  0.04529002,  0.05698175,  0.00510585,  0.0447152 ]), kurtosis=array([ -6.65898578e-02,   4.92105207e-02,   3.08864376e-01,
        -7.32243426e-03,   3.22693578e-01,   1.55780099e-01,
         2.62866760e-03,  -4.11607969e-02,   1.18502136e-01,
        -2.85496283e-02,   3.71853459e-02,   2.24673880e-01,
        -2.93028952e-02,   9.55734538e-03,  -7.44555155e-02,
         1.78924254e-01,  -5.41366310e-02,   1.72309500e-01,
        -1.46763705e-02,  -4.47831742e-02,   3.27432386e-01,
        -5.62855604e-02,  -1.54548942e-01,   1.13441883e-01,
         4.38230394e-02,  -9.99982804e-02,   1.53540039e-01,
         1.53770175e-01,  -9.02694040e-01,   3.86300594e-01,
         2.71121783e-01,  -5.16648565e-02,   1.95502031e-01,
         8.63443406e-02,   3.40360671e-01,  -1.37254834e-01,
         3.01964848e-02,   1.52850771e-01,   1.32494235e-01,
         2.42605130e-02,   2.69296059e-01,   1.82884053e-01,
         4.26834902e-01,   1.09909802e-01,   2.76939195e-02,
         2.22017620e-01,   5.86685869e-02,   6.63744167e-02,
        -8.68848390e-01,   1.64900733e-01,   1.32753802e-01,
         1.80226694e-01,  -1.51891465e-02,   5.27714996e-02,
         1.43748905e-01,   8.66771915e-02,   3.03118153e-01,
         2.49332679e-01,   5.21720861e-02,  -6.93000245e-02,
         1.99109467e-01,   2.50548796e-02,   2.23366730e-01,
         1.03975412e-01,  -2.35173828e-01,   1.11677588e-01,
         1.79095562e-01,   3.30908250e-01,  -9.42731262e-02,
        -7.98748813e-02,   3.94439234e-02,   1.94394393e-01,
         9.60596759e-02,   2.48776797e-01,   2.96252492e-01,
         3.23303639e-03,  -4.19405580e-02,   1.12235882e-01,
         9.43969288e-02,  -3.47933163e-02,   1.24563564e-01,
         1.54386998e-01,   1.57204521e-01,   4.17403803e-01,
         4.99137898e-02,  -9.90060939e-02,   1.56885275e-01,
         1.79197244e-01,   5.27910264e-01,   3.60714624e-02,
         2.50857832e-01,  -6.23597056e-02,   9.77125974e-02,
         1.02949491e-01,   7.65771809e-02,   1.89958914e-01,
         2.39006672e-02,  -3.98036099e-02,  -1.49805090e-02,
         1.13614727e-01,   1.70732378e-01,   2.54030267e-01,
         3.53023862e-01,   1.95162954e-01,   3.31974899e-01,
        -8.32069394e-02,   2.23927751e-01,   4.41571117e-02,
        -3.18922210e-02,   2.98488252e-01,  -4.63843201e-02,
         5.21904643e-02,   1.82450710e-01,   1.72548446e-01,
         1.63500975e-01,   1.89983772e-01,   1.73340866e-01,
        -7.88379839e-02,   1.69063616e-01,  -4.78664580e-02,
         1.58724260e-01,   1.86287168e-01,   1.15108143e-01,
        -8.32386544e-02,   3.05761359e-02,  -2.25255413e-02,
         9.18413162e-02,   1.74097530e-01,  -3.73646998e-02,
         1.77781659e-01,   2.37920545e-01,   2.52464076e-01,
         3.81852960e-02,   1.56551368e-01,   5.24732754e-02,
         1.37909700e-01,  -1.77383248e-02,  -6.74908115e-02,
        -1.82509694e-01,   1.57110292e-01,  -1.80359272e-02,
         1.04459385e-01,  -9.06226555e-02,   8.71733946e-02,
         1.99779185e-01,   1.88300942e-01,   1.15557509e-01,
         7.54301936e-03,   1.17501271e-01,  -2.33528314e-02,
         7.33966958e-02,   7.38910565e-02,   2.34998503e-01,
        -9.66362166e-01,   8.40188609e-02,   2.37334326e-01,
        -2.61705513e-02,  -1.01288471e-02,   6.68055325e-02,
         2.21324508e-01,  -5.85743371e-02,   7.51545842e-02,
        -1.82697450e-01,   1.08560319e-01,   1.46387469e-01,
        -2.50182242e-02,   2.04494482e-02,   4.63446658e-02,
         1.63942917e-01,  -5.18002978e-02,   2.19850732e-01,
        -6.55602705e-02,  -6.52076358e-02,   7.74840663e-03,
         7.72155092e-02,  -7.87791376e-02,  -7.33367230e-03,
         1.18457922e-01,   1.09033709e-01,  -3.73382107e-04,
        -1.32207705e-01,   1.21721466e-02,   1.75012640e-02,
         2.56918852e-01,   1.27070705e-01,   6.34086076e-02,
        -1.09696625e-01,   1.82807209e-01,   6.29480062e-02,
         6.46916664e-01,   5.90299991e-02,   3.29898596e-01,
        -2.14424392e-03,   1.86166161e-01,   1.87294820e-01,
         6.07798577e-02,   4.95256118e-03,   1.67585673e-01,
         1.73974048e-01,   2.75578056e-01,   6.41613547e-02,
         2.02686557e-02,  -2.65834727e-02,   8.86967148e-02,
         1.26136574e-02,   1.52025891e-01,   2.81793056e-01,
         1.46573784e-01,   1.34671076e-01,  -1.20713360e-02,
        -2.26081454e-02,   5.70596356e-02,  -3.92359548e-03,
         4.93513134e-02,   1.03997958e-01,   2.03678795e-01,
         3.01098364e-02,  -4.59924102e-02,   2.10853619e-01,
         4.68789292e-02,   1.50273714e-01,   1.45093696e-01,
         2.02388483e-01,   2.18743642e-03,   8.65961478e-02,
         8.89766715e-02,   2.18150753e-01,   3.10626690e-01,
         1.16316002e-02,   1.06262610e-01,   1.11386080e-01,
         2.77652703e-01,   1.88079226e-01,   3.18942521e-01,
        -4.45501404e-02,  -6.55246213e-02,   2.35771300e-01,
        -3.43508443e-02,   1.13452630e-01,   5.20254157e-02,
         3.51993510e-01,  -9.21366636e-01,   1.24721726e-01,
         1.15827920e-01,   1.58609870e-01,   2.06119113e-02,
         6.43501298e-02,  -7.56759893e-02,   2.10803782e-01,
         4.91140032e-02,  -4.67210437e-02,   1.44497380e-01,
         9.94529368e-02,   2.97151145e-01,   1.77540100e-01,
         1.84310353e-01,   3.63978312e-01,   9.60535102e-02,
         1.62100090e-03,   1.41435345e-01,   8.91183699e-02,
         7.65106609e-02,   4.55784395e-02,   3.87169723e-01,
         6.33606562e-02,   7.59984879e-02,   4.24951964e-02,
         2.23818129e-01,  -3.08055007e-02,   2.19504340e-01,
        -6.23599948e-02,  -6.56222760e-03,   6.09357995e-02,
         2.05376571e-01,   1.37354046e-01,   4.55311441e-01,
         1.17852780e-01,   1.67321918e-01,   3.56161553e-01,
        -9.39050773e-02,  -1.26080131e-01,  -9.19654255e-01,
         4.81598859e-02,  -4.45588688e-02,   4.24602550e-02,
         3.18675051e-01,   1.92218505e-01,   1.58561114e-01,
         3.45635570e-01,   9.95677338e-02,   7.97692165e-02,
         4.12588529e-01,  -9.37440207e-03,  -3.88791881e-02,
         4.50676966e-02,  -7.83063744e-03,   5.42733291e-02,
         8.29658660e-01,  -2.54920371e-03,  -2.95165839e-02,
         1.56194350e-01,   3.79483988e-02,   1.67692209e-01,
         1.06122979e-02,   1.75480678e-01,   1.16569254e-01,
         8.71349058e-02,   1.78954580e-01,   3.47278561e-02,
         4.69811290e-01,   5.99315517e-02,   2.28980786e-01,
         2.18267297e-01,   1.08242954e-01,  -7.11569100e-02,
         1.43314331e-01,  -1.23953967e-02,   1.03457574e-01,
        -9.49063191e-01,   3.04128774e-01,   8.00540425e-02,
         1.86936401e-01,   2.10826194e-01,   1.75691308e-01,
         1.73107574e-01,   3.17496200e-01,   2.18292557e-01,
         9.97649992e-02,   1.46217582e-01,  -1.73053334e-01,
         1.37701989e-01,  -5.86953078e-02,   3.07885375e-02,
         9.32146533e-02,   3.22748045e-01,   1.19179707e-02,
        -2.47314751e-01,   2.40570022e-01,  -3.04992887e-01,
         2.13824514e-01,  -2.60346712e-02,   1.73978974e-01,
         1.84917727e-01,   2.44380089e-01,   1.13754941e-01,
         2.28213945e-01,   2.99561019e-01,   7.55592692e-02,
         5.61087322e-02,  -1.71374332e-03,   1.39565575e-01,
        -6.72059538e-02,   2.23283541e-01,   7.85000030e-02,
         7.18857937e-03,   9.88293131e-02,   2.69679641e-01,
         2.80982763e-01,   5.40111615e-02,   1.62764215e-01,
         1.99683767e-01,   3.43767122e-02,   2.28192183e-01,
        -2.35864449e-02,   2.57077291e-01,   1.93636788e-01,
         2.44752035e-02,   9.94217695e-02,   3.03221805e-01,
         7.78948698e-02,   2.03508365e-01,   1.68786821e-01,
         1.54658422e-01,   3.36738082e-01,   1.14934284e-01,
         3.24428841e-01,   1.82018834e-01,   3.38839304e-02,
        -9.43213942e-01,   2.29217957e-02,   1.45765841e-01,
         1.16058322e-01,   4.03273501e-01,   2.13247375e-01,
         4.28690093e-02,  -1.67850548e-01,   1.02561421e-01,
         2.07450600e-01,   6.92798962e-02,   6.09870054e-02,
         6.04191846e-01,   2.87102471e-01,   1.07831180e-01,
         1.34697813e-01,   1.59252598e-01,   8.63874913e-02,
         2.62541985e-02,  -8.47875374e-02,   2.98627554e-01,
         4.34643666e-02,   2.60201140e-01,   2.74730152e-01,
        -2.90468762e-02,   2.27685879e-02,  -9.73289760e-02,
         2.50700552e-02,   1.19305801e-01,   1.52705415e-01,
         2.56950179e-01,   7.89620453e-02,   2.11379538e-01,
        -8.46853677e-02,   1.78574062e-01,  -5.90968992e-02,
        -2.48322453e-02,   2.74961065e-01,   4.03485804e-02,
         9.22329094e-02,   6.61213783e-02,  -8.26289430e-02,
         2.50656185e-02,   1.13028001e-01,   1.53064301e-01,
         1.77637282e-01,  -1.26530050e-02,   8.38470230e-02,
        -4.67538163e-02,   1.84186463e-01,   1.61588107e-01,
         1.45245354e-01,   8.49623350e-02,  -4.43637829e-02,
         1.84936002e-01,  -9.40522873e-01,  -4.22585037e-02,
         4.78117587e-01,   7.73109765e-02,  -7.22067176e-03,
         2.39668788e-01,  -3.50848618e-03,   1.58462722e-01,
         1.27255917e-01,  -3.21743510e-01,   1.06120626e-01,
         1.01298129e-01,   3.43983324e-01,   1.82033538e-01,
         1.58654009e-01,   9.45046232e-02,   6.20229058e-02,
         2.18082155e-01,  -8.77754183e-01,   2.27166399e-01,
        -3.03417236e-01,  -1.34120572e-02,  -9.54076088e-01,
         5.34237426e-02,  -8.69861446e-02,   4.13617051e-02,
        -8.46711658e-02,  -7.50964538e-02,   5.28282700e-02,
        -2.09485129e-02,  -1.21848778e-01,   8.41447892e-02,
         9.40754571e-02,  -9.52134813e-02,   1.13600877e-01,
        -2.89385941e-02,   1.70751017e-01,  -1.47761010e-02,
         8.38414343e-02,  -3.36944129e-01,  -8.07378719e-02,
         1.30086924e-01,  -9.31182824e-01,   6.42602552e-02,
         2.19924105e-01,  -4.81801203e-02,   1.33971502e-01,
         2.54416385e-02,   1.01366331e-01,   1.67388513e-01,
         1.05003639e-01,  -2.25592306e-02,   1.32009288e-02,
        -1.15052486e-02,   1.74988415e-01,   3.84717200e-01,
         1.52365135e-01,  -9.98812911e-02,   2.77128745e-01,
         5.00905697e-02,  -3.61954502e-01,   6.39825384e-02,
        -6.13038136e-02,   4.45355849e-01,   1.17586728e-01,
         7.64003266e-02,   1.04539461e-01]))

In [19]:
import matplotlib.pyplot as plt
import matplotlib as mpl
%matplotlib inline

def visualize_correlation_matrix(data, hurdle = 0.0):
    R = np.corrcoef(data, rowvar=0)
    R[np.where(np.abs(R)<hurdle)] = 0.0
    heatmap = plt.pcolor(R, cmap=mpl.cm.coolwarm, alpha=0.8)
    heatmap.axes.set_frame_on(False)
    plt.xticks(rotation=90)
    plt.tick_params(axis='both', which='both', bottom='off', top='off', left = 'off', 
    right = 'off') 
    plt.colorbar()
    plt.show()

visualize_correlation_matrix(Xt[:,100:150], hurdle=0.0)



In [20]:
from sklearn.cross_validation import cross_val_score
from sklearn.linear_model import LogisticRegression

In [21]:
logit = LogisticRegression()

In [22]:
logit.fit(Xt,yt)


Out[22]:
LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,
          intercept_scaling=1, max_iter=100, multi_class='ovr', n_jobs=1,
          penalty='l2', random_state=None, solver='liblinear', tol=0.0001,
          verbose=0, warm_start=False)

In [23]:
from sklearn.metrics import roc_auc_score
print ('Training area under the curve: %0.3f' % roc_auc_score(yt,logit.predict_proba(Xt)[:,1]))
print ('Validation area under the curve: %0.3f' % roc_auc_score(yv,logit.predict_proba(Xv)[:,1]))


Training area under the curve: 0.824
Validation area under the curve: 0.602

Univariate selection of features


In [24]:
from sklearn.feature_selection import SelectPercentile, f_classif
selector = SelectPercentile(f_classif, percentile=50)
selector.fit(Xt,yt)
variable_filter = selector.get_support()

In [25]:
plt.hist(selector.scores_, bins=50, histtype='bar')
plt.grid()
plt.show()



In [26]:
variable_filter = selector.scores_ > 10
print ("Number of filtered variables: %i" % np.sum(variable_filter))
from sklearn.preprocessing import PolynomialFeatures
interactions = PolynomialFeatures(degree=2, interaction_only=True)
Xs = interactions.fit_transform(Xt[:,variable_filter])
print ("Number of variables and interactions: %i" % Xs.shape[1])


Number of filtered variables: 13
Number of variables and interactions: 92

In [27]:
logit.fit(Xs,yt)
Xvs = interactions.fit_transform(Xv[:,variable_filter])
print ('Validation area Under the Curve before recursive selection: %0.3f' % roc_auc_score(yv,logit.predict_proba(Xvs)[:,1]))


Validation area Under the Curve before recursive selection: 0.808

Recursive feature selection


In [28]:
# Execution time: 3.15 s
from sklearn.feature_selection import RFECV
from sklearn.cross_validation import KFold
from sklearn.cross_validation import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.30, random_state=1)
lm = LinearRegression()
cv_iterator = KFold(n=len(X_train), n_folds=10, shuffle=True, random_state=101)
recursive_selector = RFECV(estimator=lm, step=1, cv=cv_iterator, scoring='mean_squared_error')
recursive_selector.fit(second_order.fit_transform(X_train),y_train)
print ('Initial number of features : %i' % second_order.fit_transform(X_train).shape[1])
print ('Optimal number of features : %i' % recursive_selector.n_features_)


Initial number of features : 105
Optimal number of features : 51

In [29]:
a = second_order.fit_transform(X_train)
print (a)


[[  1.00000000e+00   6.29760000e-01   0.00000000e+00 ...,   1.57529610e+05
    3.27839400e+03   6.82276000e+01]
 [  1.00000000e+00   1.71710000e-01   2.50000000e+01 ...,   1.42944486e+05
    5.45947520e+03   2.08513600e+02]
 [  1.00000000e+00   9.82349000e+00   0.00000000e+00 ...,   1.57529610e+05
    8.43015600e+03   4.51137600e+02]
 ..., 
 [  1.00000000e+00   5.87205000e+00   0.00000000e+00 ...,   1.57529610e+05
    7.68795300e+03   3.75196900e+02]
 [  1.00000000e+00   3.30450000e-01   0.00000000e+00 ...,   1.41940562e+05
    4.09904000e+03   1.18374400e+02]
 [  1.00000000e+00   8.01400000e-02   0.00000000e+00 ...,   1.57529610e+05
    3.48081300e+03   7.69129000e+01]]

In [30]:
essential_X_train = recursive_selector.transform(second_order.fit_transform(X_train))
essential_X_test  = recursive_selector.transform(second_order.fit_transform(X_test))
lm.fit(essential_X_train, y_train)
print ('cases = %i features = %i' % essential_X_test.shape)
print ('In-sample  mean squared error %0.3f' % mean_squared_error(y_train,lm.predict(essential_X_train)))
print ('Out-sample mean squared error %0.3f' % mean_squared_error(y_test,lm.predict(essential_X_test)))


cases = 152 features = 51
In-sample  mean squared error 7.954
Out-sample mean squared error 11.477

In [31]:
edges = np.histogram(y, bins=5)[1]
binning = np.digitize(y, edges)
stratified_cv_iterator = StratifiedKFold(binning, n_folds=10, shuffle=True, random_state=101)
essential_X = recursive_selector.transform(second_order.fit_transform(X))
cv_score = cross_val_score(lm, essential_X, y, cv=stratified_cv_iterator, scoring='mean_squared_error', n_jobs=1)
print ('Cv score: mean %0.3f std %0.3f' % (np.mean(np.abs(cv_score)), np.std(cv_score)))


Cv score: mean 11.505 std 3.620

Regularization

Ridge


In [32]:
from sklearn.linear_model import Ridge
ridge = Ridge(normalize=True)
# The following commented line is to show a logistic regression with L2 regularization
# lr_l2 = LogisticRegression(C=1.0, penalty='l2', tol=0.01) 
ridge.fit(second_order.fit_transform(X), y)


Out[32]:
Ridge(alpha=1.0, copy_X=True, fit_intercept=True, max_iter=None,
   normalize=True, random_state=None, solver='auto', tol=0.001)

In [33]:
lm.fit(second_order.fit_transform(X), y)


Out[33]:
LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)

In [34]:
print ('Average coefficient: Non regularized = %0.3f Ridge = %0.3f' % (np.mean(lm.coef_), np.mean(ridge.coef_)))
print ('Min coefficient: Non regularized = %0.3f Ridge = %0.3f' % (np.min(lm.coef_), np.min(ridge.coef_)))
print ('Max coefficient: Non regularized = %0.3f Ridge = %0.3f' % (np.max(lm.coef_), np.max(ridge.coef_)))


Average coefficient: Non regularized = -7419950.757 Ridge = -0.027
Min coefficient: Non regularized = -779094975.995 Ridge = -2.013
Max coefficient: Non regularized = 143.115 Ridge = 1.181

Grid search for optimal parameters


In [35]:
from sklearn.grid_search import GridSearchCV
edges = np.histogram(y, bins=5)[1]
binning = np.digitize(y, edges)
stratified_cv_iterator = StratifiedKFold(binning, n_folds=10, shuffle=True, random_state=101)
search = GridSearchCV(estimator=ridge, param_grid={'alpha':np.logspace(-4,2,7)}, scoring = 'mean_squared_error', 
                      n_jobs=1, refit=True, cv=stratified_cv_iterator)
search.fit(second_order.fit_transform(X), y)
print ('Best alpha: %0.5f' % search.best_params_['alpha'])
print ('Best CV mean squared error: %0.3f' % np.abs(search.best_score_))


Best alpha: 0.00100
Best CV mean squared error: 11.883

In [36]:
search.grid_scores_


Out[36]:
[mean: -12.45899, std: 5.32834, params: {'alpha': 0.0001},
 mean: -11.88307, std: 4.92960, params: {'alpha': 0.001},
 mean: -12.64747, std: 4.66278, params: {'alpha': 0.01},
 mean: -16.83243, std: 5.28501, params: {'alpha': 0.10000000000000001},
 mean: -22.91860, std: 5.95064, params: {'alpha': 1.0},
 mean: -37.81253, std: 8.63064, params: {'alpha': 10.0},
 mean: -66.65745, std: 10.35740, params: {'alpha': 100.0}]

In [37]:
# Alternative: sklearn.linear_model.RidgeCV
from sklearn.linear_model import RidgeCV
auto_ridge = RidgeCV(alphas=np.logspace(-4,2,7), normalize=True, scoring = 'mean_squared_error', cv=None)
auto_ridge.fit(second_order.fit_transform(X), y)
print ('Best alpha: %0.5f' % auto_ridge.alpha_)


Best alpha: 0.00100

In [38]:
from sklearn.grid_search import RandomizedSearchCV
from scipy.stats import expon
np.random.seed(101)
search_func=RandomizedSearchCV(estimator=ridge, param_distributions={'alpha':np.logspace(-4,2,100)}, n_iter=10, 
                               scoring='mean_squared_error', n_jobs=1, iid=False, refit=True, cv=stratified_cv_iterator)
search_func.fit(second_order.fit_transform(X), y)
print ('Best alpha: %0.5f' % search_func.best_params_['alpha'])
print ('Best CV mean squared error: %0.3f' % np.abs(search_func.best_score_))


Best alpha: 0.00046
Best CV mean squared error: 11.790

Lasso


In [39]:
from sklearn.linear_model import Lasso
lasso = Lasso(alpha=1.0, normalize=True, max_iter=2*10**5)
#The following comment shows an example of L1 logistic regression
#lr_l1 = LogisticRegression(C=1.0, penalty='l1', tol=0.01)

In [40]:
from sklearn.grid_search import RandomizedSearchCV
from scipy.stats import expon
np.random.seed(101)
stratified_cv_iterator = StratifiedKFold(binning, n_folds=10, shuffle=True, random_state=101)
search_func=RandomizedSearchCV(estimator=lasso, param_distributions={'alpha':np.logspace(-5,2,100)}, n_iter=10, 
                               scoring='mean_squared_error', n_jobs=1, iid=False, refit=True, cv=stratified_cv_iterator)
search_func.fit(second_order.fit_transform(X), y)
print ('Best alpha: %0.5f' % search_func.best_params_['alpha'])
print ('Best CV mean squared error: %0.3f' % np.abs(search_func.best_score_))


Best alpha: 0.00006
Best CV mean squared error: 12.235

In [41]:
print ('Zero value coefficients: %i out of %i' % (np.sum(~(search_func.best_estimator_.coef_==0.0)), 
                                                 len(search_func.best_estimator_.coef_)))


Zero value coefficients: 85 out of 105

In [42]:
# Alternative: sklearn.linear_model.LassoCV
# Execution time: 54.9 s
from sklearn.linear_model import LassoCV
auto_lasso = LassoCV(alphas=np.logspace(-5,2,100), normalize=True, n_jobs=1, cv=None, max_iter=10**6)
auto_lasso.fit(second_order.fit_transform(X), y)
print ('Best alpha: %0.5f' % auto_lasso.alpha_)


Best alpha: 0.01097

Elasticnet


In [43]:
# Execution time: 1min 3s
from sklearn.linear_model import ElasticNet
import numpy as np 
elasticnet = ElasticNet(alpha=1.0, l1_ratio=0.15, normalize=True, max_iter=10**6, random_state=101)
from sklearn.grid_search import RandomizedSearchCV
from scipy.stats import expon
np.random.seed(101)
search_func=RandomizedSearchCV(estimator=elasticnet, param_distributions={'alpha':np.logspace(-5,2,100), 
                                'l1_ratio':np.arange(0.0, 1.01, 0.05)}, n_iter=10, 
                                scoring='mean_squared_error', n_jobs=1, iid=False, refit=True, cv=stratified_cv_iterator)
search_func.fit(second_order.fit_transform(X), y)
print ('Best alpha: %0.5f' % search_func.best_params_['alpha'])
print ('Best l1_ratio: %0.5f' % search_func.best_params_['l1_ratio'])
print ('Best CV mean squared error: %0.3f' % np.abs(search_func.best_score_))


Best alpha: 0.00002
Best l1_ratio: 0.60000
Best CV mean squared error: 11.900

In [44]:
print ('Zero value coefficients: %i out of %i' % (np.sum(~(search_func.best_estimator_.coef_==0.0)), 
                                                 len(search_func.best_estimator_.coef_)))


Zero value coefficients: 102 out of 105

In [45]:
# Alternative: sklearn.linear_model.ElasticNetCV
from sklearn.linear_model import ElasticNetCV
auto_elastic = ElasticNetCV(alphas=np.logspace(-5,2,100), normalize=True, n_jobs=1, cv=None, max_iter=10**6)
auto_elastic.fit(second_order.fit_transform(X), y)
print ('Best alpha: %0.5f' % auto_elastic.alpha_)
print ('Best l1_ratio: %0.5f' % auto_elastic.l1_ratio_)


Best alpha: 0.01292
Best l1_ratio: 0.50000

In [46]:
print(second_order.fit_transform(X).shape)
print(len(y))

print(second_order.fit_transform(X)[0])
print(y[0])


(506, 105)
506
[  1.00000000e+00   6.32000000e-03   1.80000000e+01   2.31000000e+00
   0.00000000e+00   5.38000000e-01   6.57500000e+00   6.52000000e+01
   4.09000000e+00   1.00000000e+00   2.96000000e+02   1.53000000e+01
   3.96900000e+02   4.98000000e+00   3.99424000e-05   1.13760000e-01
   1.45992000e-02   0.00000000e+00   3.40016000e-03   4.15540000e-02
   4.12064000e-01   2.58488000e-02   6.32000000e-03   1.87072000e+00
   9.66960000e-02   2.50840800e+00   3.14736000e-02   3.24000000e+02
   4.15800000e+01   0.00000000e+00   9.68400000e+00   1.18350000e+02
   1.17360000e+03   7.36200000e+01   1.80000000e+01   5.32800000e+03
   2.75400000e+02   7.14420000e+03   8.96400000e+01   5.33610000e+00
   0.00000000e+00   1.24278000e+00   1.51882500e+01   1.50612000e+02
   9.44790000e+00   2.31000000e+00   6.83760000e+02   3.53430000e+01
   9.16839000e+02   1.15038000e+01   0.00000000e+00   0.00000000e+00
   0.00000000e+00   0.00000000e+00   0.00000000e+00   0.00000000e+00
   0.00000000e+00   0.00000000e+00   0.00000000e+00   0.00000000e+00
   2.89444000e-01   3.53735000e+00   3.50776000e+01   2.20042000e+00
   5.38000000e-01   1.59248000e+02   8.23140000e+00   2.13532200e+02
   2.67924000e+00   4.32306250e+01   4.28690000e+02   2.68917500e+01
   6.57500000e+00   1.94620000e+03   1.00597500e+02   2.60961750e+03
   3.27435000e+01   4.25104000e+03   2.66668000e+02   6.52000000e+01
   1.92992000e+04   9.97560000e+02   2.58778800e+04   3.24696000e+02
   1.67281000e+01   4.09000000e+00   1.21064000e+03   6.25770000e+01
   1.62332100e+03   2.03682000e+01   1.00000000e+00   2.96000000e+02
   1.53000000e+01   3.96900000e+02   4.98000000e+00   8.76160000e+04
   4.52880000e+03   1.17482400e+05   1.47408000e+03   2.34090000e+02
   6.07257000e+03   7.61940000e+01   1.57529610e+05   1.97656200e+03
   2.48004000e+01]
24.0

Stability selection


In [47]:
from sklearn.cross_validation import cross_val_score
from sklearn.linear_model import RandomizedLogisticRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import make_pipeline

In [48]:
threshold = 0.03
stability_selection = RandomizedLogisticRegression(n_resampling=300, n_jobs=1, random_state=101, scaling=0.15, 
                                                   sample_fraction=0.50, selection_threshold=threshold)
interactions = PolynomialFeatures(degree=4, interaction_only=True)
model = make_pipeline(stability_selection, interactions, logit)
model.fit(Xt,yt)


/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
/usr/local/lib/python3.4/dist-packages/sklearn/linear_model/randomized_l1.py:53: DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead
  for _ in range(n_resampling)):
Out[48]:
Pipeline(steps=[('randomizedlogisticregression', RandomizedLogisticRegression(C=1, fit_intercept=True,
               memory=Memory(cachedir=None), n_jobs=1, n_resampling=300,
               normalize=True, pre_dispatch='3*n_jobs', random_state=101,
               sample_fraction=0.5, scaling=0.15, selection...ty='l2', random_state=None, solver='liblinear', tol=0.0001,
          verbose=0, warm_start=False))])

In [49]:
print(Xt.shape)
print(yt.shape)
#print(Xt)
#print(yt)
#print(model.steps[0][1].all_scores_)


(2000, 500)
(2000,)

In [50]:
print ('Number of features picked by stability selection: %i' % np.sum(model.steps[0][1].all_scores_ >= threshold))


Number of features picked by stability selection: 19

In [51]:
from sklearn.metrics import roc_auc_score
print ('Area Under the Curve: %0.3f' % roc_auc_score(yv,model.predict_proba(Xv)[:,1]))


Area Under the Curve: 0.884

In [ ]: