mirror of
				https://asciireactor.com/otho/cs-5821.git
				synced 2025-10-31 17:48:04 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			506 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			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)
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 |