Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in storage.mode(y) <- "double" #14

Open
Naviden opened this issue Dec 21, 2020 · 3 comments
Open

Error in storage.mode(y) <- "double" #14

Naviden opened this issue Dec 21, 2020 · 3 comments

Comments

@Naviden
Copy link

Naviden commented Dec 21, 2020

Having this data:

'data.frame':	100 obs. of  10 variables:
 $ lines          : num  0.234 0.155 0.275 0.198 0.116 ...
 $ organization   : num  0.251 0.166 0.295 0.213 0.124 ...
 $ would          : num  0 0.657 0 0 0 ...
 $ one            : num  0 0 0.544 0.785 0.229 ...
 $ writes         : num  0 0.568 0.504 0.363 0.637 ...
 $ university     : num  0.939 0 0 0 0 ...
 $ dont           : num  0 0 0 0 0 ...
 $ article        : num  0 0.319 0 0.409 0.716 ...
 $ nntppostinghost: num  0 0.303 0.537 0 0 ...
 $ label          : Factor w/ 20 levels "alt.atheism",..: 3 12 14 6 11 5 7 15 6 8 ...

I was getting this error:

Error in storage.mode(y) <- "double" : 
  invalid to change the storage mode of a factor

I found out that the problem was having '.' in the target values!

doing.

data$label <- gsub("\\.", "_", data$label)

Resolved the problem!

@holub008
Copy link
Owner

Could you include the code you were running? If you include a reproducible example I'd like to fix this up.

@Naviden
Copy link
Author

Naviden commented Dec 22, 2020

data <- https://docs.google.com/spreadsheets/d/1otML1uekMpC-335OtYRrOL-KFoluqZvJ_GN_T8aOS-U/edit?usp=sharing

m_xrf <- xrf(label ~ ., data, family='gaussian',
             xgb_control = list(nrounds = 20, max_depth = 3))

@holub008
Copy link
Owner

Thank you! I will take a crack at this in the coming days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants