cs-5821/project/anna_program
2017-04-19 02:35:06 -04:00

24 lines
506 B
Plaintext

# 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)