In [1]:
!pip install .


Processing /Users/Rita/Desktop/STA_663/STA-663-Final-Project-colab/fastfsr
  Requirement already satisfied (use --upgrade to upgrade): fastfsr==0.1 from file:///Users/Rita/Desktop/STA_663/STA-663-Final-Project-colab/fastfsr in /Users/Rita/anaconda/lib/python3.5/site-packages

In [2]:
import fastfsr

In [3]:
import pandas as pd
ncaa = pd.read_csv("http://www4.stat.ncsu.edu/~boos/var.select/ncaa.data2.txt", 
                   delim_whitespace = True)
x = ncaa.ix[:,:-1]
y = ncaa.ix[:,-1]
x.head()


Out[3]:
x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19
0 13 17 9 15 28.0 0 -1.14045 3.660 4.490 3409 65.8 18 81 42.2 660000 77 100 59 1
1 28 20 32 18 18.4 18 -0.13719 2.594 3.610 7258 66.3 17 82 40.5 150555 88 94 41 25
2 32 20 20 20 34.8 18 1.55358 2.060 4.930 6405 75.0 19 71 46.5 415400 94 81 25 36
3 32 21 24 21 14.5 20 2.05712 2.887 3.876 18294 66.0 16 84 42.2 211000 93 88 26 13
4 24 20 16 20 21.8 13 -0.77082 2.565 4.960 8259 63.5 16 91 41.2 44000 90 92 32 31

In [4]:
fastfsr.lasso_fit(x,y)


Out[4]:
{'df_residual': 92,
 'fitted': array([ 52.92355824,  57.0009211 ,  57.0009211 ,  58.36004205,
         57.0009211 ,  54.28267919,  58.36004205,  66.51476775,
         55.64180014,  63.79652585,  55.64180014,  59.719163  ,
         61.07828395,  59.719163  ,  69.23300966,  55.64180014,
         54.28267919,  62.4374049 ,  58.36004205,  51.56443729,
         62.4374049 ,  62.4374049 ,  57.0009211 ,  54.28267919,
         63.79652585,  58.36004205,  59.719163  ,  59.719163  ,
         58.36004205,  57.0009211 ,  55.64180014,  59.719163  ,
         54.28267919,  58.36004205,  52.92355824,  61.07828395,
         55.64180014,  59.719163  ,  62.4374049 ,  63.79652585,
         58.36004205,  59.719163  ,  57.0009211 ,  57.0009211 ,
         62.4374049 ,  57.0009211 ,  58.36004205,  58.36004205,
         55.64180014,  62.4374049 ,  67.87388871,  59.719163  ,
         58.36004205,  58.36004205,  59.719163  ,  55.64180014,
         57.0009211 ,  61.07828395,  59.719163  ,  59.719163  ,
         67.87388871,  62.4374049 ,  55.64180014,  52.92355824,
         51.56443729,  58.36004205,  55.64180014,  67.87388871,
         62.4374049 ,  59.719163  ,  59.719163  ,  58.36004205,
         51.56443729,  59.719163  ,  61.07828395,  57.0009211 ,
         54.28267919,  61.07828395,  61.07828395,  65.1556468 ,
         62.4374049 ,  62.4374049 ,  55.64180014,  57.0009211 ,
         65.1556468 ,  65.1556468 ,  59.719163  ,  57.0009211 ,
         65.1556468 ,  59.719163  ,  58.36004205,  55.64180014,
         61.07828395,  57.0009211 ]),
 'index': array([1]),
 'residual': 15913.861386451388,
 'size': 1}

In [5]:
pval = np.array([  1.11022302e-16,   6.95109478e-05,   1.15845889e-02,
          5.29907450e-03,   2.48342482e-03,   4.33151925e-02,
          5.27341418e-02,   1.05631519e-01,   8.26270613e-02,
          5.36356789e-02,   2.34958569e-01,   2.86440303e-01,
          3.16318194e-01,   2.69726331e-01,   4.95325787e-01,
          6.32648734e-01,   7.05641795e-01,   8.60540370e-01,
          9.03197593e-01])
fastfsr.fsr_fast_pv(pval, x.shape[1])


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-5-a8a2b02b053c> in <module>()
----> 1 pval = np.array([  1.11022302e-16,   6.95109478e-05,   1.15845889e-02,
      2           5.29907450e-03,   2.48342482e-03,   4.33151925e-02,
      3           5.27341418e-02,   1.05631519e-01,   8.26270613e-02,
      4           5.36356789e-02,   2.34958569e-01,   2.86440303e-01,
      5           3.16318194e-01,   2.69726331e-01,   4.95325787e-01,

NameError: name 'np' is not defined

In [ ]: