Skip to content

Commit f488cb4

Browse files
author
Chetanfs
committed
HW5 finished
1 parent 0d16c25 commit f488cb4

30 files changed

+2046
-255
lines changed

.Rhistory

+459-158
Large diffs are not rendered by default.

Learning from Data HW5 R Validation.R

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
setwd("../Dropbox/College/3_Third Year/Summer Learning/Learning From Data/")
2+
library(ggplot2)
3+
library(data.table)
4+
5+
#Num 8 -- Making sure points are linearally separable
6+
randDat <- data.table(read.csv("hw5Programs/test.csv", header=F))
7+
ggplot(dat=randDat, aes(x=V2, y=V3, col=as.factor(V4))) +
8+
geom_point()
9+
10+
#Num 8 -- Make sure weights trained correctly
11+
logisticEval <- function(x) 1/(1+exp(-x))
12+
setnames(randDat, names(randDat), c("x0", "x1", "x2", "actual", "pred"))
13+
14+
w <- read.csv("hw5Programs/testW.csv", header=F)[,1]
15+
randDat[,"s":=as.matrix(randDat[,1:3, with=F])%*%w]
16+
randDat[,"prob":=logisticEval(s)]
17+
randDat[,"pred":=ifelse(prob>0.5, 1, -1)]
18+
randDat[, "predWrong":=pred!=actual]
19+
20+
ggplot(dat=randDat, aes(x=x1, y=x2, col=as.factor(actual),
21+
size=as.factor(predWrong))) +
22+
geom_point()
23+
24+
randDat[predWrong == "TRUE"]

Learning from Data HW5.docx

364 KB
Binary file not shown.
15.5 KB
Binary file not shown.

hw4Programs/.idea/workspace.xml

+59-97
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hw5Programs/.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hw5Programs/.idea/compiler.xml

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hw5Programs/.idea/copyright/profiles_settings.xml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hw5Programs/.idea/misc.xml

+26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hw5Programs/.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hw5Programs/.idea/uiDesigner.xml

+124
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hw5Programs/.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)