ml-workshop-advanced

MIT License

Stars
15
Committers
1

Advanced Machine Learning with scikit-learn

Text Data, Imbalanced Data, and Poisson Regression

By Thomas J. Fan

Link to slides

Scikit-learn is a Python machine learning library used by data science practitioners from many disciplines. During this training, we will learn about processing text data, working with imbalanced data, and Poisson regression. We will start by processing text data with scikit-learn's vectorizers. Since the output of these vectorizers is sparse, we will also review scikit-learn estimators that can handle sparse data. We will look at estimators with class weights, resampling techniques provided by imbalanced-learn, and using a bagging classifier with balancing. Next, we will explore how to work with imbalanced data where one of the classes appears more frequently than the others. Finally, we will learn about generalized linear models focusing on Poisson regression. Poisson regression models target distributions that are counts or relative frequencies. We will use tree-based models such as Histogram-based Gradient Boosted Trees with a Poisson loss to model relative frequencies.

Obtaining the Material

With git

The most convenient way to download the material is with git:

git clone https://github.com/thomasjpfan/ml-workshop-advanced

Please note that I may add and improve the material until shortly before the session. You can update your copy by running:

git pull origin master

Download zip

If you are not familiar with git, you can download this repository as a zip file at: github.com/thomasjpfan/ml-workshop-advanced/archive/master.zip. Please note that I may add and improve the material until shortly before the session. To update your copy please re-download the material a day before the session.

Running the notebooks

Local Installation

Local installation requires conda to be installed on your machine. The simplest way to install conda is to install miniconda by using an installer for your operating system provided at docs.conda.io/en/latest/miniconda.html. After conda is installed, navigate to this repository on your local machine:

cd ml-workshop-advanced

Then download and install the dependencies:

conda env create -f environment.yml

This will create a virtual environment named ml-workshop-advanced. To activate this environment:

conda activate ml-workshop-advanced

Finally, to start jupyterlab run:

jupyter lab

This should open a browser window with the jupterlab interface.

Run with Google's Colab

If you have any issues with installing conda or running jupyter on your local computer, then you can run the notebooks on Google's Colab:

  1. Text Data
  2. Imbalanced data
  3. Poisson regression

License

This repo is under the MIT License.