linearRegression2_9perPage - Outline Announcements Multiple...

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

View Full Document Right Arrow Icon
Multiple Linear Regression Data Mining Prof. Dawn Woodard School of ORIE Cornell University 1 Outline 1 Announcements 2 Homework 3 Multiple Linear Regression 4 Testing for Important Predictors 2 Announcements Questions? My Thursday OfFce hours are cancelled 4 Homework The code for the naive Bayes function was originally: ... cdist = table(D[,cRow])/nRow for (j in 1:nAttr) { tmpAdist = table(D[,cRow],D[,j])/nRow for(i in 1:dim(cdist)) { tmpAdist[i,] = tmpAdist[i,]/cdist[i] } adist = c(adist,list(tmpAdist)) } ... 6 Homework The code for the naive Bayes function was originally: ... # here we calculate the marginal prob. of Y : cdist = table(D[,cRow])/nRow for (j in 1:nAttr) { tmpAdist = table(D[,cRow],D[,j])/nRow for(i in 1:dim(cdist)) { tmpAdist[i,] = tmpAdist[i,]/cdist[i] } adist = c(adist,list(tmpAdist)) } ... 7 Homework The code for the naive Bayes function was originally: ... cdist = table(D[,cRow])/nRow for (j in 1:nAttr) { # ±or each predictor X j ... tmpAdist = table(D[,cRow],D[,j])/nRow for(i in 1:dim(cdist)) { tmpAdist[i,] = tmpAdist[i,]/cdist[i] } adist = c(adist,list(tmpAdist)) } ... 8 Homework The code for the naive Bayes function was originally: ... cdist = table(D[,cRow])/nRow for (j in 1:nAttr) { # Here we calculate the joint dist’n of Y and X j : tmpAdist = table(D[,cRow],D[,j])/nRow for(i in 1:dim(cdist)) { tmpAdist[i,] = tmpAdist[i,]/cdist[i] } adist = c(adist,list(tmpAdist)) } ... 9 Homework The code for the naive Bayes function was originally: ... cdist = table(D[,cRow])/nRow for (j in 1:nAttr) { tmpAdist = table(D[,cRow],D[,j])/nRow # ±or each possible value of Y (i.e. 0 and 1): for(i in 1:dim(cdist)) { tmpAdist[i,] = tmpAdist[i,]/cdist[i] } adist = c(adist,list(tmpAdist)) } ... 10 Homework The code for the naive Bayes function was originally: ... cdist = table(D[,cRow])/nRow for (j in 1:nAttr) { tmpAdist = table(D[,cRow],D[,j])/nRow for(i in 1:dim(cdist)) { # Divide the i th row of the joint prob. table by # the i th element of the marginal prob. vector tmpAdist[i,] = tmpAdist[i,]/cdist[i] } adist = c(adist,list(tmpAdist)) } ... 11
Background image of page 1

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

View Full DocumentRight Arrow Icon
Homework The code for the naive Bayes function was originally: ... cdist = table(D[,cRow])/nRow for (j in 1:nAttr) { tmpAdist = table(D[,cRow],D[,j])/nRow for(i in 1:dim(cdist)) { tmpAdist[i,] = tmpAdist[i,]/cdist[i] } # Store the conditional prob. table: adist = c(adist,list(tmpAdist)) } ... 12 Homework How do we modify it to calculate the Bayesian estimates of the conditional prob. tables? ... cdist = table(D[,cRow])/nRow for (j in 1:nAttr) { tmpAdist = table(D[,cRow],D[,j])/nRow for(i in 1:dim(cdist)) { tmpAdist[i,] = tmpAdist[i,]/cdist[i] } adist = c(adist,list(tmpAdist)) } ... 13 Homework ... # Do not change the calculation of the marginal dist’n of Y : cdist = table(D[,cRow])/nRow for (j in 1:nAttr) { tmpAdist = table(D[,cRow],D[,j])/nRow for(i in 1:dim(cdist)) { tmpAdist[i,] = tmpAdist[i,]/cdist[i] } adist = c(adist,list(tmpAdist)) } ... 14 Homework ... cdist = table(D[,cRow])/nRow for (j in 1:nAttr) { # For each predictor X j ... tmpAdist = table(D[,cRow],D[,j])/nRow for(i in 1:dim(cdist)) { tmpAdist[i,] = tmpAdist[i,]/cdist[i] } adist = c(adist,list(tmpAdist)) } ... 15 Homework ...
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

linearRegression2_9perPage - Outline Announcements Multiple...

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

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