DataScienceSpecialization / courses

Course materials for the Data Science Specialization: https://www.coursera.org/specialization/jhudatascience/1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Practical Machine Learning/ 016preProcessingPCA - Lecture example code change

Arcticgrayling opened this issue · comments

This lecture needs to be updated, there is a change in how the "train" function has to be used.

With new version of caret (version 6.0-71), The lecture code:
modelFit <- train(training$type ~ .,method="glm",data=trainPC)`
gives an error.

I raised the issue with the caret package people.
https://github.com/topepo/caret/issues/480
They say this code is incorrect, we should use instead:
modelFit <- train(x = trainPC, y = training$type,method="glm")

You shouldn't use the data set name on the LHS of the formula. The formula interface should be used when the variables are in columns of the object that the data argument refers to.

If type is not in training and there are only numeric variables in trainPC, then you should use the non-formula method:
modelFit <- train(x = trainPC, y = training$type,method="glm")

Hi Peter thanks for the note, I'm going to be making some edits to this asap

On Thu, Nov 3, 2016 at 1:14 PM Peter Olsen notifications@github.com wrote:

This lecture needs to be updated, there is a change in how the "train"
function has to be used.

With new version of caret (version 6.0-71), The lecture code:
modelFit <- train(training$type ~ .,method="glm",data=trainPC)`
gives an error.

I raised the issue with the caret package people.
topepo/caret#480 http://url
They say this code is incorrect, we should use instead:
modelFit <- train(x = trainPC, y = training$type,method="glm")

You shouldn't use the data set name on the LHS of the formula. The formula
interface should be used when the variables are in columns of the object
that the data argument refers to.

If type is not in training and there are only numeric variables in
trainPC, then you should use the non-formula method:
modelFit <- train(x = trainPC, y = training$type,method="glm")


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#157, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABf7WpwjarxQ0qhH4Ns2io0qW1_KszhRks5q6haGgaJpZM4Koq6R
.