add pytorch regressor example

This commit is contained in:
Yinon Polak
2023-03-20 17:06:33 +02:00
parent 601c37f862
commit 54db239175
5 changed files with 137 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ from freqtrade.freqai.prediction_models.PyTorchMLPModel import PyTorchMLPModel
class PyTorchMLPClassifier(PyTorchClassifier):
"""
This class implements the fit method of IFreqaiModel.
int the fit method we initialize the model and trainer objects.
in the fit method we initialize the model and trainer objects.
the only requirement from the model is to be aligned to PyTorchClassifier
predict method that expects the model to predict tensor of type long.
the trainer defines the training loop.
@@ -75,6 +75,7 @@ class PyTorchMLPClassifier(PyTorchClassifier):
model_meta_data={"class_names": class_names},
device=self.device,
init_model=init_model,
target_tensor_type=torch.long,
**self.trainer_kwargs,
)
trainer.fit(data_dictionary)