(self, value_type: ValueEstimators, **hyperparams)
| 245 | |
| 246 | |
| 247 | def make_value_estimator(self, value_type: ValueEstimators, **hyperparams): |
| 248 | hp = dict(default_value_kwargs(value_type)) |
| 249 | if hasattr(self, "gamma"): |
| 250 | hp["gamma"] = self.gamma |
| 251 | hp.update(hyperparams) |
| 252 | value_key = "state_action_value" |
| 253 | if value_type == ValueEstimators.TD1: |
| 254 | self._value_estimator = TD1Estimator(value_network=self.actor_critic, **hp) |
| 255 | elif value_type == ValueEstimators.TD0: |
| 256 | self._value_estimator = TD0Estimator(value_network=self.actor_critic, **hp) |
| 257 | elif value_type == ValueEstimators.GAE: |
| 258 | raise NotImplementedError( |
| 259 | f"Value type {value_type} it not implemented for loss {type(self)}." |
| 260 | ) |
| 261 | elif value_type == ValueEstimators.TDLambda: |
| 262 | self._value_estimator = TDLambdaEstimator(value_network=self.actor_critic, **hp) |
| 263 | else: |
| 264 | raise NotImplementedError(f"Unknown value type {value_type}") |
| 265 | self._value_estimator.set_keys(value=value_key) |
| 266 | |
| 267 | |
| 268 | ############################################################################### |
nothing calls this directly
no outgoing calls
no test coverage detected