---
title: "Quiz 1: STAT 3622 Data Visualization"
date: 19 September 2016 (Monday)
output: pdf_document
fontsize: 12pt
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo=FALSE, message=FALSE, warning=FALSE)
```
## 1. Stem-and-Leaf Plot (3pt)
The stem-and-leaf plot for a numerical variable splits the scores into **stem** (the first digit/digits, listed downward) and **leaf** (usulaly the last digit, listed rightward). For example, we may take a random sample of `iris$Septal.Length` and use the R function `stem` to display the stem-and-leaf plot as follows.
```{r}
set.seed(999)
sample_rows = sample(1:nrow(iris), 30)
tmp = iris$Sepal.Length[sample_rows]
tmp = tmp[-which((tmp*10)%%10==0)]
# length(tmp)
stem(tmp)
# hist(tmp,4)
```
Convert it to the histogram with 4 breaks (i.e. bins). Draw the picture.
\pagebreak
## 2. Chernoff Faces (4pt)
Chernoff faces, invented by Herman Chernoff (currently at Harvard), may display multivariate data in terms of a human face, including shape, size, plancement and orientation of face, eyes, ears, mouth, nose and hair, as well as emotional expression. One may compare the samples based on the changes/differences among such *statistical* faces.
In R, we may use the `faces` function from the `aplpack` package to plot Chernoff faces, e.g. using a random sample of 9 observations of `iris` dataset.
```{r fig.width=5, fig.asp=1.0, fig.align='center'}
library(aplpack)
set.seed(222)
sample_rows = sample(1:nrow(iris), 9)
tmp = iris[sample_rows,]
labels = paste(1:9, as.character(tmp$Species), sep=": ")
faces(tmp[,1:4], labels = labels, print.info=F, ncolors=0)
```
Rank order these 9 samples based on different parts of faces. For example: height of nose 1>{5,6}>7>3>{9,8}>{2,4} (this feature can be skipped in your answer.)
\pagebreak
## 3. Data Science Workflow (3pt)
Suppose you are a data scientist at Facebook responsible for an image recognition and tagging project. You need to design intelligent algorithms for 1) recognizing faces and 2) suggesting tags, when a new image is uploaed; see an illustration below. How would you approach to solving this problem in different steps?
```{r, out.width = "280px", fig.align='center'}
knitr::include_graphics("ImageLearning.png")
```