pynol.online_learning¶
online_learning¶
- pynol.online_learning.online_learning(T, env: Environment, learner: Base | Model)[source]¶
Combine the environment and learner, start the online learning process.
- Parameters:
T (int) – Number of total round.
env (Environment) – Environment.
- Returns:
- tuple contains:
x (numpy.ndarray): Decisions over \(T\) rounds.
loss (numpy.ndarray): Losses over \(T\) rounds.
surrogate_loss (numpy.ndarray): Surrogate losses over \(T\) rounds.
tm (numpy.ndarray): Time cost over \(T\) rounds.
- Return type:
tuple
multiple_online_learning¶
- pynol.online_learning.multiple_online_learning(T, env: Environment, learners: list, processes=4)[source]¶
Combine the environment and multiple learners, start the online learning process with multiprocessing to speed up.
- Parameters:
T (int) – Number of total round.
env (Environment) – Environment.
learners (list) – Learners.
- Returns:
- tuple contains:
x (numpy.ndarray): Decisions of all learners over \(T\) rounds.
loss (numpy.ndarray): Losses of all learners over \(T\) rounds.
surrogate_loss (numpy.ndarray): Surrogate losses of all learners over \(T\) rounds.
tm (numpy.ndarray): Time cost of all learners over \(T\) rounds.
- Return type:
tuple