Skip to main content

Behavior Learning (BL): Learning Hierarchical Optimization Structures from Data

Project description

Behavior Learning (BL)

Behavior Learning (BL) is a general-purpose machine learning framework grounded in behavioral science. It unifies predictive performance and intrinsic interpretability within a single modeling paradigm. BL learns explicit optimization structures from data by parameterizing a compositional utility function built from interpretable modular blocks. Each block represents a Utility Maximization Problem (UMP), a foundational framework of decision-making and optimization. BL supports architectures ranging from a single UMP to hierarchical compositions, enabling expressive yet structurally transparent models. Unlike post-hoc explanation methods, BL provides interpretability by design while maintaining strong empirical performance on high-dimensional tasks.

Installation

blnetwork can be installed via PyPI or directly from GitHub.

Pre-requisites:

Python 3.10.9 or higher
pip

For developers

git clone https://github.com/MoonYLiang/Behavior-Learning.git
cd blnetwork
pip install -e .

Installation via github

pip install git+https://github.com/MoonYLiang/Behavior-Learning.git

Installation via PyPI:

pip install blnetwork

Requirements

# python==3.10.9
torch>=2.2
numpy>=1.26
pandas>=2.0

After activating the virtual environment, you can install specific package requirements as follows:

pip install -r requirements.txt

Optional: Conda Environment Setup For those who prefer using Conda:

conda create --name blnetwork-env python=3.10.9
conda activate blnetwork-env
pip install git+https://github.com/MoonYLiang/Behavior-Learning.git  # For GitHub installation
# or
pip install blnetwork  # For PyPI installation

Computation Requirements

BL is implemented in PyTorch and supports both CPU and GPU training.

  • Small-scale tabular examples run on a single CPU within a few minutes.
  • High-dimensional settings may benefit from GPU acceleration (e.g., NVIDIA L40).

For most tabular tasks, CPU training is sufficient.

Examples

Start with the notebooks in examples/:

You need to install scikit-learn>=1.3 to run Examples

Important Hyperparameters

  • hidden_dims: BL backbone architecture (depth of BL blocks). Similar to MLP hidden sizes, though BL often requires smaller widths.

  • first_act_func: U-block activation function (e.g., tanh, "none").
    Controls the nonlinearity of the utility term.
    tanh introduces diminishing marginal effects, while "none" keeps it linear.

  • second_act_func / third_act_func: C-/T-block activation functions.
    Shape the constraint structures of the learned optimization landscape.

  • constrain_lambda: λ positivity constraint.
    If enabled, enforces λ > 0.

  • export_cfg: model structure export configuration.
    Controls exporting a structured .txt summary of model parameters. Accepts df / feature_names to align learned parameters with input variable names for interpretability.

Other training hyperparameters (optimizer, learning rate, batch size, weight decay, early stopping, etc.) can generally be tuned similarly to standard MLPs.

Advice on hyperparameter tuning

In many cases, BL can achieve comparable (or slightly better) performance than an MLP baseline using roughly one third of the hidden width.

Other hyperparameters can be initialized based on standard MLP tuning, and then refined for the specific task.

Contact

If you have any questions, please contact yue.liang@student.uni-tuebingen.de

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

blnetwork-0.1.1.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

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

blnetwork-0.1.1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file blnetwork-0.1.1.tar.gz.

File metadata

  • Download URL: blnetwork-0.1.1.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for blnetwork-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ce865e9abbb23468e05dd6ec21a906c8092bb65be115f6c55a1c8f31c7bdb63d
MD5 0fd39cdd353b111548a10d5b59173069
BLAKE2b-256 541bb431579424fa1aea0aa25ac9f79c3eb4cbe47fa3052651a78de57981ea95

See more details on using hashes here.

File details

Details for the file blnetwork-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: blnetwork-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for blnetwork-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ddab9c97e455533f0d60635e2cda2b57bffb2d75629861c95ffe214ba7351cd1
MD5 ae4a5c397b0c2768073f0fc7e7d1fd85
BLAKE2b-256 defebb9a5a023758f3879b497fa3da986a4918ad066b0f2062ac1ddfb5c74a1a

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