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

Results are not repeatable #1025

Open
zhengxingSong opened this issue May 9, 2024 · 1 comment
Open

Results are not repeatable #1025

zhengxingSong opened this issue May 9, 2024 · 1 comment

Comments

@zhengxingSong
Copy link

I have an svm-rfe model with a random number seed, but the results are inconsistent after each optimization. How can I modify the code to make my analysis repeatable?
This is my code.

set.seed(1234)  
task <- TaskClassif$new(id = "predict", 
                          backend = data,
                          target = "group", 
                          positive = "1")
 
  optimizer <- fs("rfecv",
                  n_features = 1,      
                  feature_number = 1,    
                  recursive = TRUE)      

  learner <- lrn("classif.svm",
                 type = "C-classification",
                 kernel = "linear",
                 predict_type = "prob")
 
instance <- fsi(
        task = task,
        learner = learner,
        resampling = rsmp("cv", folds = 10),
        measures = msr("classif.acc"),
        terminator = trm("none"),
        callbacks = clbk("mlr3fselect.svm_rfe")
)

optimizer$optimize(instance)

Thanks!

@larskotthoff
Copy link
Sponsor Member

Hmm, this should work. Can you post a complete example that allows to reproduce the problem please?

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