undefined

Profile Picture
This user has no profile information.
Libraries (View all)
This introduction to R provides a first look into a number of R functionalities, inluding reading data, processing data, and modeling. It includes dives into extremely useful packages such as dplyr and caret.
Modified on: Apr 9, 2018

David M Smith (@revodavid), Developer Advocate at Microsoft

Last updated: April 9, 2018 Clone this library to get the latest updates

This self-guided workshop provides R scripts to demonstrate various AI techniques using the Microsoft Cognitive Services APIs in Azure. The scripts are provided as Jupyter Notebooks within the Azure Notebooks service. You don't need a Microsoft Account to view the scripts, but you will need to set one up and generate keys in Azure to run the examples. All of the examples use free Azure services.

If you're new to Notebooks, check out the Jupyter Notebook documentation.

If you're new to R, you might want to start with this Introduction to R notebook to get a sense of the language.

You will need:

  1. A Microsoft account. You can use an existing Outlook 365 or Xbox Live account, or create a new one.

  2. A Microsoft Azure subscription. If you don't already have an Azure subscription, you can visit https://cda.ms/kT and also get $200 in credits to use with paid services. You'll need to provide a credit or debit card, but everything we'll be doing is free to use. If you're a student, you can also register at https://cda.ms/kY without a credit card for a $100 credit.

You'll also need a few other things specific to this workshop. Follow the instructions below to set up everything you need.

  1. Visit https://portal.azure.com
  2. Sign in with your Microsoft Account. If you don't have a Microsoft account, use the links above to create one for free.

In Azure, a Resource Group is a collection of services you have created. It groups services together, and makes it easy to bulk-delete things later on. We'll create one for this lab.

  1. Visit https://portal.azure.com (and sign in if needed)
  2. Click "Resource Groups" in the left column
  3. Click "+ Add"
    • Resource Group Name: qcon
    • Subscription: there should be just one option
    • Resource Group Location: East US
  4. Click "Create"

A notification will appear in the top right. Click the button "Pin to Dashboard" to pin this resource group to your home page in the Azure portal, as you'll be referring to it frequently.

  1. Visit https://portal.azure.com (and sign in if needed)
  2. Click "+ Create a Resource" (top-left corner)
  3. Click "AI + Cognitive Services"
  4. Click "Computer Vision API"
    • Name: qcon-vision
    • Subscription: there should be just one option
    • Location: East US
    • Pricing Tier: F0 (free, 20 calls per minute)
    • Resource Group: Use existing "qcon" group
  5. Click "Create""
  1. Visit https://portal.azure.com (and sign in if needed)
  2. Click "+ Create a Resource" (top-left corner)
  3. With the "Search the Marketplace" box, search for "Custom Vision Service"
  4. Select "Custom Vision Service (preview)" and click "Create"
    • Name: qcon-customvision
    • Subscription: there should be just one option
    • Location: South Central US
    • Prediction Pricing Tier: F0 (free, 2 transactions per second)
    • Training pricing Tier: F0 (2 projects)
    • Resource Group: Use existing "qcon" group
  5. Click "Create"
  1. Visit https://notebooks.azure.com/davidsmi/libraries/qcon
    • Sign in with your Microsoft account if needed
  2. click Clone in the toolbar, to create a copy of the workshop materials

Download the file and provide the keys listed from the Azure Portal.

(To download this file, highlight it in the Library view and then press or click the download icon in the toolbar.)

For the first line of the file, , change it to . For the remaining keys, visit your resource group in the Azure Portal and then:

  1. Click on the API resource for Computer Vision

  2. In the menu, click on "keys"

  3. Click the "copy to clipboard" next to KEY 1. (You can ignore KEY 2).

  4. Paste the key into the entry in keys.txt

  5. Click on the API resource for Custom Vision

  6. In the menu, click on "keys"

  7. Click the "copy to clipboard" next to KEY 1. (You can ignore KEY 2).

  8. Paste the key into the entry in keys.txt

  9. Click on the API resource for Custom Vision (this resource was created automatically for you).

  10. In the menu, click on "keys"

  11. Click the "copy to clipboard" next to KEY 1. (You can ignore KEY 2).

  12. Paste the key into the entry in keys.txt

Your final file will look like this, but with different (working) keys:

Once you've done this for all the cognitive services, save the file and upload it to replace the existing file in Azure Notebooks. To upload the modified file, go to the Library and press the "+" (New File) icon or press , click "From Computer" > "Choose Files" and select the file on your hard drive, and click "Upload". A box saying "File Exists, Overwrite?" will appear; click it to continue.

The R scripts are provided as Jupyter Notebook files (with the extension). You can tackle the files in any order, but we recommend the following sequence:

  1. : Explore analyzing images from Wikimedia Commons using the Microsoft Vision API
  2. : Create the "Not Hotdog" image recognition application featured in Silicon Valley

For more examples of using the Cognitive Services APIs from R, take a look a the following blog posts. R code is included in the posts or in linked Github repositories.

If you get stuck or just have other questions, you can contact me here:

David Smith

Modified on: Apr 12, 2018
  • The story revolves around image processing in R
  1. Introduction, history and perspective (basically general context)
  2. Jupyter notebook inner workings in the context of the R kernel ( package)
  • Tour of Notebooks and Short Image Analysis Lab
  • Become familiar with the anatomy of notebooks
  • Learn how to efficiently navigate and work with notebooks
  • Gain some practice using shortcuts
  • Perform a short image analysis lab
  • Reproducible research - how Jupyter and R can address this
  • Expanded image analysis lab
  • Become comfortable building out a solution in notebooks with R and making it reproducible
  • Gain/regain the experience of a "hackathon" style lab involving collaboration
  • Become more comfortable and familiar with the notebook shortcuts and tools
  • Get some experience doing image color quantization
  • Microsoft Azure and Jupyter notebooks (they've got a few services available)
  • Teaching, training and workshoping with Jupyter notebooks
  • Wrap up
  • Jupyter's power is in having code, data, and text all accessible from one file viewed in a browser, living locally or in the cloud.
  • The Jupyter Project used to be part of the IPython Project and has spun off.
  • It supports over 40 different languages (see this article) and that is actively growing.

The text in a notebook is written in the simple markdown language, making it a rich format capable of "rendering" latex, links, images and even html (since we're in a browser and the R kernel let's us).

Amazing fact: in 2014, there were 80,000 jupyter notebooks on github. In 2015 the number almost tripled to 230,000. This shows how popular and fast-growing the usage is in the community.

  • github numbers from article by Alex Perrier here
Modified on: Apr 5, 2018
Starred Libraries (View all starred libraries)