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

Problems with downscaleCV function #68

Open
rbalmaceda opened this issue Jan 20, 2020 · 7 comments
Open

Problems with downscaleCV function #68

rbalmaceda opened this issue Jan 20, 2020 · 7 comments

Comments

@rbalmaceda
Copy link

Hi,
Im using the downscaleCV function to test some GLM models with folds that within them, the years are not consecutive, for example:

fold1: 1979 1985 1991 1997 2003 2009
fold2: 1980 1986 1992 1998 2004 2010
fold3: 1981 1987 1993 1999 2005 2011

This seems to be a problem for the function, since it gives the following error:
"In the parameters folds you have indicated years that do not belong to the dataset. Please revise the setup of this parameter"
This error is associated with putting sampling.strategy = "k fold.chronological" and the following part of the code:

if (sampling.strategy == "kfold.chronological") { type <- "chronological" if (!is.numeric(folds)) { folds.user <- unique(unlist(folds)) folds.data <- unique(getYearsAsINDEX(y)) if (any(folds.user != folds.data)) stop("In the parameters folds you have indicated years that do not belong to the dataset. Please revise the setup of this parameter.") }

I don't know if I should use k.fold.chronological in this case or if there is another way to perform the CV using folds with non-consecutive years.
Thank u!

@jorgebanomedina
Copy link
Collaborator

jorgebanomedina commented Jan 22, 2020 via email

@rbalmaceda
Copy link
Author

Hi Jorge, sorry for the late response. I still can't find the problem. Im using all the years available in my data. Could it be the version I am using?

downscaleR version 3.1.0
transformeR version 1.6.1
loadeR version 1.6.0

In downscaleCV, in the part that compares fold.user and fold.data, my years are the same but they are in different order, so the function assumes that some year is missing:

folds.user
1979 1985 1991 1997 2003 2009 1980 1986 1992 1998 2004 2010 1981 1987 1993 1999 2005
2011 1982 1988 1994 2000 2006 2012 1983 1989 1995 2001 2007 2013 1984 1990 1996 2002
2008 2014
folds.data
1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995
1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012
2013 2014

any(folds.user != folds.data)
[1] TRUE

Does this not happen with your data?
Thanks for all
Rocio

@jorgebanomedina
Copy link
Collaborator

jorgebanomedina commented Feb 5, 2020 via email

@rbalmaceda
Copy link
Author

Thanks Jorge, are these versions already available? I updated the packages (with @master) and the last version for me are transformeR 1.7.0 and downscaleR 3.1.0
Thanks again
Rocio

@jorgebanomedina
Copy link
Collaborator

jorgebanomedina commented Feb 7, 2020 via email

@rbalmaceda
Copy link
Author

Hi Jorge, I'm sorry to bother you again.
I ran the new version and it went well. But I wanted to ask you, if it is possible that in the final product, in the Data (part of the downscaleCV list), the years are not assigned correctly by the function. As if the function at the end paste the years of the folds one behind the other and not in chronological order. I suspect this because I calculated the correlations between the observed data and my trained model and I get some strange results. I tried to reorder them, and I got more coherent values.
I don't know if I'm right, but I ask you just in case.
Thank you

@jorgebanomedina
Copy link
Collaborator

jorgebanomedina commented Feb 11, 2020 via email

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