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

Complete! - Jie Chen #110

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 5 additions & 6 deletions Assignment 5.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ D2 <- read.csv("intelligent_tutor_new.csv")

#Generate predicted advice using the predict() command for new students based on tree generated from old students

D2$prediction <- predict(score_ctree,D2)

D2$prediction <- predict(score_ctree,D2, "class")
```
## Part III
Compare the predicted advice with the actual advice that these students recieved. What is the difference between the observed and predicted results?
Expand All @@ -99,13 +98,13 @@ The following results show that the predicted "no action" is less than the one o
# Intervene: 2%

# Predicted
D3 <- apply(D2$prediction,1,which.max)

# No Action
sum(D3 == 3) / length(D3) # 64.5%
sum(D2$prediction == "No Action") / nrow(D2) # 64.5%
# Monitor Progress
sum(D3 == 2) / length(D3) # 34.5%
sum(D2$prediction == "Monitor Progress") / nrow(D2) # 34.5%
# Intervene
sum(D3 == 1) / length(D3) # 0.01%
sum(D2$prediction == "Intervene") / nrow(D2) # 0.01%
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work in general! I am not sure why you need to add "class" in "predict" function. Sometimes it is good to specify the argument and add comments to explain that. Attach the predict function document here for your reference: https://www.rdocumentation.org/packages/stats/versions/3.6.0/topics/predict.lm


```

Expand Down
16 changes: 8 additions & 8 deletions Assignment-5.html
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,9 @@ <h2>Part I</h2>
## n= 378
##
## CP nsplit rel error xerror xstd
## 1 0.052 0 1.000 1.096 0.034730
## 2 0.012 1 0.948 1.024 0.036359
## 3 0.010 2 0.936 0.972 0.037264</code></pre>
## 1 0.052 0 1.000 1.088 0.034934
## 2 0.012 1 0.948 1.048 0.035867
## 3 0.010 2 0.936 0.996 0.036873</code></pre>
<pre class="r"><code>#Plot the tree
post(c.tree, file = &quot;tree.ps&quot;, title = &quot;Session Completion Action: 1 - Ask teacher, 2 - Start new session, 3 - Give up&quot;)

Expand Down Expand Up @@ -445,7 +445,7 @@ <h2>Part I</h2>

#Generate predicted advice using the predict() command for new students based on tree generated from old students

D2$prediction &lt;- predict(score_ctree,D2)</code></pre>
D2$prediction &lt;- predict(score_ctree,D2, &quot;class&quot;)</code></pre>
</div>
<div id="part-iii" class="section level2">
<h2>Part III</h2>
Expand All @@ -457,15 +457,15 @@ <h2>Part III</h2>
# Intervene: 2%

# Predicted
D3 &lt;- apply(D2$prediction,1,which.max)

# No Action
sum(D3 == 3) / length(D3) # 64.5%</code></pre>
sum(D2$prediction == &quot;No Action&quot;) / nrow(D2) # 64.5%</code></pre>
<pre><code>## [1] 0.645</code></pre>
<pre class="r"><code># Monitor Progress
sum(D3 == 2) / length(D3) # 34.5%</code></pre>
sum(D2$prediction == &quot;Monitor Progress&quot;) / nrow(D2) # 34.5%</code></pre>
<pre><code>## [1] 0.345</code></pre>
<pre class="r"><code># Intervene
sum(D3 == 1) / length(D3) # 0.01%</code></pre>
sum(D2$prediction == &quot;Intervene&quot;) / nrow(D2) # 0.01%</code></pre>
<pre><code>## [1] 0.01</code></pre>
<div id="to-submit-your-assignment" class="section level3">
<h3>To Submit Your Assignment</h3>
Expand Down