{"action":"created","issue":{"url":"https://api.github.com/repos/SheffieldML/GPyOpt/issues/36","repository_url":"https://api.github.com/repos/SheffieldML/GPyOpt","labels_url":"https://api.github.com/repos/SheffieldML/GPyOpt/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/SheffieldML/GPyOpt/issues/36/comments","events_url":"https://api.github.com/repos/SheffieldML/GPyOpt/issues/36/events","html_url":"https://github.com/SheffieldML/GPyOpt/issues/36","id":163955469,"number":36,"title":"IndexError: bug or problem?","user":{"login":"1Reinier","id":2734335,"avatar_url":"https://avatars.githubusercontent.com/u/2734335?v=3","gravatar_id":"","url":"https://api.github.com/users/1Reinier","html_url":"https://github.com/1Reinier","followers_url":"https://api.github.com/users/1Reinier/followers","following_url":"https://api.github.com/users/1Reinier/following{/other_user}","gists_url":"https://api.github.com/users/1Reinier/gists{/gist_id}","starred_url":"https://api.github.com/users/1Reinier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1Reinier/subscriptions","organizations_url":"https://api.github.com/users/1Reinier/orgs","repos_url":"https://api.github.com/users/1Reinier/repos","events_url":"https://api.github.com/users/1Reinier/events{/privacy}","received_events_url":"https://api.github.com/users/1Reinier/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SheffieldML/GPyOpt/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-05T21:54:24Z","updated_at":"2016-07-11T23:07:51Z","closed_at":null,"body":"Hi there,\r\n\r\nI can't seem to figure out the cause of the following problem (stacktrace included below).\r\n\r\nMy problem is the optimization of an objective function with six hyperparameters, of which two are discrete and the rest continuous.\r\n\r\nCould you help me out where I made a mistake, or where the bug is?\r\n\r\n**Code:**\r\n```Python\r\ndef objective(args):\r\n    arg = args.reshape(-1,)\r\n    esn = EchoStateNetwork(n_nodes=arg[0], \r\n                           input_scaling=arg[1], \r\n                           leaking_rate=arg[2], \r\n                           spectral_density=arg[3],\r\n                           regularization=arg[4],\r\n                           average_degree=arg[5],\r\n                           feedback=True)\r\n    esn.train(y=train, burn_in=100)\r\n    mse = esn.test(y=test[1:501])\r\n    return np.array([[mse]])\r\n\r\ndomain = [\r\n    {'name': 'n_nodes', 'type': 'discrete', 'domain': range(10, 1000)},\r\n    {'name': 'input_scaling', 'type': 'continuous', 'domain': (1e-8, 2.)},\r\n    {'name': 'leaking_rate', 'type': 'continuous', 'domain': (1e-8, 1.)},\r\n    {'name': 'spectral_density', 'type': 'continuous', 'domain': (1e-8, 3.)},\r\n    {'name': 'regularization', 'type': 'continuous', 'domain': (1e-12, 0.1)},\r\n    {'name': 'average_degree', 'type': 'discrete', 'domain': range(10, 1000)}\r\n]\r\n\r\ninitial_parameters = np.array([[1000, 0.5, 0.3, 1.25, 1e-8, 10], \r\n                               [1000, 0.5, 0.3, 1.25, 1e-8, 10], \r\n                               [1000, 0.5, 0.3, 1.25, 1e-8, 10]])\r\n\r\ninitial_mse = np.array([[0.15945], \r\n                        [0.10871], \r\n                        [0.053224]])\r\n\r\nbo = GPyOpt.methods.BayesianOptimization(f=objective, domain=domain, \r\nX=initial_parameters, Y=initial_mse) \r\n```\r\n\r\n**Stacktrace:**\r\n```python-traceback\r\nIndexError                                Traceback (most recent call last)\r\n<ipython-input-17-ca9b66ea1c32> in <module>()\r\n---> 31 bo = GPyOpt.methods.BayesianOptimization(f=objective, domain=domain, X=initial_parameters, Y=initial_mse)\r\n     32 \r\n     33 \r\n\r\n/Users/Reinier/anaconda/lib/python3.5/site-packages/GPyOpt/methods/bayesian_optimization.py in __init__(self, f, domain, constrains, cost_withGradients, model_type, X, Y, initial_design_numdata, initial_design_type, acquisition_type, normalize_Y, exact_feval, acquisition_optimizer_type, model_update_interval, evaluator_type, batch_size, num_cores, verbosity, verbosity_model, bounds, **kwargs)\r\n    234 \r\n    235         # --- Initialize everything\r\n--> 236         self.run_optimization(max_iter=0,verbosity=self.verbosity)\r\n    237 \r\n    238     def _model_chooser(self):\r\n\r\n/Users/Reinier/anaconda/lib/python3.5/site-packages/GPyOpt/methods/bayesian_optimization.py in run_optimization(self, max_iter, max_time, eps, verbosity, save_models_parameters, report_file, evaluations_file, models_file, **kwargs)\r\n    450                 self.acquisition_optimizer.optimizer ='CMA'\r\n    451             print('WARNING: \"acqu_optimize_method\" will be deprecated in the next version!')\r\n--> 452         super(BayesianOptimization, self).run_optimization(max_iter = max_iter, max_time = max_time,  eps = eps, verbosity=verbosity, save_models_parameters = save_models_parameters, report_file = report_file, evaluations_file= evaluations_file, models_file=models_file)\r\n    453 \r\n    454 \r\n\r\n/Users/Reinier/anaconda/lib/python3.5/site-packages/GPyOpt/core/bo.py in run_optimization(self, max_iter, max_time, eps, verbosity, save_models_parameters, report_file, evaluations_file, models_file)\r\n    104 \r\n    105             # --- Update and optimize acquisition and compute the exploration level in the next evaluation\r\n--> 106             self.suggested_sample = self._compute_next_evaluations()\r\n    107 \r\n    108             if not ((self.num_acquisitions < self.max_iter) and (self._distance_last_evaluations() > self.eps)):\r\n\r\n/Users/Reinier/anaconda/lib/python3.5/site-packages/GPyOpt/core/bo.py in _compute_next_evaluations(self)\r\n    182         Computes the location of the new evaluation (optimizes the acquisition in the standard case).\r\n    183         \"\"\"\r\n--> 184         return self.evaluator.compute_batch()\r\n    185 \r\n    186     def _update_model(self):\r\n\r\n/Users/Reinier/anaconda/lib/python3.5/site-packages/GPyOpt/core/evaluators/sequential.py in compute_batch(self)\r\n     19         Selects the new location to evaluate the objective.\r\n     20         \"\"\"\r\n---> 21         return self.acquisition.optimize()\r\n     22 \r\n     23 \r\n\r\n/Users/Reinier/anaconda/lib/python3.5/site-packages/GPyOpt/acquisitions/base.py in optimize(self)\r\n     57             out = self.optimizer.optimize(f=self.acquisition_function)[0]\r\n     58         else:\r\n---> 59             out = self.optimizer.optimize(f=self.acquisition_function, f_df=self.acquisition_function_withGradients)[0]\r\n     60         return out\r\n     61 \r\n\r\n/Users/Reinier/anaconda/lib/python3.5/site-packages/GPyOpt/optimization/acquisition_optimizer.py in optimize(self, f, df, f_df)\r\n    287 \r\n    288         for i in range(num_discrete):\r\n--> 289             self.mixed_optimizer.fix_dimensions(dims=self.discrete_dims, values=self.discrete_values[i,:])\r\n    290             partial_x_min[i,:] , partial_f_min[i,:] = self.mixed_optimizer.optimize(f, df, f_df)\r\n    291 \r\n\r\n/Users/Reinier/anaconda/lib/python3.5/site-packages/GPyOpt/optimization/acquisition_optimizer.py in fix_dimensions(self, dims, values)\r\n    118 \r\n    119         # -- take only the fixed components of the random samples\r\n--> 120         self.samples = self.samples[:,np.array(self.free_dims)] # take only the component of active dims\r\n    121         self.subspace = self.space.get_subspace(self.free_dims)\r\n    122         self.optimizer = select_optimizer(self.optimizer_name)(Design_space(self.subspace), **self.kwargs)\r\n\r\nIndexError: index 4 is out of bounds for axis 1 with size 4\r\n```"},"comment":{"url":"https://api.github.com/repos/SheffieldML/GPyOpt/issues/comments/231892178","html_url":"https://github.com/SheffieldML/GPyOpt/issues/36#issuecomment-231892178","issue_url":"https://api.github.com/repos/SheffieldML/GPyOpt/issues/36","id":231892178,"user":{"login":"1Reinier","id":2734335,"avatar_url":"https://avatars.githubusercontent.com/u/2734335?v=3","gravatar_id":"","url":"https://api.github.com/users/1Reinier","html_url":"https://github.com/1Reinier","followers_url":"https://api.github.com/users/1Reinier/followers","following_url":"https://api.github.com/users/1Reinier/following{/other_user}","gists_url":"https://api.github.com/users/1Reinier/gists{/gist_id}","starred_url":"https://api.github.com/users/1Reinier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1Reinier/subscriptions","organizations_url":"https://api.github.com/users/1Reinier/orgs","repos_url":"https://api.github.com/users/1Reinier/repos","events_url":"https://api.github.com/users/1Reinier/events{/privacy}","received_events_url":"https://api.github.com/users/1Reinier/received_events","type":"User","site_admin":false},"created_at":"2016-07-11T23:07:51Z","updated_at":"2016-07-11T23:07:51Z","body":"Thanks!"}}
{"actor":{"display_login":"1Reinier"}}