neuron-explorer
Qwen3.5‑4B 전용 조향형 뉴런 탐색기, 모든 MLP 뉴런을 밀어 결과를 보관·탐색
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기Koopman-Assisted Reinforcement Learning
저장소 README에서 가져옴
README 전체를 불러오는 중입니다.
README 전문 보기 ↗KoopmanRL is a reinforcement learning (RL) package designed around the two Koopman-Assisted RL (KARL) algorithms, Soft Koopman Value Iteration (SKVI), and Soft Actor Koopman-Critic (SAKC). It provides the utilities to build upon parts of its algorithms by either using only the Koopman tensor itself, or only components of the two KARL algorithms. In addition it provides utilities for automatic hyperparameter tuning of KARL algorithms, as well as 4 environments rooted in the control literature.
Having uv installed, one can easily get the project's environment up-and-running by cloning the repository and syncing the local project environment with the lock file:
git clone https://github.com/dynamicslab/KoopmanRL.git
cd KoopmanRL && uv sync
At which point we have the local project environment we need to run the computations. Alternatively, one can create a dedicated virtual environment with uv, i.e.:
uv venv --python 3.10 && source .venv/bin/activate
After which one can install the KoopmanRL package into the virtual environment
uv pip install .
At which point one can run the first experiment, taking the (fast) Linear Quadratic Regulator as an illustrative example here:
uv run -m koopmanrl.linear_quadratic_regulator # after `uv sync`
python -m koopmanrl.linear_quadratic_regulator # in the activated virtual environment
The commands in this README use uv run, which first syncs the project environment with the lock file. In a virtual environment set up with uv pip install ., run them with python in place of uv run instead (e.g. python -m koopmanrl.sakc_optuna_opt ...), so that the installed environment is used as it is.
Which will default to the linear system with the default hyperparameters. For all algorithms, and the hyperparameter optimization routines query the available hyperparameters with the --help identifier after the routine at which point all options will be listed in the terminal.
uv run -m koopmanrl.linear_quadratic_regulator --help
KoopmanRL provides a number of algorithm implementations, which can all be run as quasi-scripts with their own (typed) argument parsers. The main files here are:
koopmanrl.linear_quadratic_regulatorkoopmanrl.sac_continuous_actionkoopmanrl.value_based_sac_continuous_actionkoopmanrl.soft_koopman_value_iterationkoopmanrl.soft_actor_koopman_critickoopmanrl.skvi_optuna_optkoopmanrl.sakc_optuna_optkoopmanrl.koopman_tensor.generate_tensor, which identifies a Koopman tensor of one environment and stores it; --regressor {ols,ridge,sindy,rrr} selects the regressionEach of the algorithms, be it a control algorithm, or one of the two hyperparameter optimization routines can be applied to one of the four environments. The implemented environments are:
The algorithms can be applied to any of the environments with the --env_id flag. Utilizing the example of the Linear Quadratic Regulator again:
uv run -m koopmanrl.linear_quadratic_regulator --env_id FluidFlow-v0
[!NOTE] Note that the hyperparameter optimizations need to be started with the python executable of the environments. E.g. with a uv environment:
uv run python -m koopmanrl.sakc_optuna_opt --env_id FluidFlow-v0 \ --storage_dir . --output_file my_sakc_fluid_flow --cpu_cores_per_trial 4or when working with an activated virtual environment
python -m koopmanrl.sakc_optuna_opt --env_id FluidFlow-v0 \ --storage_dir . --output_file my_sakc_fluid_flow --cpu_cores_per_trial 4The best configuration is written to
<storage_dir>/<output_file>.json.--storage_diris required and has to exist. Keep--cpu_cores_per_trial(default 28) at or below the number of cores of your machine, since Ray cannot schedule a trial that asks for more.
The configurations/ directory contains the best-found hyperparameter configurations for SAKC and SKVI across each supported environment, produced by the Optuna optimization routines. The naming scheme is <algo>_<env_slug>_hparams.json, e.g.:
configurations/sakc_fluid_flow_hparams.json
configurations/skvi_lorenz_hparams.json
configurations/sakc_double_well_hparams.json
Next to them, episodic_returns.json, ablations.json and tsne.json list the runs of the three reproduction pipelines described below, which both the launchers and the Snakemake workflows read.
Both koopmanrl.soft_actor_koopman_critic and koopmanrl.soft_koopman_value_iteration accept a --config_file flag that loads hyperparameters directly from one of these JSON files:
uv run python -m koopmanrl.soft_actor_koopman_critic \
--config_file configurations/sakc_fluid_flow_hparams.json
uv run python -m koopmanrl.soft_koopman_value_iteration \
--config_file configurations/skvi_lorenz_hparams.json
Any flag passed explicitly on the command line takes precedence over the value in the config file, so individual hyperparameters can be overridden without editing the JSON:
uv run python -m koopmanrl.soft_actor_koopman_critic \
--config_file configurations/sakc_fluid_flow_hparams.json \
--seed 42 \
--total_timesteps 100000
The raw data of the figures and the tables the figures are drawn from can be made again with the launchers in koopmanrl_utils/. Each guide below describes the path from the runs to the pgfplots-ready tables:
| Result | Launcher | Guide |
|---|---|---|
| Episodic returns of LQR, SAC (Q), SAC (V), SKVI and SAKC | koopmanrl_utils.run_optimized_experiments | koopmanrl_utils/EPISODIC_RETURNS.md |
| Ablations of SKVI and SAKC | koopmanrl_utils.run_ablations | koopmanrl_utils/ABLATIONS.md |
| t-SNE embedding of the Koopman tensors | koopmanrl_utils.tsne_koopman_tensor | koopmanrl_utils/TSNE.md |
The same three pipelines are available as Snakemake workflows, which make every run in a job of its own and only the results that are missing:
uv sync
uvx --python 3.12 snakemake -n episodic_returns # list the jobs without running them
uvx --python 3.12 snakemake --cores 8 episodic_returns # or: ablations, tsne
The episodic returns take 495 runs and the ablations 1,440 runs, which is several days of computing; workflow/README.md describes how to run a part of them and how to run them on a cluster.
KoopmanRL is released under the MIT License (LICENSE.md). The observables in koopmanrl/koopman_observables.py and koopmanrl/koopman_tensor/observables/ are adapted from d3s and remain under the LGPL-3.0, and the SAC-based scripts are adapted from CleanRL (MIT); see LICENSES/README.md. The package as a whole is distributed under MIT AND LGPL-3.0-only.
If you use KoopmanRL, please cite the paper:
@article{rozwood2024koopman,
title = {Koopman-Assisted Reinforcement Learning},
author = {Rozwood, Preston and Mehrez, Edward and Paehler, Ludger and Sun, Wen and Brunton, Steven L.},
journal = {arXiv preprint arXiv:2403.02290},
year = {2024}
}
The software itself can be cited with the metadata in CITATION.cff, which GitHub also offers under "Cite this repository".