Skip to content

Practical Machine Learning/ 016preProcessingPCA - Lecture example code change #157

Open
@Arcticgrayling

Description

@Arcticgrayling

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions