striatum.storage package¶
Submodules¶
striatum.storage.model module¶
Model storage
-
class
striatum.storage.model.
MemoryModelStorage
¶ Bases:
striatum.storage.model.ModelStorage
Store the model in memory.
Methods
get_model
()save_model
(model)-
get_model
()¶
-
save_model
(model)¶
-
-
class
striatum.storage.model.
ModelStorage
¶ Bases:
object
The object to store the model.
Methods
get_model
()Get model save_model
()Save model -
get_model
()¶ Get model
-
save_model
()¶ Save model
-
striatum.storage.history module¶
History storage
-
class
striatum.storage.history.
History
(history_id, action_time, context, action, reward_time=None, reward=None)¶ Bases:
object
action/reward history entry
Methods
update_reward
(reward_time, reward)update reward_time and reward -
update_reward
(reward_time, reward)¶ update reward_time and reward
-
-
class
striatum.storage.history.
HistoryStorage
¶ Bases:
object
The object to store the history of context, actions and rewards.
Methods
add_history
(context, action[, reward])Add a history record. add_reward
(history_id, reward)Add reward to a history record. get_history
(history_id)Get the preivous context, action and reward with history_id. get_unrewarded_history
(history_id)Get the previous unrewarded context, action and reward with history_id. -
add_history
(context, action, reward=None)¶ Add a history record.
Parameters: context : {array-like, None}
action : Action object
reward : {float, None}, optional (default: None)
-
add_reward
(history_id, reward)¶ Add reward to a history record.
Parameters: history_id : int
The history id of the history record to retrieve.
reward : float
-
get_history
(history_id)¶ Get the preivous context, action and reward with history_id.
Parameters: history_id : int
The history id of the history record to retrieve.
Returns: history: History object
-
get_unrewarded_history
(history_id)¶ Get the previous unrewarded context, action and reward with history_id.
Parameters: history_id : int
The history id of the history record to retrieve.
Returns: history: History object
-
-
class
striatum.storage.history.
MemoryHistoryStorage
¶ Bases:
striatum.storage.history.HistoryStorage
HistoryStorage that store all data in memory
Methods
add_history
(context, action[, reward])Add a history record. add_reward
(history_id, reward)Add reward to a history record. get_history
(history_id)Get the previous context, action and reward with history_id. get_unrewarded_history
(history_id)Get the previous unrewarded context, action and reward with history_id. -
add_history
(context, action, reward=None)¶ Add a history record.
Parameters: context : {array-like, None}
action : Action object
reward : {float, None}, optional (default: None)
-
add_reward
(history_id, reward)¶ Add reward to a history record.
Parameters: history_id : int
The history id of the history record to retrieve.
reward : float
-
get_history
(history_id)¶ Get the previous context, action and reward with history_id.
Parameters: history_id : int
The history id of the history record to retrieve.
Returns: history: History object
-
get_unrewarded_history
(history_id)¶ Get the previous unrewarded context, action and reward with history_id.
Parameters: history_id : int
The history id of the history record to retrieve.
Returns: history: History object
-
Module contents¶
Storage classes