clean code

This commit is contained in:
Yinon Polak 2023-03-21 11:23:45 +02:00
parent e8f040bfbd
commit 9906e7d646
2 changed files with 8 additions and 20 deletions

View File

@ -38,18 +38,12 @@ class PyTorchMLPClassifier(PyTorchClassifier):
} }
""" """
def __init__( def __init__(self, **kwargs):
self,
learning_rate: float = 3e-4,
model_kwargs: Dict[str, Any] = {},
trainer_kwargs: Dict[str, Any] = {},
**kwargs
):
super().__init__(**kwargs) super().__init__(**kwargs)
config = self.freqai_info.get("model_training_parameters", {}) config = self.freqai_info.get("model_training_parameters", {})
self.learning_rate: float = config.get("learning_rate", learning_rate) self.learning_rate: float = config.get("learning_rate", 3e-4)
self.model_kwargs: Dict[str, Any] = config.get("model_kwargs", model_kwargs) self.model_kwargs: Dict[str, Any] = config.get("model_kwargs", {})
self.trainer_kwargs: Dict[str, Any] = config.get("trainer_kwargs", trainer_kwargs) self.trainer_kwargs: Dict[str, Any] = config.get("trainer_kwargs", {})
def fit(self, data_dictionary: Dict, dk: FreqaiDataKitchen, **kwargs) -> Any: def fit(self, data_dictionary: Dict, dk: FreqaiDataKitchen, **kwargs) -> Any:
""" """

View File

@ -39,18 +39,12 @@ class PyTorchMLPRegressor(PyTorchRegressor):
} }
""" """
def __init__( def __init__(self, **kwargs):
self,
learning_rate: float = 3e-4,
model_kwargs: Dict[str, Any] = {},
trainer_kwargs: Dict[str, Any] = {},
**kwargs
):
super().__init__(**kwargs) super().__init__(**kwargs)
config = self.freqai_info.get("model_training_parameters", {}) config = self.freqai_info.get("model_training_parameters", {})
self.learning_rate: float = config.get("learning_rate", learning_rate) self.learning_rate: float = config.get("learning_rate", 3e-4)
self.model_kwargs: Dict[str, Any] = config.get("model_kwargs", model_kwargs) self.model_kwargs: Dict[str, Any] = config.get("model_kwargs", {})
self.trainer_kwargs: Dict[str, Any] = config.get("trainer_kwargs", trainer_kwargs) self.trainer_kwargs: Dict[str, Any] = config.get("trainer_kwargs", {})
def fit(self, data_dictionary: Dict, dk: FreqaiDataKitchen, **kwargs) -> Any: def fit(self, data_dictionary: Dict, dk: FreqaiDataKitchen, **kwargs) -> Any:
""" """