[CLI]: Specifying probabilities in a sweep configuration doesn't work with method = "bayes"
See original GitHub issueDescribe the bug
Issue
Specifying values and probabilities for hyperparameter distribution doesn’t work with method="bayes"
Minimal example
sweep_config = {
"program": "run_experiment.py",
"name": "BO",
"project": project,
"method": "bayes",
"metric": {
"name": "mean_test_score",
"goal": "minimize" # RMSE
},
"parameters": {"learning_rate": {"values": [0.1, 0.2], "probabilities": [0.8, 0.2]}}
}
sweep_id = wandb.sweep(sweep_config, project=project)
Full traceback
400 response executing GraphQL.
{"errors":[{"message":"Invalid sweep config: arrays used as indices must be of integer (or boolean) type","path":["upsertSweep"]}],"data":{"upsertSweep":null}}
wandb: ERROR Error while calling W&B API: Invalid sweep config: arrays used as indices must be of integer (or boolean) type (<Response [400]>)
wandb: ERROR Invalid sweep config: arrays used as indices must be of integer (or boolean) type
Traceback (most recent call last):
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/sdk/lib/retry.py", line 113, in __call__
result = self._call_fn(*args, **kwargs)
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/sdk/internal/internal_api.py", line 204, in execute
return self.client.execute(*args, **kwargs) # type: ignore
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/client.py", line 52, in execute
result = self._get_result(document, *args, **kwargs)
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/client.py", line 60, in _get_result
return self.transport.execute(document, *args, **kwargs)
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/vendor/gql-0.2.0/wandb_gql/transport/requests.py", line 39, in execute
request.raise_for_status()
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/requests/models.py", line 953, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.wandb.ai/graphql
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/apis/normalize.py", line 25, in wrapper
return func(*args, **kwargs)
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/sdk/internal/internal_api.py", line 2181, in upsert_sweep
raise e
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/sdk/internal/internal_api.py", line 2166, in upsert_sweep
response = self.gql(
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/sdk/lib/retry.py", line 129, in __call__
retry_timedelta_triggered = check_retry_fn(e)
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/sdk/internal/internal_api.py", line 2156, in no_retry_4xx
raise UsageError(body["errors"][0]["message"])
wandb.errors.UsageError: Invalid sweep config: arrays used as indices must be of integer (or boolean) type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "launch_config/launch_bo_test.py", line 68, in <module>
sweep_id = create_sweep_bo(data_transform_config,
File "launch_config/launch_bo_test.py", line 54, in create_sweep_bo
sweep_id = wandb.sweep(sweep_config, project=project)
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/sdk/wandb_sweep.py", line 112, in sweep
sweep_id, warnings = api.upsert_sweep(sweep)
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/apis/internal.py", line 102, in upsert_sweep
return self.api.upsert_sweep(*args, **kwargs)
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/apis/normalize.py", line 61, in wrapper
raise CommError(message, err).with_traceback(sys.exc_info()[2])
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/apis/normalize.py", line 25, in wrapper
return func(*args, **kwargs)
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/sdk/internal/internal_api.py", line 2181, in upsert_sweep
raise e
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/sdk/internal/internal_api.py", line 2166, in upsert_sweep
response = self.gql(
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/sdk/lib/retry.py", line 129, in __call__
retry_timedelta_triggered = check_retry_fn(e)
File "/Users/leo/opt/anaconda3/envs/stage/lib/python3.8/site-packages/wandb/sdk/internal/internal_api.py", line 2156, in no_retry_4xx
raise UsageError(body["errors"][0]["message"])
wandb.errors.CommError: Invalid sweep config: arrays used as indices must be of integer (or boolean) type
Additional Files
No response
Environment
WandB version: 0.13.1
OS: MacOS Monterey 12.0.1
Python version: 3.8.8
Versions of relevant libraries:
Additional Context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
Define sweep configuration - Documentation - Weights & Biases
bayes – Create a probabilistic model of a metric score as a function of the hyperparameters, and choose parameters with high probability of...
Read more >Hyperparameter tuning a model (v1) - Azure Machine Learning
When using Bayesian sampling, set early_termination_policy = None . Specify the following configuration parameters: slack_factor or slack_amount ...
Read more >rms: Regression Modeling Strategies
penalized maximum likelihood estimation for logistic and ordinary linear models. 'rms' works with almost any regression model, but it.
Read more >Of Bits and Wows: A Bayesian Theory of Surprise with ... - NCBI
The process by which a learning system realizes that a model class is unsatisfactory in an alternative free setting–the open-ended aspect of ...
Read more >Bayesian Statistics
LOWER PROBABILITIES: DOMINATION STRUCTURES. I. INTRODUCTION. A s ~t 1s well k n o w n , Bayeslan coherence prlnclples as applied to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thank for your answer @MBakirWB. I used “learning_rate” as a simple example, but I wanted to use this for discrete parameters. Your second solution
[0.1] * 8 + [0.2] * 2should work!Hi @ellisbrown , probabilities can only be used with
method: random. Modify your method and you should no longer see the error.