Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is the assignment 6! #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Assignment6.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Assignment 6"
author: "Charles Lang"
date: "11/16/2016"
author: "Shu-Yi Hsu"
date: "12/17/2016"
output: html_document
---
#Addignment 6
Expand All @@ -25,19 +25,19 @@ library(rpart)
#Upload the data sets MOOC1.csv and MOOC2.csv
M1 <- read.csv("MOOC1.csv", header = TRUE)

M2 <-
M2 <- read.csv("MOOC2.csv", header = TRUE)

```

#Decision tree
```{r}
#Using the rpart package generate a classification tree predicting certified from the other variables in the M1 data frame. Which variables should you use?

c.tree1 <-
c.tree1 <- rpart(certified~ forum.posts+grade, method ="class", data = M1)

#Check the results from the classifcation tree using the printcp() command


printcp(c.tree1)

#Plot your tree

Expand All @@ -52,7 +52,7 @@ post(c.tree1, file = "tree1.ps", title = "MOOC") #This creates a pdf image of th
#If we are worried about overfitting we can remove nodes form our tree using the prune() command, setting cp to the CP value from the table that corresponds to the number of nodes we want the tree to terminate at. Let's set it to two nodes.

```{r}
c.tree2 <- prune(c.tree1, cp = )#Set cp to the level at which you want the tree to end
c.tree2 <- prune(c.tree1, cp = 0.01)#Set cp to the level at which you want the tree to end

#Visualize this tree and compare it to the one you generated earlier

Expand Down
489 changes: 489 additions & 0 deletions Assignment6.html

Large diffs are not rendered by default.

Binary file added tree1.ps
Binary file not shown.
Binary file added tree2.ps
Binary file not shown.