cs-5821/project/anna_program

24 lines
506 B
Plaintext
Raw Permalink Normal View History

2017-04-19 06:35:06 +00:00
# Get data from csv
setwd("~/Documents/Classes/CS5821/project/HTRU2")
raw_data = read.csv("HTRU_2.csv")
colnames(raw_data) = c("X1","X2","X3","X4","X5","X6","X7","X8","PLSR")
attach(raw_data)
# create a new set with equal amounts of both pulsars and not pulsars
ydata=which(PLSR==0)
ndata=which(PLSR==1)
set.seed(11)
data = rbind(sample(ydata,1500),sample(ndata,1500))
# QDA
library(ISLR)
library(MASS)
train=sample(data,2500)
qda.fit = qda(PLSR~X1+X2+X3+X4,data=data,subset=train)
summary(qda.fit)