HW 1 ORIE 4740 - HW 1 – Orie 4740 Shradha Jain – sj259> olivePred< function dat predict the region for olive oil samples dat should be a

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: HW # 1 – Orie 4740 Shradha Jain – sj259 > olivePred <- function( dat ){ + # predict the region for olive oil samples. dat should be a data.frame + # containing the fatty acid levels. + nSamps <- dim(dat)[1]; + predRegion <- rep( 0, nSamps ); + for( i in (1:nSamps) ){ + if( dat$eicosenoic[i] > 7 ){ + predRegion[i] <- 1; + } else if( dat$linoleic[i] > 1050 ){ + predRegion[i] <- 2; + } else { + predRegion[i] <- 3; + } + } + return( predRegion ); + } > olivePred(oliveTest) [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [75] 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 [112] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 > predAccuracy <- function( dat ){...
View Full Document

This note was uploaded on 12/13/2009 for the course ORIE 4740 taught by Professor Dawn during the Fall '08 term at Cornell University (Engineering School).

Page1 / 6

HW 1 ORIE 4740 - HW 1 – Orie 4740 Shradha Jain – sj259> olivePred< function dat predict the region for olive oil samples dat should be a

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online