Skip to content

NotImplementedError: Wrong number or type of arguments for overloaded function 'binary_rss_forest_predict_marginalized_over_instances_batch' #928

@davidmurray

Description

@davidmurray

Description

Goal: Run SMAC to find best hyperparameters

Steps/Code to Reproduce

    cs = ConfigurationSpace()
    cs.add_hyperparameters([
        OrdinalHyperparameter("npop", list(range(20, 500+1, 20)), default_value=100),
        Float("cxpb", (0.5, 1.0)),
        Float("mutpb", (0.01, 0.1)),
        OrdinalHyperparameter("n_elites_prop", list(np.arange(0.00, 0.15, 0.02)), default_value=0.04),
        Integer("tourn_size", (2, 10)),
        OrdinalHyperparameter("constraint_penalty", sequence=[50000, 100000, 150000, 200000, 250000, 300000], default_value=100000),
        Categorical("mate", ["probabilisticGeneCrossover", "cxOnePoint", "cxTwoPoint"])
    ])

    zones = [str(v) for v in range(1, 8)] # 7 zones
    scenario = Scenario(cs,
        walltime_limit=167.5*60*60, 
        deterministic=False,
        instances=zones,
        instance_features={v:[v] for v in zones},
        n_trials=5000)

    smac_facade = HyperparameterOptimizationFacade(scenario, _smac_run)
    return smac_facade

The _smac_run function performs the simulation for this config and returns the cost (i.e. value to minimize).

Expected Results

No crash

Actual Results

Traceback (most recent call last):
  File "/home/dmurray/masters-code/osm/algo/genetic_algorithm.py", line 444, in <module>
    incumbent = smac_facade.optimize()
  File "/home/dmurray/SMAC3/smac/facade/abstract_facade.py", line 289, in optimize
    incumbents = self._optimizer.optimize()
  File "/home/dmurray/SMAC3/smac/main/smbo.py", line 279, in optimize
    trial_info = self.ask()
  File "/home/dmurray/SMAC3/smac/main/smbo.py", line 151, in ask
    trial_info = next(self._trial_generator)
  File "/home/dmurray/SMAC3/smac/intensifier/intensifier.py", line 222, in __iter__
    config = next(self.config_generator)
  File "/home/dmurray/SMAC3/smac/main/config_selector.py", line 199, in __iter__
    x_best_array, best_observation = self._get_x_best(X_configurations)
  File "/home/dmurray/SMAC3/smac/main/config_selector.py", line 324, in _get_x_best
    costs = list(
  File "/home/dmurray/SMAC3/smac/main/config_selector.py", line 327, in <lambda>
    model.predict_marginalized(x.reshape((1, -1)))[0][0][0],  # type: ignore
  File "/home/dmurray/SMAC3/smac/model/random_forest/random_forest.py", line 278, in predict_marginalized
    dat_ = self._rf.predict_marginalized_over_instances_batch(X, X_feat, self._log_y)
  File "/home/dmurray/masters-code/lib/python3.10/site-packages/pyrfr/regression.py", line 2680, in predict_marginalized_over_instances_batch
    return _regression.binary_rss_forest_predict_marginalized_over_instances_batch(self, configuration_matrix, feature_matrix, log_y)
NotImplementedError: Wrong number or type of arguments for overloaded function 'binary_rss_forest_predict_marginalized_over_instances_batch'.
  Possible C/C++ prototypes are:
    rfr::forests::regression_forest< binary_full_tree_rss_t,num_t,response_t,index_t,rng_t >::predict_marginalized_over_instances_batch(std::vector< std::vector< num_t,std::allocator< num_t > >,std::allocator< std::vector< num_t,std::allocator< num_t > > > > const,std::vector< std::vector< num_t,std::allocator< num_t > >,std::allocator< std::vector< num_t,std::allocator< num_t > > > > const,bool const) const
    rfr::forests::regression_forest< binary_full_tree_rss_t,num_t,response_t,index_t,rng_t >::predict_marginalized_over_instances_batch(std::vector< std::vector< num_t,std::allocator< num_t > >,std::allocator< std::vector< num_t,std::allocator< num_t > > > > const,std::vector< std::vector< num_t,std::allocator< num_t > >,std::allocator< std::vector< num_t,std::allocator< num_t > > > > const) const

Versions

SMAC 2.0.0b1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Blocked

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions