@@ -722,7 +722,7 @@ def get_avg_costs(
722722 objectives = self .get_objectives ()
723723
724724 # Budget might not be evaluated
725- config_costs = self .get_costs ( config_id , budget , statuses = statuses )
725+ config_costs = self .get_all_costs ( budget = budget , statuses = statuses )[ config_id ]
726726
727727 avg_costs , std_costs = [], []
728728 for idx in range (len (objectives )):
@@ -731,62 +731,6 @@ def get_avg_costs(
731731 std_costs .append (float (np .std (costs )))
732732 return avg_costs , std_costs
733733
734- def get_costs (
735- self ,
736- config_id : int ,
737- budget : Optional [Union [int , float ]] = None ,
738- seed : Optional [int ] = None ,
739- statuses : Optional [Union [Status , List [Status ]]] = None ,
740- ) -> Dict [int , List [float ]]:
741- """
742- Return the costs of a configuration.
743-
744- Optionally, only configurations which were evaluated on the passed budget, seed, and stati
745- are considered.
746-
747- In case of multi-objective, multiple costs are returned in the form of a list.
748-
749- Parameters
750- ----------
751- config_id : int
752- Configuration id to get the costs for.
753- budget : Optional[Union[int, float]]
754- Budget to get the costs from the configuration id for. If budget is
755- None, the highest budget is chosen. By default None.
756- seed : Optional[int], optional
757- Seed to get the costs from the configuration id for. If no seed is
758- given, all seeds are considered. By default None.
759- statuses : Optional[Union[Status, List[Status]]]
760- Only selected stati are considered. If no status is given, all stati are considered.
761- By default None.
762-
763- Returns
764- -------
765- Dict[int, List[float]]
766- Seeds with their corresponding list of costs for the associated configuration.
767-
768- Raises
769- ------
770- ValueError
771- If the configuration id is not found.
772- RuntimeError
773- If the budget was not evaluated for the passed config id.
774- """
775- if budget is None :
776- budget = self .get_highest_budget ()
777-
778- if config_id not in self .configs :
779- raise ValueError ("Configuration id was not found." )
780- costs = self .get_all_costs (budget = budget , seed = seed , statuses = statuses )
781- if config_id not in costs :
782- if seed is not None :
783- raise RuntimeError (
784- f"Budget { budget } with seed { seed } was not evaluated for config id { config_id } ."
785- )
786- else :
787- raise RuntimeError (f"Budget { budget } was not evaluated for config id { config_id } ." )
788- return costs [config_id ]
789-
790734 def get_all_costs (
791735 self ,
792736 budget : Optional [Union [int , float ]] = None ,
0 commit comments