Giter Club home page Giter Club logo

islp_labs's Introduction

ISLP_labs

All Contributors

Authors

  • Trevor Hastie

  • Robert Tibshirani

  • Daniela Witten

Binder

Up-to-date version of labs for ISLP.

This repo will track labs for ISLP as their source code changes. The intent is that building a conda environment with requirements.txt will reproduce the results in this repo.

To install the current version of the requirements run

pip install -r https://raw.githubusercontent.com/intro-stat-learning/ISLP_labs/v2.2/requirements.txt;

The labs can now be run from this directory:

jupyter lab Ch02-statlearning-lab.ipynb

Zip / tarball

You can download all the labs as a .zip or .tar.gz here

Contributors โœจ

Thanks goes to these wonderful people (emoji key):

tibshirani
tibshirani

๐Ÿ’ป ๐Ÿ–‹
trevorhastie
trevorhastie

๐Ÿ’ป ๐Ÿ–‹
danielawitten
danielawitten

๐Ÿ’ป ๐Ÿ–‹
Jonathan Taylor
Jonathan Taylor

๐Ÿ’ป ๐Ÿ–‹

This project follows the all-contributors specification. Contributions of any kind welcome!

islp_labs's People

Contributors

allcontributors[bot] avatar danielawitten avatar jonathan-taylor avatar tibshirani avatar trevorhastie avatar tschm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

islp_labs's Issues

Lab Chapter 04 - standarization done before train/test split

Hi @jonathan-taylor ,

I think any preprocessing like standardization should be done before the train/test split to avoid data leakage. In Lab 04, in cells 53-57 the whole dataset is first standardized and then split. I suggest the train / test split should be done as a first step. Then a standardization fit_transform() should take place on X_train only and then finally scaler.transform() on X_test. This approach avoids the

" y_test) = train_test_split(np.asarray(feature_std),\n",

(X_train,
 X_test,
 y_train,
 y_test) = train_test_split(np.asarray(feature_std),
                            Purchase,
                            test_size=1000,
                            random_state=0)

BR
Grzegorz

Installation under Python 3.12 fails

Hello -

the frozen versions of various packages currently shown in this project's requirements.txt cannot be installed in Python 3.12 environments. To proceed with the installation, versions for several dependencies need to updated.
Updated list:
numpy==1.26.4
scipy==1.11.4
pandas==2.2.2
lxml==5.2.2
scikit-learn
joblib==1.4.2
statsmodels==0.14.2
lifelines==0.28.0
pygam==0.9.1
l0bnb==1.0.0
torch==2.3.0
torchvision==0.18.0
pytorch-lightning==2.2.4
torchinfo==1.8.0
torchmetrics==1.4.0
ISLP==0.3.18

Note: I just finished setting this up, so this still needs further testing.

Typos

In Ch02-statlearn-lab.ipynb, should the circled text say ax.contour? instead? It does not look like plt has been defined at this point in the notebook. Also, all previous occurrences of displaying documentation have the question mark after the function, so maybe add a note that both ?fun and fun? will cause Python to display documentation associated with the function fun.

image

RunTimeErrors

When I try to repeat the lab from Chapter 10 about Neural Networks, Hitters dataset. I run into:

RuntimeError: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

RuntimeError: DataLoader worker (pid(s) 7156, 796, 15192, 304) exited unexpectedly.

So I assume it has something to do with multiprocessing, data_loader but I'm total newbie here.

Chapter 5 Conceptual exercise 2h

Hi, I think I found an error in the code snippet in exercise 2 in Chapter 5.

In the book (page 225) it's given as:

rng = np.random.default_rng(10) 
store = np.empty(10000)
for i in range(10000):
    store[i] = np.sum(rng.choice(100, replace=True) == 4) >0
np.mean(store)

During each iteration, only one number is chosen instead of a full sample.

I think it should be corrected to:

rng = np.random.default_rng(10) 
store = np.empty(10000)
for i in range(10000):
    store[i] = np.sum(rng.choice(100, size=100, replace=True) == 4) >0
    # as we would like to sample 100 observations at each attempt and check if 4 is among them
np.mean(store)

It gives 0.6362 which is the probability of the jth observation chosen when n goes infinity.

BR
Grzegorz

JupyterBook?

Going forward I would like to make sure that all notebooks are executed once they have been committed. This will add some extra level(s) of robustness. This could be done in the context of a JupyterBook that would iterate over all of them and put them into a book.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.