Giter Club home page Giter Club logo

wehrley.github.io's Issues

Box-plot generation inhibits later commands

If running the code linearly, this bit of code to make the 'Title" column a factor (so we can make a box-plot),

> df.train$Title <- factor(df.train$Title,
                       c("Capt","Col","Major","Sir","Lady","Rev",
                       "Dr","Don","Jonkheer","the Countess","Mrs",
                       "Ms","Mr","Mme","Mlle","Miss","Master"))

will later cause an error when trying to reassign the grouped titles:

> df.train$Title <- changeTitles(df.train, 
                             c("Capt", "Col", "Don", "Dr", 
                               "Jonkheer", "Lady", "Major", 
                               "Rev", "Sir"),
                             "Noble")
In `[<-.factor`(`*tmp*`, which(data$Title == honorific), value = c(13L,  :
invalid factor level, NA generated

Global digits option causes error when displaying model results

If we set

> options(digits=2)

early in the code for output reasons, we will later see an error when attempting to display our first model:

> glm.tune.1 <- train(Fate ~ Sex + Class + Age + Family + Embarked,
                data = train.batch,
                method = "glm",
                metric = "ROC",
                trControl = cv.ctrl)
> glm.tune.1
Generalized Linear Model 

714 samples
 11 predictor
  2 classes: 'Perished', 'Survived' 

No pre-processing
Resampling: Cross-Validated (10 fold, repeated 3 times) 

Summary of sample sizes: 643, 642, 643, 642, 642, 643, ... 

Resampling results

Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L,  : 
  invalid 'digits' argument

You can remedy this by setting

options(digits=4) 

Additional typos

In code chunk:

train.keeps <- c("Fate", "Sex", "Boat.dibs", "Age", "Title", 
                 "Class", "Deck", "Side", "Fare", "Fare.pp", 
                 "Embarked", "Family")

"Survived" should be added to the train.keeps assignment.

very minor type

This line:

Titanic.logit.1 <- glm(Fate ~ Sex + Class + Age + Family + Embarked + Fare,
data = train.batch, family=binomial("logit")

missing the second ")".

Survived missing in df.train.munged

Looks like you may need to include Survived in df.train.munged. Getting this error:

training.rows <- createDataPartition(df.train.munged$Survived,

  •                                 p = 0.8, list = FALSE)
    
    Error in createDataPartition(df.train.munged$Survived, p = 0.8, list = FALSE) :
    y must have at least 2 data points

colnames(df.train.munged)
[1] "Fate" "Sex" "Boat.dibs" "Age" "Title" "Class" "Deck"
[8] "Side" "Fare" "Fare.pp" "Embarked" "Family"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.