• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

freqtrade / freqtrade / 6181253459

08 Sep 2023 06:04AM UTC coverage: 94.614% (+0.06%) from 94.556%
6181253459

push

github-actions

web-flow
Merge pull request #9159 from stash86/fix-adjust

remove old codes when we only can do partial entries

2 of 2 new or added lines in 1 file covered. (100.0%)

19114 of 20202 relevant lines covered (94.61%)

0.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.44
/freqtrade/freqai/base_models/BasePyTorchModel.py
1
import logging
1✔
2
from abc import ABC, abstractmethod
1✔
3

4
import torch
1✔
5

6
from freqtrade.freqai.freqai_interface import IFreqaiModel
1✔
7
from freqtrade.freqai.torch.PyTorchDataConvertor import PyTorchDataConvertor
1✔
8

9

10
logger = logging.getLogger(__name__)
1✔
11

12

13
class BasePyTorchModel(IFreqaiModel, ABC):
1✔
14
    """
15
    Base class for PyTorch type models.
16
    User *must* inherit from this class and set fit() and predict() and
17
    data_convertor property.
18
    """
19

20
    def __init__(self, **kwargs):
1✔
21
        super().__init__(config=kwargs["config"])
1✔
22
        self.dd.model_type = "pytorch"
1✔
23
        self.device = "cuda" if torch.cuda.is_available() else "cpu"
1✔
24
        test_size = self.freqai_info.get('data_split_parameters', {}).get('test_size')
1✔
25
        self.splits = ["train", "test"] if test_size != 0 else ["train"]
1✔
26
        self.window_size = self.freqai_info.get("conv_width", 1)
1✔
27

28
    @property
1✔
29
    @abstractmethod
1✔
30
    def data_convertor(self) -> PyTorchDataConvertor:
1✔
31
        """
32
        a class responsible for converting `*_features` & `*_labels` pandas dataframes
33
        to pytorch tensors.
34
        """
35
        raise NotImplementedError("Abstract property")
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc