Summary and Setup

This lesson explores key topics on the responsible application of machine learning. The lesson is presented as a series of case studies that illustrate real world examples. Sections cover a broad range of topics, including reproducibility, bias, and interpretability. Broadly the topics are ordered chronologically, appearing as they would when thinking through a research study.

{% comment %} This is a comment in Liquid {% endcomment %}

Prerequisites

You need to understand the basics of Python before tackling this lesson. The lesson sometimes references Jupyter Notebook although you can use any Python interpreter mentioned in the [Setup][lesson-setup].

Getting Started

To get started, follow the directions on the “[Setup][lesson-setup]” page to download data and install a Python interpreter.

Overview


This lesson is designed to be run on a personal computer. All of the software and data used in this lesson are freely available online, and instructions on how to obtain them are provided below.

Install Python


In this lesson, we will be using Python 3 with some of its most popular scientific libraries. Although one can install a plain-vanilla Python and all required libraries by hand, we recommend installing Anaconda, a Python distribution that comes with everything we need for the lesson. Detailed installation instructions for various operating systems can be found on The Carpentries template website for workshops and in Anaconda documentation.

Obtain lesson materials


  1. Create a folder called ml-responsible on your Desktop.
  2. Create a subfolder called data.
  3. Download eicu_v2_0_1.sqlite3.gz from the Files section of the project page.
  4. Move downloaded file to ml-responsible/data.
  5. Unzip the file.

Launch Python interface


To start working with Python, we need to launch a program that will interpret and execute our Python commands. Below we list several options. If you don’t have a preference, proceed with the top option in the list that is available on your machine. Otherwise, you may use any interface you like.

Option A: Jupyter Notebook


A Jupyter Notebook provides a browser-based interface for working with Python. If you installed Anaconda, you can launch a notebook in two ways:

  1. Launch Anaconda Navigator. It might ask you if you’d like to send anonymized usage information to Anaconda developers: Anaconda Navigator first launch Make your choice and click “Ok, and don’t show again” button.
  2. Find the “Notebook” tab and click on the “Launch” button: Anaconda Navigator Notebook launch Anaconda will open a new browser window or tab with a Notebook Dashboard showing you the contents of your Home (or User) folder.
  3. Navigate to the data directory by clicking on the directory names leading to it: Desktop, swc-python, then data: Anaconda Navigator Notebook directory
  4. Launch the notebook by clicking on the “New” button and then selecting “Python 3”: Anaconda Navigator Notebook directory

1. Navigate to the data directory:

If you’re using a Unix shell application, such as Terminal app in macOS, Console or Terminal in Linux, or Git Bash on Windows, execute the following command:

BASH

cd ~/Desktop/swc-python/data

On Windows, you can use its native Command Prompt program. The easiest way to start it up is pressing Windows Logo Key+R, entering cmd, and hitting Return. In the Command Prompt, use the following command to navigate to the data folder:

cd /D %userprofile%\Desktop\swc-python\data

2. Start Jupyter server

BASH

jupyter notebook
python -m notebook

3. Launch the notebook by clicking on the “New” button on the right and selecting “Python 3” from the drop-down menu: Anaconda Navigator Notebook directory

 

Option B: Cloud Notebook


Colaboratory, or “Colab”, is a cloud service that allows you to run a Jupyter-like Notebook in a web browser. To open a notebook, visit the Colaboratory website