Skip to main content

Human object learning benchmarks

Project description

hobj: human object learning benchmarks

CI

This repository contains benchmarks for comparing models of object learning against measurements of human behavior, from Lee and DiCarlo 2023 ("How well do rudimentary plasticity rules predict adult visual object learning?"). It also lets you download the raw data and images from the experiments in the paper.

Alt text

If you just want to download the raw data and images without using the hobj library, you can do so at the OSF repository for this project.

Quickstart

Install

The hobj package works for Python >=3.12.

Install it from PyPI:

pip install hobj

If you prefer to use uv, you can install it with:

uv pip install hobj

Using hobj to comparing a linear learner against human learning data

The template script below shows you how you can run a benchmark on a linear learning model based on your image encoding model.

All you need to do is have a way to process a PIL.Image into a vector of image features (as an np.ndarray). There are ~18,000 images that you'd need to compute image features for.

import hobj
import numpy as np 

# Compute your features for the images 
my_image_features: dict[str, np.ndarray] = {}
for image_id in hobj.list_image_ids():
    image = hobj.load_image(image_id=image_id) # PIL.Image
    
    # Compute your features here:  
    my_image_features[image_id] = ... # replace right hand side with your image-computable model

# Assemble the learning model:
model = hobj.create_linear_learner(
    image_id_to_features=my_image_features,
    update_rule_name='Square', # "Square", "Perceptron", "Hinge", "MAE", "Exponential", "CE", "REINFORCE",
    alpha=1, # learning rate between [0, 1]
)

# Load the benchmark:
benchmark = hobj.MutatorHighVarBenchmark()  # or hobj.MutatorOneshotBenchmark()

# Score the model:
result = benchmark.score_model(model)

# Print its score and its CI:
print(result.msen, result.msen_CI95)

# You can also check out more granular statistics of the model's behavior, like its learning curves: 
# print(result.model_statistics)

For more details (e.g., how to load the raw behavioral data or images in Python), check out the Jupyter notebooks in examples/.

To use a different location, pass cachedir=... to a data loader or benchmark constructor, or prefetch manually with hobj-download-data --cachedir /path/to/data.

Contact

If you have any questions, need help, or experience a bug, please don't hesitate to email me (mil@mit.edu), or open an issue on this repo!

Changes to codebase since publication

This codebase was overhauled in 2026 to improve its accessibility, performance, and quality. Along the way, minor changes to the statistical analysis procedure were introduced, along with changes to the names of the original filenames (see changelist). To see the codebase at the time of publication, check out the repo with the v1 tag here.

Citation

@article{lee2023well,
  title={How well do rudimentary plasticity rules predict adult visual object learning?},
  author={Lee, Michael J and DiCarlo, James J},
  journal={PLOS Computational Biology},
  volume={19},
  number={12},
  pages={e1011713},
  year={2023},
  publisher={Public Library of Science San Francisco, CA USA}
}

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

hobj-2.0.0.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

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

hobj-2.0.0-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file hobj-2.0.0.tar.gz.

File metadata

  • Download URL: hobj-2.0.0.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.12

File hashes

Hashes for hobj-2.0.0.tar.gz
Algorithm Hash digest
SHA256 e37f8412231b94f307f5e568abdca7fe48e4e3aaa6d6f6cb5d9e79011d1c6b28
MD5 aa738de1f4e5e5bedcd26df0f4373cc9
BLAKE2b-256 6351fe9a9dac516e78be73f11569d321fbbf04d82c70ea8f9c2d3f18554e42d8

See more details on using hashes here.

File details

Details for the file hobj-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: hobj-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.12

File hashes

Hashes for hobj-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 959c62b66567cc9403b15070c4052871683ce9ca9fbbf7f4675bbe738505b518
MD5 a7addb11b03be95f92fd6df9246567b7
BLAKE2b-256 0e293960c13d18ee24818c147a8ea7f1dc8998e6c02a9a610cb7ff4b0db96af2

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