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

crossv : error when loading crossv #51

Open
EtienneFerrandi opened this issue May 25, 2022 · 1 comment
Open

crossv : error when loading crossv #51

EtienneFerrandi opened this issue May 25, 2022 · 1 comment

Comments

@EtienneFerrandi
Copy link

"Error in -c(train.samples) : invalid argument to unary operator" when I launch crossv... Here is my code :

library(stylo)
training.set=read.csv("C:/Users/etien/Downloads/two_subcorpora/freq_table_reference_set.csv",sep = " ")
###inversion of rows and columns required for crossv###
training.set=t(training.set)
results=crossv(training.set,cv.mode = "stratified",cv.folds=5,classification.method = "svm")

@computationalstylistics
Copy link
Owner

Two things:

(1) when loading the file from disk, use the parameter row.names = 1 to tell R where your rownames are, namely in the 1st column:

training.set=read.csv("C:/Users/etien/Downloads/two_subcorpora/freq_table_reference_set.csv", sep = " ", row.names=1)

(2) the stratified cross-validation is not fully implemented in the function crossv() yet. It's still pending. Try leave-one-out instead:

training.set=t(training.set)
results=crossv(training.set, classification.method = "svm")

I hope this helps!

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