Trouble creating the trained_model.Rdata file

Hi everyone,

Not sure if anyone else has had this, but I seem to have trouble creating the trained_model.Rdata file. I have run that bash script in the terminal, but it just says it’s “busy” even after leaving it for hours. I’ve tested that my functions seem to be running smoothly, so not sure what’s going on?

Thanks,

That’s quite strange, it could be that your model is quite complex. Can you submit a toy version of your model, or even what you have without the RData file and then give us a submission number? we can go from there :muscle:

Thanks! - submission ID is 125513

Hi @m_raza

I can see that things are still being evaluated (indeed just packages being installed).

However, going through your code it seems you are using an xgboost model. Could you please use the following method for saving and loading your model?

  1. To save a model
  2. To load a model

I’m not sure if that will fix it but generally this is how these models should be saved and loaded. RData might not like xgboost.

you can actually skip the steps given in the instructions and just run the programs in R. I run the train.R to save my model objects, then when I’m testing if it works I run code in predict.R. running it directly like this might help you figure out your issue

Thanks @MakePredict, I managed to create the trained_model.Rdata file, and the claims and predict file by running those scripts!

I’ve just submitted, hopefully it works…

1 Like

@alfarzan, thanks for your help. I tried using that method and have submitted a few times, but unfortunately failed.

it might be something else?

latest submission id: 125532

Thanks!

Hi @m_raza

So the error message you are getting this time, seen here, is:

Loading required package: RSQLite
Error in load_model() : object 'model' not found #<---- that's the error
In addition: Warning message:
no DISPLAY variable so Tk is not available 

I believe for this to work you have to ensure that the load_model function actually returns the model object. So if you make the following change to your load_model function it should fix this issue I believe.

load_model <- function(){ 
 # Load a saved trained model from the file `trained_model.RData`.

 #    This is called by the server to evaluate your submission on hidden data.
 #    Only modify this *if* you modified save_model.


 #  xgb.load('trained_model') # <--- YOUR ORIGINAL CODE 
  model =  xgb.load('trained_model')
  return(model)
}

If it doesn’t work let me know and we’ll dig deeper :slight_smile:

hi @alfarzan, thanks for your suggestion! Tried this again and same error - apologies for this!

Hi,

Yo can try something like this:

Save your model:

save_model <- function(model){

xgb.save(model, fname=‘saved_objects/trained_model.rds’)

}

Load your model:

load_model <- function(){

model = xgb.load(modelfile=‘saved_objects/trained_model.rds’)

return(model)
}

Good luck!

Hi @m_raza

This time the error is different I believe. This time you have:

Error in filter(., is.na(vh_value)) : object 'vh_value' not found 

So from there it should hopefully be easier to debug?

in case it’s not clear, your error messages are available on your submission pages as well.

For example, the above error is from submission 125536 where if you navigate to “Evaluation Status” you will be able to see your error logs and try to debug :hammer_and_wrench: