Skip to content

Error when running cross_validation using your example code and test data #31

@ttimbers

Description

@ttimbers

I ran the following to generate some data (from your tests dir):

> gen_data <- function(N){
+   X <- data.frame(x0 = 1:N, x1 = rnorm(N))
+   y <- 1:N
+   return(list(X, y))
+ }
> 
> # Generate test input data
> data <- gen_data(100)
> X <- data[[1]]
> y_vec <- data[[2]]
> y <- data.frame(y = y_vec)

then I tried your example code:

> split_data <- train_test_split(X, y, test_size = 0.25, random_state = 0, shuffle = TRUE)
> scores <- cross_validation(split_data['X_train'], split_data['y_train'], k = 3, shuffle = TRUE, random_state = 0)

I received this error after the last line of code pasted above:

Error in cross_validation(split_data["X_train"], split_data["y_train"],  : 
  TypeError: X must be a dataframe or an atomic vector

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