Base model
- class sorrel.models.base_model.BaseModel(input_size: int | Sequence[int], action_space: int, memory_size: int, epsilon: float = 0.0)
Generic model class for Sorrel. All models should wrap around this implementation.
- input_size
The size of the input.
- Type:
int | Sequence[int]
- action_space
The number of actions available.
- Type:
int
- memory
The replay buffer for the model.
- Type:
sorrel.buffers.Buffer
- epsilon
The epsilon value for the model.
- Type:
float
Properties
- property BaseModel.model_name
Get the name of the model class.
Methods
Abstract Methods
- abstractmethod BaseModel.take_action(state) int
Take an action based on the observed input. Must be implemented by all subclasses of the model.
- Parameters:
state – The observed input.
- Returns:
The action chosen.
Non-Abstract Methods
- BaseModel.train_step() ndarray
Train the model.
- Returns:
The loss value.
- BaseModel.set_epsilon(new_epsilon: float) None
Replaces the current model epsilon with the provided value.
- BaseModel.start_epoch_action(**kwargs)
Actions to perform before each epoch.
- BaseModel.end_epoch_action(**kwargs)
Actions to perform after each epoch.
- BaseModel.reset()
Reset any relevant model parameters or properties that will be reset at the beginning of a new epoch.
By default, nothing is reset.