Skip to main content

A naive Bayes Markov decision process learner

Project description

Fuzzy Naive Cartographer

The "model" part of a model-based reinforcement learning algorithm.

Installation

Pull down the FNC repository. At the command line:

uv add naive-cartographer

Usage

The FNC class Naive Cartographer is intended to be used in tandem with a planner (not included) to build a reinforcement learning agent. At each time step

  1. The FNC makes a prediction
  2. The planner uses that prediction to choose an action
  3. The FNC registers the action selection

The outline of an agent class looks like this:

from cartographer import NaiveCartographer as Model 

class Agent
    def __init__(self, n_sensors, n_actions):
        model = Model(n_sensors=n_sensors, n_actions=n_actions)
        planner = ...

    def step(self, sensors, reward):
        predictions, rewards, uncertainties = model.predict(sensors, reward)
        actions = planner.choose_actions(predictions, rewards, uncertainties)
        model.update_actions(actions)
        return actions

Testing

Run some unit tests with

uv run pytest

About

A Fuzzy Naive Cartographer (FNC) builds a Markov Decision Process-like model of its world in the form of a set of sequences. Sequences are of the form of state-action-state as in MDPs. Here they're also referred to as feature-action-outcome sequences, to disambiguate the before- and after-state.

FNC builds a value function too. It creates a set of feature-action pairs and associates a reward with each. This is analogous to the state-action value functions of Q-learning.

A model and a value function allow for prediction and planning. Knowing the current active features and recent actions, both the reward and the resulting features can be anticipated.

Technically FNC is just the "model" part of a model-based RL algorithm. It needs to paired with a planner, some element that will choose an action or goal, to be a complete RL algorithm. There are some rudimentary planners included with this module to get you up and running.

There is more detail in the white paper at https://brandonrohrer.com/cartographer

Project details


Download files

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

Source Distribution

naive_cartographer-3.0.1.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

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

naive_cartographer-3.0.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file naive_cartographer-3.0.1.tar.gz.

File metadata

  • Download URL: naive_cartographer-3.0.1.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.1

File hashes

Hashes for naive_cartographer-3.0.1.tar.gz
Algorithm Hash digest
SHA256 ed40e7149784ddf1cae6cf9aaf28b51360a87dd44b29a50e7a179452a2b6c7a1
MD5 dff917f66b7559ae2e86f28fe3dca160
BLAKE2b-256 df6aa9de525b0ef3ed971029d6a236b6b0c5750dca4476540ce2bd1ce40c90b3

See more details on using hashes here.

File details

Details for the file naive_cartographer-3.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for naive_cartographer-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8539ecb96d1d79fbf530fb65fe847716d2e9de1d8300012a4480dcd620bb45c
MD5 acb1a05ab0e17a222fd4ae8ef2693c13
BLAKE2b-256 a5a2363d41e3be7ef19c300b775f07ef81efbd350dcf0b5c699b95ed88ad0426

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