1616
1717
1818class autoPyTorchChoice (object ):
19- """Allows for the dynamically generation of components as pipeline steps.
19+ """
20+ Allows for the dynamically generation of components as pipeline steps.
2021
2122 Args:
22- dataset_properties (Dict[str, Union[str, BaseDatasetPropertiesType]]): Describes the dataset
23- to work on
24- random_state (Optional[np.random.RandomState]): allows to produce reproducible
25- results by setting a seed for randomized settings
23+ dataset_properties (Dict[str, Union[str, BaseDatasetPropertiesType]]):
24+ Describes the dataset to work on
25+ random_state (Optional[np.random.RandomState]):
26+ Allows to produce reproducible results by setting a
27+ seed for randomized settings
2628
2729 Attributes:
28- random_state (Optional[np.random.RandomState]): allows to produce reproducible
29- results by setting a seed for randomized settings
30- choice (autoPyTorchComponent): the choice of components for this stage
30+ random_state (Optional[np.random.RandomState]):
31+ Allows to produce reproducible results by setting a seed for
32+ randomized settings
33+ choice (autoPyTorchComponent):
34+ the choice of components for this stage
3135 """
3236 def __init__ (self ,
3337 dataset_properties : Dict [str , BaseDatasetPropertiesType ],
@@ -67,11 +71,13 @@ def get_components(cls: 'autoPyTorchChoice') -> Dict[str, autoPyTorchComponent]:
6771 for current step.
6872
6973 Args:
70- cls (autoPyTorchChoice): The choice object from which to query the valid
74+ cls (autoPyTorchChoice):
75+ The choice object from which to query the valid
7176 components
7277
7378 Returns:
74- Dict[str, autoPyTorchComponent]: The available components via a mapping
79+ Dict[str, autoPyTorchComponent]:
80+ The available components via a mapping
7581 from the module name to the component class
7682
7783 """
@@ -88,10 +94,13 @@ def get_available_components(
8894 user specification
8995
9096 Args:
91- dataset_properties (Optional[Dict[str, BaseDatasetPropertiesType]]): Describes the dataset to work on
92- include: Optional[Dict[str, Any]]: what components to include. It is an exhaustive
97+ dataset_properties (Optional[Dict[str, BaseDatasetPropertiesType]]):
98+ Describes the dataset to work on
99+ include: Optional[Dict[str, Any]]:
100+ what components to include. It is an exhaustive
93101 list, and will exclusively use this components.
94- exclude: Optional[Dict[str, Any]]: which components to skip
102+ exclude: Optional[Dict[str, Any]]:
103+ which components to skip. Can't be used together with include
95104
96105 Results:
97106 Dict[str, autoPyTorchComponent]: A dictionary with valid components for this
@@ -137,10 +146,10 @@ def set_hyperparameters(self,
137146 to an actual parameter of the autoPyTorch component.
138147
139148 Args:
140- configuration (Configuration): which configuration to apply to
141- the chosen component
142- init_params (Optional[Dict[str, any]]): Optional arguments to
143- initialize the chosen component
149+ configuration (Configuration):
150+ Which configuration to apply to the chosen component
151+ init_params (Optional[Dict[str, any]]):
152+ Optional arguments to initialize the chosen component
144153
145154 Returns:
146155 self: returns an instance of self
@@ -177,11 +186,15 @@ def get_hyperparameter_search_space(
177186 """Returns the configuration space of the current chosen components
178187
179188 Args:
180- dataset_properties (Optional[Dict[str, BaseDatasetPropertiesType]]): Describes the dataset to work on
181- default: (Optional[str]) : Default component to use in hyperparameters
182- include: Optional[Dict[str, Any]]: what components to include. It is an exhaustive
189+ dataset_properties (Optional[Dict[str, BaseDatasetPropertiesType]]):
190+ Describes the dataset to work on
191+ default: (Optional[str]):
192+ Default component to use in hyperparameters
193+ include: Optional[Dict[str, Any]]:
194+ what components to include. It is an exhaustive
183195 list, and will exclusively use this components.
184- exclude: Optional[Dict[str, Any]]: which components to skip
196+ exclude: Optional[Dict[str, Any]]:
197+ which components to skip
185198
186199 Returns:
187200 ConfigurationSpace: the configuration space of the hyper-parameters of the
@@ -193,8 +206,10 @@ def fit(self, X: Dict[str, Any], y: Any) -> autoPyTorchComponent:
193206 """Handy method to check if a component is fitted
194207
195208 Args:
196- X (X: Dict[str, Any]): Dependencies needed by current component to perform fit
197- y (Any): not used. To comply with sklearn API
209+ X (X: Dict[str, Any]):
210+ Dependencies needed by current component to perform fit
211+ y (Any):
212+ not used. To comply with sklearn API
198213 """
199214 # Allows to use check_is_fitted on the choice object
200215 self .fitted_ = True
@@ -205,19 +220,23 @@ def predict(self, X: np.ndarray) -> np.ndarray:
205220 """Predicts the target given an input, by using the chosen component
206221
207222 Args:
208- X (np.ndarray): input features from which to predict the target
223+ X (np.ndarray):
224+ input features from which to predict the target
209225
210226 Returns:
211- np.ndarray: the predicted target
227+ np.ndarray:
228+ the target prediction
212229 """
213230 assert self .choice is not None , "Cannot call predict without initializing the component"
214231 return self .choice .predict (X )
215232
216233 def transform (self , X : Dict [str , Any ]) -> Dict [str , Any ]:
217234 """
218235 Adds the current choice in the fit dictionary
236+
219237 Args:
220- X (Dict[str, Any]): fit dictionary
238+ X (Dict[str, Any]):
239+ fit dictionary
221240
222241 Returns:
223242 (Dict[str, Any])
@@ -233,7 +252,8 @@ def check_requirements(self, X: Dict[str, Any], y: Any = None) -> None:
233252 are honored before fit.
234253
235254 Args:
236- X (Dict[str, Any]): Dictionary with fitted parameters. It is a message passing
255+ X (Dict[str, Any]):
256+ Dictionary with fitted parameters. It is a message passing
237257 mechanism, in which during a transform, a components adds relevant information
238258 so that further stages can be properly fitted
239259 """
@@ -246,7 +266,8 @@ def _check_dataset_properties(self, dataset_properties: Dict[str, BaseDatasetPro
246266 """
247267 A mechanism in code to ensure the correctness of the initialised dataset properties.
248268 Args:
249- dataset_properties:
269+ dataset_properties (Dict[str, BaseDatasetPropertiesType]):
270+ Describes the dataset to work on
250271
251272 """
252273 assert isinstance (dataset_properties , dict ), "dataset_properties must be a dictionary"
0 commit comments