Code Monkey home page Code Monkey logo

r-deep-learning's Introduction

R Deep Learning

DataHub Binder License: CC BY 4.0 Workshop Materials

This is the repository for D-Lab’s six-hour Introduction to Deep Learning in R workshop.

Prerequisites

We recommend attendees be intermediate R users and have had some prior exposure to the concepts in R-Machine-Learning.

Check D-Lab's Learning Pathways to figure out which of our workshops to take!

Workshop Goals

In this workshop, we provide an introduction to Deep Learning using TensorFlow and keras in R. First, we will cover the basics of what makes deep learning "deep." Then, we will explore using code to classify images. Along the way, we will build a workflow of a deep learning project.

Installation Instructions

We will use RStudio to go through the workshop materials, which requires installation of R, RStudio, and TensorFlow. Complete the following steps if you want to work locally.

  1. Download R and RStudio

  2. Within the R console, run the following commands

install.packages(c("tensorflow", "keras", "reticulate")) # Pulls in all R dependencies necessary for TensorFlow in R

library(reticulate)

# Set up R with a Python installation it can use
virtualenv_create("r-reticulate", python = install_python()) 

library(keras)
install_keras(envname = "r-reticulate") # Install TensorFlow and Keras python modules

After these steps you will have a working Keras and TensorFlow installation. This process will take some time if you decide to download to your local machine. To determine the TensorFlow version installed on your machine, run in the console

library(tensorflow)
tf$constant("Hello Tensorflow!")
  1. Install additional packages required for this workshop
install.packages(c("tfhub", "tfdatasets")

About the UC Berkeley D-Lab

D-Lab works with Berkeley faculty, research staff, and students to advance data-intensive social science and humanities research. Our goal at D-Lab is to provide practical training, staff support, resources, and space to enable you to use R for your own research applications. Our services cater to all skill levels and no programming, statistical, or computer science backgrounds are necessary. We offer these services in the form of workshops, one-to-one consulting, and working groups that cover a variety of research topics, digital tools, and programming languages.

Visit the D-Lab homepage to learn more about us. You can view our calendar for upcoming events, learn about how to utilize our consulting and data services, and check out upcoming workshops. Subscribe to our newsletter to stay up to date on D-Lab events, services, and opportunities.

Additional Resources

Other D-Lab R workshops

D-Lab offers a variety of R workshops, catered toward different levels of expertise.

Introductory Workshops

Intermediate and Advanced Workshops

r-deep-learning's People

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

r-deep-learning's Issues

Troubleshooting Missing Python Packages

Myself and other participants in the workshop have issues when fitting models using the image_data_generator() function in notebook 2 & 3.

The issues I and other have gotten so far include:

  1. "Error in py_call_impl(callable, dots$args, dots$keywords) : ImportError: Could not import PIL.Image. The use of load_img requires PIL."
  2. "Error in py_call_impl(callable, dots$args, dots$keywords) : ImportError: Could not import PIL.Image. The use of load_img requires PIL."
# For R-Deep-Learning package missing issues when using datagen

# Step 1: Figure out what package is missing, for example: 
#"Error in py_call_impl(callable, dots$args, dots$keywords) : ImportError: Could not import PIL.Image. The use of `load_img` requires PIL."  
# Issue is no python library PIL

# Step 2: Install the library using conda_install() from the reticulate package
library(reticulate)

# install SciPy
conda_install("r-reticulate", "scipy")
# install PIL
conda_install("r-reticulate", "PIL") # replace PIL with whatever python package is missing


# If conda_install() fails try:
py_install("PACKAGE_NAME_HERE")

# Step 3: Restart your R-session and try the code that broke again!

This worked well for most participants.

Workshop Title

Workshop title should be "R-Introduction-to-Deep-Learning:-Parts-1-2"

Auto-image downloader

Add auto-image downloader section to learn how to apply deep learning to image classes downloaded from Google.

Dataset revision suggestions to diversify human images (currently 90+% white)

Datasets look good except in notebook 2, where the people in the human image training and validation datasets look maybe ~90%+ white (a classic problem with a lot of this research: https://www.aaihs.org/race-after-technology/).

I didn't feel quite comfortable enough with the subject matter to revise the code to incorporate new datasets, but this could be a less white option:
https://paperswithcode.com/dataset/fairface

Since those are images of faces instead of full people, though, we could then compare it (possibly? not sure if the model would pick up white space differences more than faces) with this dog face dataset:
https://github.com/GuillaumeMougeot/DogFaceNet

Might also be great to incorporate into the slide deck some of the recent literature on how machine learning algorithm output can reproduce or magnify racist trends in the feeder datasets.

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.