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

Impute missing data #24

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

KetsiaGuichard
Copy link
Collaborator

Add function to impute missing data by randomForest

@KetsiaGuichard
Copy link
Collaborator Author

Thanks for the PR @Slazz26 ! I move it to AgisTaTerre's repo directly :)

Some general comments:

  • Each function must be documented; there cannot be a global documentation for the file. I added a documentation to complete at the begin of each function.
  • Here are some ressources about imports : https://roxygen2.r-lib.org/articles/namespace.html#functions-1. The syntax is @importFrom pkg function1 function2 if you use just a few functions from a package.
  • Please use only lowercase letters for your objects. If you have a doubt, you can follow the tidyverse syntax guide : https://style.tidyverse.org/syntax.html
  • I added some .data$... : This avoids warnings during package compilation: if we don't include them when using dplyr functionalities, the variables seem undeclared, generating many notes and warnings. No worries about this, I can take care of it.

@KetsiaGuichard
Copy link
Collaborator Author

KetsiaGuichard commented Jul 1, 2024

Example failed with this error:
Error: sample_fraction too small, no observations sampled. Ranger will EXIT now. Error in ranger(y ~ . - date, data = data_train_clean, mtry = 8, min.node.size = 1) : User interrupt or internal error. Calls: impute_missing_data -> create_and_train_model -> ranger Execution halted
Maybe it has to do with my modifications, could you please have a look ?

@KetsiaGuichard
Copy link
Collaborator Author

Hi @Slazz26
Thanks for the modifications!
Just a quick question for my review: do you use preprocessing.R ? I'm not sure if this file is mandatory for your code, otherwise I suggest to suppress this file (with quite a lot to do with its documentation).
Thanks for your reply !

@Slazz26
Copy link

Slazz26 commented Jul 3, 2024

Hi @Slazz26 Thanks for the modifications! Just a quick question for my review: do you use preprocessing.R ? I'm not sure if this file is mandatory for your code, otherwise I suggest to suppress this file (with quite a lot to do with its documentation). Thanks for your reply !

Hi @KetsiaGuichard,

I’ve integrated preprocessing functions into my example to manage the exclusion of sensor inactivity periods. If these inactive periods remain, missing values will be filled in, which could introduce bias into the analysis. By utilizing the retrieve_missing_data function, I can significantly reduce the number of missing data points that need to be imputed—four times fewer, in fact. However, if this preprocessing step is unnecessary, I can omit it from the example altogether.

Best regards.

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

Successfully merging this pull request may close these issues.

2 participants