dlab-berkeley / R-Machine-Learning-Legacy

D-Lab's 6 hour introduction to machine learning in R. Learn the fundamentals of machine learning, regression, and classification, using tidymodels in R.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

D-Lab R Machine Learning with tidymodels

DataHub Binder License: CC BY 4.0

This repository contains the materials for D-Lab's R Machine Learning with tidymodels. Prior experience with the concepts in R Fundamentals and Data Wrangling and Manipulation in R is assumed.

Workshop Goals

In this workshop, we provide an introduction to machine learning algorithms by making use of the tidymodels package. First, we discuss what machine learning is, what problems it works well for, and what problems it might work less well for. Then, we'll explore the tidymodels framework to learn how to fit machine learning models in R. Finally, we will apply the tidymodels framework to explore multiple machine learning algorithms in R.

By the end of the workshop, learners should feel prepared to explore machine learning approaches for their data problems.

Familiarity with R programming and data wrangling is assumed. If you are not familiar with the materials in Data Wrangling and Manipulation in R, we recommend attending that workshop first. In addition, this workshop focuses on how to implement machine learning approaches. Learners will likely benefit from previous exposure to statistics.

Installation Instructions

We will use RStudio to go through the workshop materials, which requires the installation of both the R language and the RStudio software. Complete the following steps:

  1. Download R: Follow the links according to the operating system that you are running. Download the package, and install R onto your computer. You should install the most recent version (at least version 4.0).

  2. Download RStudio: Install RStudio Desktop. This should be free. Do this after you have already installed R. The D-Lab strongly recommends an RStudio edition of 2022.02.0+443 "Prairie Trillium" or higher.

  3. Download these workshop materials:

  • Click the green "Code" button in the top right of the repository information.
  • Click "Download Zip".
  • Extract this file to a folder on your computer where you can easily access it (we recommend Desktop).
  1. Optional: if you're familiar with git, you can instead clone this repository by opening a terminal and entering git clone git@github.com:dlab-berkeley/R-Machine-Learning.git.

  2. Be sure to run the install.R script in the repository so that all necessary packages are installed.

Is R Not Working on Your Laptop?

This workshop makes use of many packages within the R ecosystem. For that reason, we recommend using R on your local machine.

If you do not have R installed and the materials loaded on your workshop by the time it starts, we strongly recommend using the UC Berkeley DataHub to run the materials for these lessons. You can access the DataHub by clicking the following button:

DataHub

Some users may have to click the link twice if the materials do not load initially.

The DataHub downloads this repository, along with any necessary packages, and allows you to run the materials in an RStudio instance on UC Berkeley's servers. No installation is needed from your end - you only need an internet browser and a CalNet ID to log in. By using the DataHub, you can save your work and come back to it at any time. When you want to return to your saved work, go straight to DataHub, sign in, and click on the R-Machine-Learning folder.

If you don't have a Berkeley CalNet ID, you can still run these lessons in the cloud, by clicking this button:

Binder

If you are loading Binder with this repository for the first time, it may take a few minutes to set up. Binder operates similarly to the D-Lab DataHub, but on a different set of servers. By using Binder, however, you cannot save your work.

Run the Code

Now that you have all the required software and materials, you need to run the code:

  1. Launch the RStudio software.

  2. Use the file navigator to find the R-Machine-Learning folder you downloaded from Github.

  3. Open up the file corresponding to the part of the workshop you're attending.

  4. If necessary, run install.R to make sure the requisite packages are installed. This should not be necessary on Binder.

  5. Place your cursor on a given line and press "Command + Enter" (Mac) or "Control + Enter" (PC) to run an individual line of code.

  6. The solutions folder contains the solutions to the challenge problems.

Additional Resources

This workshop draws heavily on the following resources:

Other D-Lab R Workshops

Basic Competency

Intermediate/Advanced Competency

Contributors

Previous iterations of D-Lab's Machine Learning with R were created by:

About

D-Lab's 6 hour introduction to machine learning in R. Learn the fundamentals of machine learning, regression, and classification, using tidymodels in R.

License:Other


Languages

Language:R 100.0%