def get_grid_search_parameter_grids( op: "PlannedOperator", num_samples: Optional[int] = None, num_grids: Optional[float] = None, pgo: Optional[PGO] = None, data_schema: Dict[str, Any] = {}, ) -> List[Dict[str, List[Any]]]: """Top level function: given a lale operator, returns a list of parameter grids suitable for passing to GridSearchCV. Note that you will need to wrap the lale operator for sklearn compatibility to call GridSearchCV directly. The lale GridSearchCV wrapper takes care of that for you """ hp_grids = get_search_space_grids(op, num_grids=num_grids, pgo=pgo, data_schema=data_schema) grids = SearchSpaceGridstoGSGrids(hp_grids, num_samples=num_samples) if should_print_search_space("true", "all", "backend", "gridsearchcv"): name = op.name() if not name: name = "an operator" print( f"GridSearchCV grids for {name}:\n{gridsearchcv_grids_to_string(grids)}" ) return grids
def get_smac_space( op: "Ops.PlannedOperator", lale_num_grids: Optional[float] = None, lale_pgo: Optional[PGO] = None, data_schema: Dict[str, Any] = {}, ) -> ConfigurationSpace: """Top level function: given a lale operator, returns a ConfigurationSpace for use with SMAC. Parameters ---------- op : The lale PlannedOperator lale_num_grids: integer or float, optional if set to an integer => 1, it will determine how many parameter grids will be returned (at most) if set to an float between 0 and 1, it will determine what fraction should be returned note that setting it to 1 is treated as in integer. To return all results, use None """ hp_grids = get_search_space_grids( op, num_grids=lale_num_grids, pgo=lale_pgo, data_schema=data_schema ) cs = hp_grids_to_smac_cs(hp_grids) if should_print_search_space("true", "all", "backend", "smac"): name = op.name() if not name: name = "an operator" print(f"SMAC configuration for {name}:\n{str(cs)}") return cs
def get_grid_search_parameter_grids( op: 'PlannedOperator', num_samples: Optional[int] = None, num_grids: Optional[float] = None, pgo: Optional[PGO] = None) -> List[Dict[str, List[Any]]]: """ Top level function: given a lale operator, returns a list of parameter grids suitable for passing to GridSearchCV. Note that you will need to wrap the lale operator for sklearn compatibility to call GridSearchCV directly. The lale GridSearchCV wrapper takes care of that for you """ hp_grids = get_search_space_grids(op, num_grids=num_grids, pgo=pgo) grids = SearchSpaceGridstoGSGrids(hp_grids, num_samples=num_samples) return grids
def get_smac_space(op: 'Ops.PlannedOperator', lale_num_grids: Optional[float] = None, lale_pgo: Optional[PGO] = None) -> ConfigurationSpace: """ Top level function: given a lale operator, returns a ConfigurationSpace for use with SMAC Parameters ---------- op : The lale PlannedOperator lale_num_grids: integer or float, optional if set to an integer => 1, it will determine how many parameter grids will be returned (at most) if set to an float between 0 and 1, it will determine what fraction should be returned note that setting it to 1 is treated as in integer. To return all results, use None """ hp_grids = get_search_space_grids(op, num_grids=lale_num_grids, pgo=lale_pgo) grids = hp_grids_to_smac_cs(hp_grids) return grids