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

Parameter from a List of values #236

Closed
joharyaja opened this issue Sep 25, 2019 · 6 comments
Closed

Parameter from a List of values #236

joharyaja opened this issue Sep 25, 2019 · 6 comments

Comments

@joharyaja
Copy link

Dear all,
First of all, the tool is just great and helpful, thanks to the developers team.
Second, I had a program than already run correctly but using the predefined distribution (Uniform or Normal Distributions) for the 5 parameters. Then, I wanted to used for one of these parameters a list of values (about 10 values) instead of using a continuous distribution. For this, I just changed from this :
spotpy.parameter.Uniform('p',min_p,max_p,0.1)
to this
spotpy.parameter.List('p',[p1,p2,p3,p5 to p10])
But It is always giving this error : "The number of the iteration is higher than of the number of available parameter set" whatever the algorithm I use.
Then I looked the spotpy documentation concerning the use of List. I copied/pasted the provided example which uses the "mc" algorithm but it still gives the same error.
Please help me know if its a bug or if Its a problem with my code.
Sincerely,
Johary

thouska added a commit that referenced this issue Sep 25, 2019
@thouska
Copy link
Owner

thouska commented Sep 25, 2019

Hi @joharyaja,
thanks for your message and the detailed error description. Indeed there was a small typo in the list (it had only 9 values, but the sampler was set to 10 repetitions). I extended the list_parameter to ten values in the example. This should fix the error. You can access the new example either here on github or on pypi (corresponding new uploaded version 1.5.7).

@joharyaja
Copy link
Author

Hi @thouska,
Thanks for your soon response. The sample code ran after changing from 10 repetitions to 9, thanks to you. However I have two additional questions :) 1- isn't it possible to use other algo than the MC one? 2- If the list has, say, 10 possible values and that there are another parameters with continuous distributions (say, a uniform one), from which i can have thousands of possible values if I want (given the step parameter), it seems that the error persists! but also am I limited to sample using only 10 repetitions? Excuse me if my questions are not clear.
Thanks in advance! Best!

@thouska
Copy link
Owner

thouska commented Oct 2, 2019

Hi @joharyaja,

  1. Only the MC sampler is compatible to the parameter type list.
  2. If you want to use e.g. 1000 repetitions and your List parameter has only 10 values, you can use the keyword repeat=True. So at repetition 11 spotpy would not produce an error, instead it would take the first value of the list again, in the example x=1:
    spotpy.parameter.List('x',[1,2,3,4,5,6,7,8,9,0], repeat=True)

@philippkraft
Copy link
Collaborator

I've got the feeling, here is a misunderstanding - a list parameter is not a random parameter but an ordered list - the parameters are taken sequentially not randomly. I understand that @joharyaja wants a discrete parameter as in #186. It is no difficult issue, we stopped working on it because a) we had no use case (obviously you have one @joharyaja ) and b) we are not sure how a nominal scaled parameter would work together with directed algorithms. How about closing this issue and move the discussion to #186 instead? I will post my implementation of a discrete parameter there the next day and would be very happy if we could work together on that.

@joharyaja
Copy link
Author

Hi @joharyaja,

1. Only the MC sampler is compatible to the parameter type list.

2. If you want to use e.g. 1000 repetitions and your List parameter has only 10 values, you can use the keyword `repeat=True`. So at repetition 11 spotpy would not produce an error, instead it would take the first value of the list again, in the example x=1:
   `spotpy.parameter.List('x',[1,2,3,4,5,6,7,8,9,0], repeat=True)  `

Hi @thouska ,
I will follow your suggestion.
Many thanks,

@joharyaja
Copy link
Author

I've got the feeling, here is a misunderstanding - a list parameter is not a random parameter but an ordered list - the parameters are taken sequentially not randomly. I understand that @joharyaja wants a discrete parameter as in #186. It is no difficult issue, we stopped working on it because a) we had no use case (obviously you have one @joharyaja ) and b) we are not sure how a nominal scaled parameter would work together with directed algorithms. How about closing this issue and move the discussion to #186 instead? I will post my implementation of a discrete parameter there the next day and would be very happy if we could work together on that.

Hi @philippkraft ,
You are right, it is a mis-understanding. Random parameter VS Ordered list, I did not think about that. But, thank you for the explanation. I am looking at #186 as you recommended. I think we can close this issue, while waiting for your implementation of discrete parameter; Thanks a lot.
I'd be happy to help you, but I have to say that my coding skill is not very high :)

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

3 participants