Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions .binder/apt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# .binder/apt.txt
# System packages for Binder
build-essential
gcc
g++
gfortran
libblas-dev
liblapack-dev
vim
htop

49 changes: 49 additions & 0 deletions .binder/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# .binder/environment.yml
# Conda environment for Binder deployment
# Updated: December 18, 2024

name: skilmpy-binder
channels:
- conda-forge
- defaults

dependencies:
# Python 3.14+ when available, fallback to 3.11+
- python=3.11

# Core scientific computing
- numpy=2.0
- scipy>=1.14
- pandas>=2.2
- matplotlib>=3.8
- seaborn>=0.13

# Jupyter ecosystem
- jupyterlab>=4.0
- jupyter>=1.0
- ipywidgets>=8.0
- voila>=0.5

# Visualization
- plotly>=5.17
- bokeh>=3.3

# Performance tools
- numba>=0.59
- cython>=3.0

# Development tools
- git
- pip

# Install via pip for latest versions
- pip:
- polars>=1.0.0
- lark>=1.2.0
- ply>=3.11
- sympy>=1.13
- joblib>=1.4
- memory-profiler
- line-profiler
- git+https://github.com/dhard/skILMpy.git

161 changes: 161 additions & 0 deletions .binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# .binder/postBuild
#!/bin/bash
# Post-build script for Binder setup

set -euo pipefail

echo "Setting up skILMpy for Binder..."

# Configure environment for optimal performance
export PYTHONGIL=0
export OMP_NUM_THREADS=1
export MKL_NUM_THREADS=1

# Install skILMpy in development mode
pip install -e ".[jupyter,performance]"

# Configure skILMpy for interactive use
python -c "
import ilmpy
try:
ilmpy.configure_for_hpc()
print('skILMpy configured successfully')
except Exception as e:
print(f'Configuration warning: {e}')
"

# Install additional Jupyter extensions
jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build
jupyter labextension install plotlywidget --no-build
jupyter labextension install jupyterlab-plotly --no-build
jupyter lab build --dev-build=False --minimize=True

# Set up example notebooks
mkdir -p examples/binder
cp examples/quickstart.ipynb examples/binder/
cp examples/benchmarks.ipynb examples/binder/

# Create a welcome notebook
cat > examples/binder/Welcome.ipynb << 'EOF'
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Welcome to skILMpy 3.0! 🚀\n",
"\n",
"This is an interactive environment for exploring Smith-Kirby Iterated Learning Models.\n",
"\n",
"## Quick Start\n",
"\n",
"1. **[Quickstart Tutorial](quickstart.ipynb)** - Learn the basics in 10 minutes\n",
"2. **[Performance Benchmarks](benchmarks.ipynb)** - See the speed improvements\n",
"3. **[Research Examples](../research_examples/)** - Real-world applications\n",
"\n",
"## Try It Now!\n",
"\n",
"Run a simple simulation:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ilmpy\n",
"from ilmpy.argument_parser import ModernILM_Parser\n",
"from ilmpy.learners import OptimizedAssociationMatrixLearner\n",
"\n",
"# Parse signal and meaning spaces\n",
"parser = ModernILM_Parser()\n",
"signal_space, meaning_space = parser.parse(\"[bp].[ao] (4).(3)\")\n",
"\n",
"print(f\"Signal space: {len(signal_space.signals())} signals\")\n",
"print(f\"Meaning space: {len(meaning_space.meanings())} meanings\")\n",
"print(f\"Signals: {signal_space.signals()[:10]}\")\n",
"print(f\"Meanings: {meaning_space.meanings()[:10]}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Create and run a simple simulation\n",
"observables = ilmpy.create_observables(\n",
" show_compositionality=True,\n",
" show_accuracy=True,\n",
" precision=4\n",
")\n",
"\n",
"learner = OptimizedAssociationMatrixLearner(\n",
" meaning_space, signal_space,\n",
" alpha=1.0, beta=0.0, gamma=-1.0, delta=0.0,\n",
" observables=observables\n",
")\n",
"\n",
"# Run 5 generations\n",
"for generation in range(5):\n",
" print(f\"\\nGeneration {generation}:\")\n",
" child = learner.spawn()\n",
" lessons = learner.teach(10)\n",
" child.learn(lessons)\n",
" \n",
" # Print statistics\n",
" comp = child.compute_compositionality()\n",
" acc = child.compute_accuracy()\n",
" print(f\" Compositionality: {comp:.4f}\")\n",
" print(f\" Accuracy: {acc:.4f}\")\n",
" \n",
" learner = child\n",
"\n",
"print(\"\\nSimulation complete! 🎉\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Next Steps\n",
"\n",
"- Explore the other notebooks for more advanced examples\n",
"- Try different signal and meaning space configurations\n",
"- Experiment with the model parameters (alpha, beta, gamma, delta)\n",
"- Check out the [GitHub repository](https://github.com/dhard/skILMpy) for full documentation\n",
"\n",
"Happy modeling! 🧬🔬"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
EOF

echo "Binder setup complete!"

# Set default working directory
echo 'cd $HOME' >> ~/.bashrc

5 changes: 5 additions & 0 deletions .binder/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# .binder/start
#!/bin/bash
# Custom start script for Binder

exec "$@"
78 changes: 40 additions & 38 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# Byte-compiled / optimized / DLL files
# Python
__pycache__/
*.py[cod]
*$py.class

# emacs
*~
#*#

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
Expand All @@ -24,43 +15,54 @@ lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Virtual environments
venv/
env/
ENV/

# IDEs
.vscode/
.idea/
*.swp
*.swo

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# OS
.DS_Store
Thumbs.db

# Unit test / coverage reports
# Project specific
results/
data/private/
*.log
*.prof
*.stats

# Jupyter
.ipynb_checkpoints/
*.ipynb_backup

# Docker
.dockerignore

# Coverage
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/
# MyPy
.mypy_cache/
.dmypy.json
dmypy.json

# PyBuilder
target/
# PLY parser files
*parsetab.py
parser.out

#Ipython Notebook
.ipynb_checkpoints
# Temporary files
tmp/
temp/
Loading