Skip to content
Merged

V2 #6

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
e7a4674
update readme
himjl Jan 21, 2025
6c380b7
update readme 2
himjl Jan 21, 2025
04f62aa
Remove .idea from tracking
himjl Jan 21, 2025
437bb9e
add CI
himjl Jan 21, 2025
b576b45
added status badge
himjl Jan 21, 2025
ba561f8
adjust requirements
himjl Jan 21, 2025
ee2dbeb
adjust semver
himjl Jan 21, 2025
7d55490
adjust setup.py
himjl Jan 21, 2025
b330b48
adjust triggers
himjl Jan 21, 2025
d2ec9a5
adjust readme
himjl Jan 21, 2025
60cba60
add dummy test
himjl Jan 21, 2025
6e71170
numpy requirements and readme
himjl Jan 21, 2025
ba38bd8
clean up setup.py file
himjl Jan 21, 2025
8f78ce2
removed unused state_space code
himjl Jan 21, 2025
9a2d8fa
adjust requirements
himjl Jan 21, 2025
528007b
removed irrelevant line
himjl Jan 21, 2025
359fd6f
adjust requirements
himjl Jan 21, 2025
640aad6
added tqdm
himjl Jan 21, 2025
910e74c
add pytest dep
himjl Jan 21, 2025
83334b3
added pydantic dep
himjl Jan 21, 2025
9de1414
added reqs
himjl Jan 21, 2025
55f9287
installing matplotlib
himjl Jan 21, 2025
a938bdc
deprecated benchmark class
himjl Jan 21, 2025
477e4aa
before learning model ref
himjl Jan 22, 2025
5b9481f
remove learner id
himjl Jan 22, 2025
6ebc46e
refactor learning model
himjl Jan 22, 2025
06424db
refactored / renamed learning model
himjl Jan 22, 2025
725bcdd
added BinaryTask
himjl Jan 22, 2025
832bef3
removed readme
himjl Jan 22, 2025
53d65f2
moved behavioral data
himjl Jan 22, 2025
ebc37d0
renamed dir
himjl Jan 22, 2025
7bdf58f
removed mut highvar experiment
himjl Jan 22, 2025
accc9ff
removed simulation caching
himjl Jan 22, 2025
b5032bd
removed image features config line
himjl Jan 22, 2025
6b78173
turned into path
himjl Jan 22, 2025
16d15b0
renamed cache
himjl Jan 22, 2025
d610bf9
removed readme
himjl Jan 22, 2025
a1e48a4
data store
himjl Jan 22, 2025
86d4d3a
delete load image
himjl Jan 22, 2025
5d0806f
add imageset template
himjl Jan 22, 2025
2ac13ef
tag depr
himjl Jan 22, 2025
18f5dae
added warmup imageset
himjl Jan 22, 2025
5bdb323
added highvar and oneshot
himjl Jan 22, 2025
1836f6f
delete old imageset
himjl Jan 22, 2025
fa2473c
clean up directory structure
himjl Jan 22, 2025
1750438
add probe imageset
himjl Jan 22, 2025
67cae24
repackaged behavioral data
himjl Jan 22, 2025
a8f59a1
progress on behavioral template
himjl Jan 23, 2025
88d68d2
to pydantic model
himjl Jan 23, 2025
34a8dda
remove irrelevant
himjl Jan 23, 2025
d301459
delete depr behavior
himjl Jan 23, 2025
b352b93
update linear learner
himjl Jan 23, 2025
7c4984d
clean up directory structure of learning models
himjl Jan 23, 2025
345aed2
clean up utils
himjl Jan 23, 2025
7b8d493
simplify behavioral data loaders
himjl Jan 23, 2025
3ce04e0
convenience method
himjl Jan 23, 2025
a5ec9cd
add test
himjl Jan 23, 2025
44f0f1f
add BinaryClassificationSubtask
himjl Jan 23, 2025
8c33182
test
himjl Jan 23, 2025
037f9b8
filter
himjl Jan 23, 2025
399f50f
functional high var benchmark
himjl Jan 24, 2025
8fcb031
update requirements
himjl Jan 24, 2025
7a9cd78
install pytest
himjl Jan 24, 2025
64a28a3
install requests
himjl Jan 24, 2025
9a61f25
remove unused imports
himjl Jan 24, 2025
4d9665a
clean up data model wrapping
himjl Jan 26, 2025
5a4c7f9
fix slots warning?
himjl Jan 26, 2025
2e6fbb3
core oneshot code
himjl Jan 26, 2025
1b33259
clean up oneshot
himjl Jan 27, 2025
f3a127b
bootstrapping by worker mut highvar benchmark
himjl Jan 27, 2025
337fd30
remove unused
himjl Jan 27, 2025
57b90fa
correct imports
himjl Jan 27, 2025
ab6ed11
add notebook
himjl Jan 27, 2025
d7a245d
remove print statements
himjl Jan 27, 2025
ae9206d
add experiment2 notebook
himjl Jan 27, 2025
b67f3a7
remove precached model
himjl Jan 27, 2025
e3b0000
lint
himjl Jan 27, 2025
d4bae33
improve import
himjl Jan 27, 2025
c26260c
refresh
himjl Jan 27, 2025
970afc5
add banner image
himjl Jan 27, 2025
6f0d02b
center image
himjl Jan 27, 2025
5b6e336
Add example usage section
himjl Jan 27, 2025
c78fc38
improve readme
himjl Jan 27, 2025
76a272e
added changelist
himjl Jan 27, 2025
9bd4e65
Merge pull request #4 from himjl/v2-refactor
himjl Jan 27, 2025
e6bc53d
write toml
himjl Jan 28, 2025
2813008
move pytest to dep
himjl Jan 28, 2025
9ad27e6
trigger
himjl Jan 28, 2025
0c417e9
Merge pull request #5 from himjl/pyproject.toml-setup
himjl Jan 28, 2025
fabf327
edit pyproject.toml
himjl Jan 28, 2025
d6da92c
remove line?
himjl Jan 28, 2025
7fa1369
dot?
himjl Jan 28, 2025
adcc930
turn off namespaces again
himjl Jan 28, 2025
fb2be4e
commit
himjl Jan 31, 2025
0f2ef26
initial
himjl Feb 1, 2025
1e6426b
alternative interface for instantiating a linear learning model
himjl Feb 5, 2025
7c3e5b7
before rework triplet collection
himjl Feb 25, 2025
7a7cd9c
add mref dep
himjl Mar 14, 2025
4f55862
Merge pull request #7 from himjl/v2-features-signature
himjl Mar 14, 2025
6f87a22
uv install
himjl Mar 24, 2026
a7d2b27
add citation
himjl Mar 24, 2026
212c20e
check
himjl Mar 24, 2026
1f8f9c1
fix docstring
himjl Mar 24, 2026
45c89f1
test
himjl Mar 24, 2026
1dd8c0e
move
himjl Mar 24, 2026
893e7b6
rename to loaders
himjl Mar 24, 2026
65a8a51
dir refactor
himjl Mar 24, 2026
bffd0d2
remove mref from learning models
himjl Mar 24, 2026
cee7311
optimize imports
himjl Mar 24, 2026
e132824
flatten
himjl Mar 24, 2026
2699b53
3.12 only
himjl Mar 24, 2026
2520cd5
remove mref from tests
himjl Mar 24, 2026
ee3dd34
updated getters for images
himjl Mar 24, 2026
a1e059b
download behavior without mref
himjl Mar 24, 2026
98a3c3a
Merge pull request #8 from himjl/v2-simplify
himjl Mar 24, 2026
6eafa67
load highvar from CSV
himjl Mar 25, 2026
5f3b307
rerun
himjl Mar 25, 2026
1c23a70
wire in new loaders
himjl Mar 25, 2026
5289cf2
rerun
himjl Mar 25, 2026
9f3c81d
remove unused
himjl Mar 25, 2026
ed3524e
new loader
himjl Mar 25, 2026
7a60f7b
ref_to_features
himjl Mar 25, 2026
0e84a55
delete config
himjl Mar 25, 2026
d643a61
wire in imageset
himjl Mar 25, 2026
a7611d9
new loaders
himjl Mar 26, 2026
b05193a
remove script
himjl Mar 26, 2026
940ff24
simplified loaders
himjl Mar 26, 2026
e28d95e
lint
himjl Mar 26, 2026
e364ba8
don't materialize
himjl Mar 26, 2026
5b3849a
adjust test
himjl Mar 26, 2026
f9efcdb
skip if runner
himjl Mar 26, 2026
3cc356a
trigger
himjl Mar 26, 2026
7cd7ff3
Merge pull request #9 from himjl/improve-packaging-osf
himjl Mar 26, 2026
70ccf51
auto fetching
himjl Mar 26, 2026
0e8b664
readme
himjl Mar 26, 2026
55d18b3
image loading
himjl Mar 26, 2026
c11d029
data; getter
himjl Mar 26, 2026
cf4502e
typing
himjl Mar 26, 2026
e49603d
type hinting
himjl Mar 26, 2026
77b4847
narrow typing
himjl Mar 26, 2026
19f6ef5
remove prototype
himjl Mar 26, 2026
d4d4a59
tree shake
himjl Mar 26, 2026
65e1126
directory refactor
himjl Mar 26, 2026
2b58518
refine readme
himjl Mar 27, 2026
46d250d
update notebook
himjl Mar 27, 2026
f62657e
tweak
himjl Mar 27, 2026
257ad7c
flatten classes
himjl Mar 27, 2026
014751f
common
himjl Mar 27, 2026
4cb2357
readme update
himjl Mar 27, 2026
4932df4
refine
himjl Mar 27, 2026
4bc03e2
improve examples
himjl Mar 27, 2026
56c3ff5
todo stub
himjl Mar 27, 2026
7372dce
Merge pull request #10 from himjl/simplify-scoring-api
himjl Mar 27, 2026
31f117f
osf repo linked in readme
himjl Mar 27, 2026
0582ea9
download
himjl Mar 27, 2026
1e7bddc
platformdirs
himjl Mar 27, 2026
6d38f83
download to home
himjl Mar 27, 2026
7d39905
regen
himjl Mar 27, 2026
8d7730d
Merge pull request #11 from himjl/osf-upload
himjl Mar 27, 2026
5b184aa
readme note
himjl Mar 27, 2026
87efc56
published to pypi
himjl Mar 27, 2026
d28ca55
v2 version number
himjl Mar 27, 2026
df3070c
update uv lock
himjl Mar 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
paths:
# Changes to source code
- hobj/**
- test/**.py
# Changes to workflows
- .github/workflows/ci.yml
# Changes to project/dependency metadata
- 'pyproject.toml'
- 'uv.lock'
jobs:
unit_tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install dependencies
run: uv sync --locked --dev
- name: Run pytests
run: uv run pytest -s
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
.idea
.DS_Store
.DS_Store
.venv
__pycache__/
*.egg-info/
dist/
/data/
13 changes: 0 additions & 13 deletions .idea/hobj.iml

This file was deleted.

14 changes: 0 additions & 14 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/other.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
lint:
uv run ruff check --fix && \
uv run ruff format

check:
uv run ty check && \
uv run ruff check && \
uv run ruff format --check

test:
uv run pytest tests


publish:
@version="$$(uv version --short)"; \
case "$$version" in \
*.dev*) ;; \
*) \
printf "Version %s does not include .dev. Continue? [y/N] " "$$version"; \
read -r answer; \
case "$$answer" in \
y|Y) ;; \
*) echo "Aborted."; exit 1 ;; \
esac ;; \
esac; \
rm -rf dist && \
uv build && \
uv publish
99 changes: 99 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# `hobj`: human object learning benchmarks

[![CI](https://github.com/himjl/hobj/actions/workflows/ci.yml/badge.svg)](https://github.com/himjl/hobj/actions/workflows/ci.yml)

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?"](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1011713)). It also lets you download the raw data and images from the experiments in the paper.

<div style="text-align: center;">
<img src="site/readme_images/human_learning_curves.svg" alt="Alt text" >
</div>

If you just want to download the raw data and images without using the `hobj` library, you can do so at the [OSF repository](https://osf.io/pj6wm/files/osfstorage) for this project.

## Quickstart

### Install

The `hobj` package works for Python >=3.12.

Install it from [PyPI](https://pypi.org/project/hobj/):

```bash
pip install hobj
```

If you prefer to use [uv](https://docs.astral.sh/uv/getting-started/installation/),
you can install it with:

```bash
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.

```python
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](mailto:name@example.com)), 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](site/changelist.md)). To see the codebase at the time of publication, check out the repo with the `v1` tag [here](https://github.com/himjl/hobj/releases/tag/v1).


## 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}
}
```
Binary file added examples/example_features.npz
Binary file not shown.
Loading
Loading