MCPcopy Index your code
hub / github.com/Johswald/learning_where_to_learn

github.com/Johswald/learning_where_to_learn @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
82 symbols 199 edges 6 files 11 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Learning where to learn - Gradient sparsity in meta and continual learning

In this paper, we investigate gradient sparsity found by MAML in various continual and few-shot learning scenarios.\ Instead of only learning the initialization of neural network parameters, we additionally meta-learn parameters underneath a step function that stops gradient descent when smaller then 0.

We term this version Sparse-MAML - Link to the paper here.

Interestingly, we see that structured sparsity emerges in both the classic 4-layer ConvNet as well as a ResNet-12 for few-shot learning. This is accompanied by improved robustness and generalisation across many hyperparameters.

Note that Sparse-MAML is an extremely simple variant of MAML that possesses only the possibility to shut on/off training of specific parameters compared to proper gradient modulation.

This codebase implents the few-shot learning experiments that are presented in the paper. To reproduce the results in the paper, please follow these instructions:

Installation

1. Install a conda env:

conda create -n sparse-MAML

2. Activate the env:

source activate sparse-MAML

3. Install anaconda:

conda install anaconda

4. Install extra requiremetns (make sure you use the correct pip3):

pip3 install -r requirements.txt

5. Run:

chmod u+x run_sparse_MAML.sh

6. Execute:

./run_sparse_MAML.sh

Results

MiniImageNet Few-Shot MAML ANIL BOIL sparse-MAML sparse-ReLU-MAML
5-way 5-shot | ConvNet 63.15 61.50 66.45 67.03 66.80
5-way 1-shot | ConvNet 48.07 46.70 49.61 50.35 50.15
5-way 5-shot | ResNet12 69.36 70.03 70.50 70.02 73.01
5-way 1-shot | ResNet12 53.91 55.25 - 55.02 56.39

BOIL results are taken from the original paper.


This code based is heavily build on top of torchmeta.

Core symbols most depended-on inside this repo

get_subdict
called by 14
utils/utils.py
conv_block
called by 4
models.py
_make_layer
called by 4
models.py
close
called by 4
utils/cub_cars_downloader.py
evaluate
called by 3
train.py
step
called by 2
train.py
get_asset
called by 2
utils/cub_cars_downloader.py
_check_integrity
called by 2
utils/cub_cars_downloader.py

Shape

Method 49
Function 18
Class 15

Languages

Python100%

Modules by API surface

utils/cub_cars_downloader.py34 symbols
models.py29 symbols
utils/misc.py8 symbols
train.py7 symbols
utils/utils.py3 symbols
parser.py1 symbols

For agents

$ claude mcp add learning_where_to_learn \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page