RLTrader icon indicating copy to clipboard operation
RLTrader copied to clipboard

'BaseRLModel' is not callable?

Open reasondk opened this issue 4 years ago • 1 comments

Hi, guys, 'RLTrade.py' this model display "'BaseRLModel' is not callable?" , why?

def initialize_optuna(self):
    try:
        train_env = DummyVecEnv([lambda: TradingEnv(self.data_provider)])
        model = self.Model(self.Policy, train_env, nminibatches=1)                   ###  'BaseRLModel' is not callable???
        strategy = self.Reward_Strategy()                                                            ###  'BaseRewardStrategy' is not callable???
        self.study_name = f'{model.__class__.__name__}__{model.act_model.__class__.__name__}__{strategy.__class__.__name__}'
    except:
        self.study_name = f'UnknownModel__UnknownPolicy__UnknownStrategy'

reasondk avatar Sep 23 '20 09:09 reasondk

@reasondk Are you seeing that message as part of PyCharms inspections; b/c that's where I'm seeing it.

It's not "Callable" because the argument BaseRLModel is passed in as a "Class" and not an instance of a class, and the class doesn't implement an __call__ method. I've tried to implement a __class__ method, but it wasn't worth the effort.

I haven't had any problems because of this "warning".

I've concluded it's just a false positive, intended for a different context.

The code works fine as written.

MichaelQuaMan avatar Feb 02 '22 13:02 MichaelQuaMan