Skip to main content

A simple package providing common Reinforcement Learning utility functions

Project description

RL Utils

A simple and useful Python package providing common Reinforcement Learning utility functions.

Installation

pip install rl-utils

Features

This package provides essential utility functions for implementing Reinforcement Learning algorithms:

  • Epsilon-Greedy Action Selection: Classic exploration-exploitation strategy
  • Q-Learning Update: Implementation of the Q-learning algorithm update rule
  • Softmax Action Selection: Boltzmann exploration strategy
  • Q-Table Initialization: Helper function to initialize Q-tables

Usage

Epsilon-Greedy Action Selection

from rl_utils import epsilon_greedy_action
import numpy as np

q_values = [0.5, 0.3, 0.8, 0.2]
action = epsilon_greedy_action(q_values, epsilon=0.1, num_actions=4)

Q-Learning Update

from rl_utils import q_learning_update, initialize_q_table
import numpy as np

# Initialize Q-table
q_table = initialize_q_table(num_states=10, num_actions=4)

# Update Q-value
q_table, new_q = q_learning_update(
    q_table=q_table,
    state=0,
    action=1,
    reward=10.0,
    next_state=2,
    alpha=0.1,
    gamma=0.9,
    num_actions=4
)

Softmax Action Selection

from rl_utils import softmax_action_selection

q_values = [0.5, 0.3, 0.8, 0.2]
action = softmax_action_selection(q_values, temperature=1.0)

Requirements

  • numpy >= 1.11.1

License

MIT License

Author

Created for RL Practicum course.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rl_practicum_i054-0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rl_practicum_i054-0.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file rl_practicum_i054-0.1.tar.gz.

File metadata

  • Download URL: rl_practicum_i054-0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for rl_practicum_i054-0.1.tar.gz
Algorithm Hash digest
SHA256 c5616b02e87418aa278d04f8cb21b6a2e30675e409514fb292b67763117ffc75
MD5 671bdd6a32d9e26b557a9339a58cf06a
BLAKE2b-256 3e3b44ddee2630385037f0273df4ead037c87f4a6ffd65a88e5cdea577633481

See more details on using hashes here.

File details

Details for the file rl_practicum_i054-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for rl_practicum_i054-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c91c9825d59cb0a7c166222947fa53f27b457663e3385c31fe0095380989130
MD5 d7038998da2cad7059c2589790804f1f
BLAKE2b-256 e261af30f9d8691c04c48c49cb3c766073b21301d45a68c499f8e31baf161c70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page