Skip to content

shuofengzhang/minlp_codebase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal ℓ_p-Minimization Interpolator (CVXPY + MOSEK)

This repository provides a minimal, extendable codebase to run experiments for minimum-ℓ_p interpolation in overparameterized linear regression.

  • Solver: CVXPY with MOSEK (default).
  • Design: i.i.d. Gaussian features.
  • Ground truth w*: (i) spike e1, (ii) flat on a support of size s.
  • Usage: HPC-friendly command line (python -m minlp ...) and plain python main.py.

Note: For MOSEK you need a valid license (student/academic free licenses available). Set the environment variable MOSEKLM_LICENSE_FILE to point to your license file (or use MOSEK's default license discovery).

Installation

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# Optional (if not already provided by your environment)
pip install mosek

Quick start

Run a small n-sweep at fixed d:

python -m minlp \
  --d 50000 \
  --n_list 250 500 1000 2000 3000 4000 5000 \
  --p 1.9 \
  --r_list 1.1 1.5 1.9 \
  --sigma 0.5 \
  --w_mode e1 \
  --s 1 \
  --reps 2 \
  --n_test 20000 \
  --out results_n_sweep.csv

Or using the root script:

python main.py --help

HPC (example)

We intentionally avoid interactive plotting and produce CSV logs only. You can submit array jobs by varying --seed and/or --reps.

Example shell snippet (replace addqueue with your scheduler wrapper as needed):

#!/usr/bin/env bash
# scripts/addqueue_example.sh
set -e
MEM_GB=${1:-16}
OUT=${2:-"results.csv"}

# Example: one job
addqueue -m ${MEM_GB} /usr/bin/python -m minlp \
  --d 50000 \
  --n_list 500 1000 2000 3000 4000 5000 \
  --p 1.9 \
  --r_list 1.1 1.5 1.9 \
  --sigma 0.5 \
  --w_mode e1 \
  --s 1 \
  --reps 1 \
  --seed 0 \
  --n_test 20000 \
  --out ${OUT}

Files

  • minlp/ — package with datasets, solver, experiment runner, CLI (__main__.py)
  • main.py — convenience wrapper to run python main.py ...
  • requirements.txt — Python dependencies
  • scripts/ — example HPC submission script
  • plot_results.py — optional quick plotting script once CSV exists

Extending

  • New model classes (e.g., diagonal linear networks) can live under minlp/models/. Plug them into minlp/experiments.py following the interface in fit_min_lp.
  • Custom data generators can be added to minlp/datasets.py.
  • You can add new metrics to minlp/metrics.py and log them in experiments.py.

Reproducibility

We thread a single RNG seed through NumPy. The convex program solved by MOSEK is deterministic given the data (up to solver tolerances).

License

MIT License (see LICENSE).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages