[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-WassimTenachi--PhySO":3,"tool-WassimTenachi--PhySO":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":80,"owner_email":81,"owner_twitter":75,"owner_website":81,"owner_url":82,"languages":83,"stars":96,"forks":97,"last_commit_at":98,"license":99,"difficulty_score":23,"env_os":100,"env_gpu":101,"env_ram":102,"env_deps":103,"category_tags":111,"github_topics":112,"view_count":23,"oss_zip_url":81,"oss_zip_packed_at":81,"status":16,"created_at":120,"updated_at":121,"faqs":122,"releases":152},2134,"WassimTenachi\u002FPhySO","PhySO","Physical Symbolic Optimization","PhySO（Physical Symbolic Optimization）是一款专为物理学研究打造的符号优化工具包。它利用深度强化学习技术，自动从实验数据中推导并拟合出解析形式的物理定律公式，帮助科研人员透过数据现象发现背后的数学本质。\n\n在传统方法难以应对含噪数据或复杂函数形式时，PhySO 展现了强大的解决能力。其核心优势在于巧妙融合了物理先验知识：通过量纲分析约束搜索空间，确保生成的公式符合物理单位逻辑；同时支持“类约束”功能，能从多个不同参数设置的数据集中提炼出统一的通用函数形式。基准测试表明，即使在数据噪声高达 10% 的严苛条件下，PhySO 仍能保持极高的准确率，性能优于多数同类工具。\n\n这款工具非常适合物理学家、应用数学家以及从事科学机器学习的研究人员使用。无论是需要从观测数据中重建运动方程，还是验证理论模型，PhySO 都能提供高效、可靠的辅助。目前它已支持通过 pip 和 conda 便捷安装，并兼容最新的 Python 生态系统，让探索物理规律的过程变得更加直观与高效。","# $\\Phi$-SO : Physical Symbolic Optimization\n![logo](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FWassimTenachi_PhySO_readme_190bda6f7c5a.png)\nPhysical symbolic optimization ( $\\Phi$-SO ) - A symbolic optimization package built for physics.\n\n[![GitHub Repo stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FWassimTenachi\u002FPhySO?style=social)](https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO)\n[![Documentation Status](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FWassimTenachi_PhySO_readme_13d664e1afd7.png)](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002F?badge=latest)\n[![Coverage Status](https:\u002F\u002Fcoveralls.io\u002Frepos\u002Fgithub\u002FWassimTenachi\u002FPhySO\u002Fbadge.svg?branch=main)](https:\u002F\u002Fcoveralls.io\u002Fgithub\u002FWassimTenachi\u002FPhySO?branch=main)\n[![Twitter Follow](https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Ffollow\u002FWassimTenachi?style=social)](https:\u002F\u002Ftwitter.com\u002FWassimTenachi)\n[![Paper](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-2303.03192-b31b1b)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2303.03192)\n[![Paper](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-2312.01816-b31b1b)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2312.01816)\n\n[![PyPI version](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fphyso.svg)](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fphyso)\n[![Conda Version](https:\u002F\u002Fimg.shields.io\u002Fconda\u002Fvn\u002Fconda-forge\u002Fphyso.svg)](https:\u002F\u002Fanaconda.org\u002Fconda-forge\u002Fphyso)\n\n\nSource code: [WassimTenachi\u002FPhySO](https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO)\\\nDocumentation: [physo.readthedocs.io](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002F)\n\n## What's New ✨  \n\n**2025-08** : 📦 Install via `pip install physo` and `conda` now available!  \n**2025-07** : 🐍 Python 3.12 + latest `NumPy`\u002F`PyTorch`\u002F`SymPy` support.  \n**2024-06** : 📚 Full documentation overhaul.  \n**2024-05** : 🔬 **Class SR**: Multi-dataset symbolic regression.  \n**2024-02** : 🎯 Uncertainty-aware fitting.  \n**2023-08** : ⚡ Dimensional analysis acceleration.  \n**2023-03** : 🌟 **PhySO** initial release (physics-focused SR).\n\n## Highlights\n\n$\\Phi$-SO's symbolic regression module uses deep reinforcement learning to infer analytical physical laws that fit data points, searching in the space of functional forms.  \n\n`physo` is able to leverage:\n\n* Physical units constraints, reducing the search space with dimensional analysis ([[Tenachi et al 2023]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2303.03192))\n\n* Class constraints, searching for a single analytical functional form that accurately fits multiple datasets - each governed by its own (possibly) unique set of fitting parameters ([[Tenachi et al 2024]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2312.01816))\n\n$\\Phi$-SO recovering the equation for a damped harmonic oscillator:\n\nhttps:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Fassets\u002F63928316\u002F655b0eea-70ba-4975-8a80-00553a6e2786\n\nPerformances on the standard Feynman benchmark from [SRBench](https:\u002F\u002Fgithub.com\u002Fcavalab\u002Fsrbench\u002Ftree\u002Fmaster)) comprising 120 expressions from the Feynman Lectures on Physics against popular SR packages.\n\n$\\Phi$-SO achieves state-of-the-art performance in the presence of noise (exceeding 0.1%) and shows robust performances even in the presence of substantial (10%) noise:\n\n![feynman_results](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FWassimTenachi_PhySO_readme_b8732191702d.png)\n\n# Installation\n\nThe package has been tested on:\n- Linux\n- OSX (ARM & Intel)\n- Windows\n\nIf you are encountering issues with the installation, [installing from the source](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002Fr_installation.html#source-install) should help.\nIf you are still having issues, please refer to the [FAQ](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002Fr_faq.html) or raise an issue on the [GitHub repository](https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Fissues).\n\n## Installing with pip\n\nInstalling `physo` from PyPI :\n```bash\npip install physo\n```\n\n## Installing with conda\n\nInstalling `physo` using conda:\n```bash\nconda install -c conda-forge physo\n```\n## Getting started (SR)\n\nIn this tutorial, we show how to use `physo` to perform Symbolic Regression (SR).\nThe reference notebook for this tutorial can be found here: [📙sr_quick_start.ipynb](https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Fblob\u002Fmain\u002Fdemos\u002Fsr_quick_start.ipynb).\n\n### Setup\n\nImporting the necessary libraries:\n```\n# External packages\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport torch\n```\n\nImporting `physo`:\n```\n# Internal code import\nimport physo\nimport physo.learn.monitoring as monitoring\n```\n\nIt is recommended to fix the seed for reproducibility:\n```\n# Seed\nseed = 0\nnp.random.seed(seed)\ntorch.manual_seed(seed)\n```\n\n### Making synthetic datasets\n\nMaking a toy synthetic dataset:\n```\n# Making toy synthetic data\nz = np.random.uniform(-10, 10, 50)\nv = np.random.uniform(-10, 10, 50)\nX = np.stack((z, v), axis=0)\ny = 1.234*9.807*z + 1.234*v**2\n```\nIt should be noted that free constants search starts around 1. by default. Therefore when using default hyperparameters, normalizing the data around an order of magnitude of 1 is strongly recommended.\n\n---\n\n__DA side notes__:  \n$\\Phi$-SO can exploit DA (dimensional analysis) to make SR more efficient.  \nOn can consider the physical units of $X=(z,v)$, $z$ being a length of dimension $L^{1}, T^{0}, M^{0}$, v a velocity of dimension $L^{1}, T^{-1}, M^{0}$, $y=E$ if an energy of dimension $L^{2}, T^{-2}, M^{1}$.\nIf you are not working on a physics problem and all your variables\u002Fconstants are dimensionless, do not specify any of the `xx_units` arguments (or specify them as `[0,0]` for all variables\u002Fconstants) and `physo` will perform a dimensionless symbolic regression task.  \n\n---\n\nDatasets plot:\n```\nn_dim = X.shape[0]\nfig, ax = plt.subplots(n_dim, 1, figsize=(10,5))\nfor i in range (n_dim):\n    curr_ax = ax if n_dim==1 else ax[i]\n    curr_ax.plot(X[i], y, 'k.',)\n    curr_ax.set_xlabel(\"X[%i]\"%(i))\n    curr_ax.set_ylabel(\"y\")\nplt.show()\n```\n\n### SR configuration\n\nIt should be noted that SR capabilities of `physo` are heavily dependent on hyperparameters, it is therefore recommended to tune hyperparameters to your own specific problem for doing science.  \nSummary of currently available hyperparameters presets configurations:\n\n|  Config    |            Recommended usecases                           |    Speed    |   Effectiveness   |                           Notes                                |\n|:----------:|:---------------------------------------------------------:|:-----------:|:-----------------:|:--------------------------------------------------------------:|\n| `config0`  | Demos                                                     |     ★★★     |          ★        | Light and fast config.                                         |\n| `config1`  | SR with DA $^*$ ;  Class SR with DA $^*$                    |       ★     |        ★★★        | Config used for Feynman Benchmark and MW streams Benchmark.    |\n| `config2`  | SR ; Class SR                                             |      ★★     |         ★★        | Config used for Class Benchmark.                               |\n\n$^*$ DA = Dimensional Analysis\n\nUsers are encouraged to edit configurations (they can be found in: [physo\u002Fconfig\u002F](https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Ftree\u002Fmain\u002Fphyso\u002Fconfig)).  \nBy default, `config0` is used, however it is recommended to follow the upper recommendations for doing science.\n\n---\n__DA side notes__:   \n1. During the first tens of iterations, the neural network is typically still learning the rules of dimensional analysis, resulting in most candidates being discarded and not learned on, effectively resulting in a much smaller batch size (typically 10x smaller), thus making the evaluation process much less computationally expensive. It is therefore recommended to compensate this behavior by using a higher batch size configuration which helps provide the neural network sufficient learning information.  \n---\n\nLogging and visualisation setup:\n```\nsave_path_training_curves = 'demo_curves.png'\nsave_path_log             = 'demo.log'\n\nrun_logger     = lambda : monitoring.RunLogger(save_path = save_path_log,\n                                                do_save = True)\n\nrun_visualiser = lambda : monitoring.RunVisualiser (epoch_refresh_rate = 1,\n                                           save_path = save_path_training_curves,\n                                           do_show   = False,\n                                           do_prints = True,\n                                           do_save   = True, )\n```\n\n### Running SR\n\nGiven variables data $(x_0,..., x_n)$ (here $(z, v)$ ), the root variable $y$ (here $E$) as well as free and fixed constants, you can run an SR task to recover $f$ via the following command.\n\n---\n\n__DA side notes__:    \nHere we are allowing the use of a fixed constant $1$ of dimension $L^{0}, T^{0}, M^{0}$ (ie dimensionless) and free constants $m$ of dimension $L^{0}, T^{0}, M^{1}$ and $g$ of dimension $L^{1}, T^{-2}, M^{0}$.  \nIt should be noted that here the units vector are of size 3 (eg: `[1, 0, 0]`) as in this example the variables have units dependent on length, time and mass only.\nHowever, units vectors can be of any size $\\leq 7$ as long as it is consistent across X, y and constants, allowing the user to express any units (dependent on length, time, mass, temperature, electric current, amount of light, or amount of matter). \nIn addition, dimensional analysis can be performed regardless of the order in which units are given, allowing the user to use any convention ([length, mass, time] or [mass, time, length] etc.) as long as it is consistent across X,y and constants.  \n\n---\n\n```\n# Running SR task\nexpression, logs = physo.SR(X, y,\n                            # Giving names of variables (for display purposes)\n                            X_names = [ \"z\"       , \"v\"        ],\n                            # Associated physical units (ignore or pass zeroes if irrelevant)\n                            X_units = [ [1, 0, 0] , [1, -1, 0] ],\n                            # Giving name of root variable (for display purposes)\n                            y_name  = \"E\",\n                            y_units = [2, -2, 1],\n                            # Fixed constants\n                            fixed_consts       = [ 1.      ],\n                            fixed_consts_units = [ [0,0,0] ],\n                            # Free constants names (for display purposes)\n                            free_consts_names = [ \"m\"       , \"g\"        ],\n                            free_consts_units = [ [0, 0, 1] , [1, -2, 0] ],\n                            # Symbolic operations that can be used to make f\n                            op_names = [\"mul\", \"add\", \"sub\", \"div\", \"inv\", \"n2\", \"sqrt\", \"neg\", \"exp\", \"log\", \"sin\", \"cos\"],\n                            get_run_logger     = run_logger,\n                            get_run_visualiser = run_visualiser,\n                            # Run config\n                            run_config = physo.config.config0.config0,\n                            # Parallel mode (only available when running from python scripts, not notebooks)\n                            parallel_mode = False,\n                            # Number of iterations\n                            epochs = 20\n)\n```\n\n### Inspecting the best expression found\n\n__Getting best expression:__\n\nThe best expression found (in accuracy) is returned in the `expression` variable:\n```\nbest_expr = expression\nprint(best_expr.get_infix_pretty())\n```\n```\n>>> \n                     2           \n    -g⋅m⋅z + -v⋅v⋅sin (1.0)⋅1.0⋅m\n```\n\nIt can also be loaded later on from log files:\n```\nimport physo\nfrom physo.benchmark.utils import symbolic_utils as su\nimport sympy\n\n# Loading pareto front expressions\npareto_expressions = physo.read_pareto_pkl(\"demo_curves_pareto.pkl\")\n# Most accurate expression is the last in the Pareto front:\nbest_expr = pareto_expressions[-1]\nprint(best_expr.get_infix_pretty())\n```\n\n__Display:__\n\nThe expression can be converted into...  \nA sympy expression:\n\n```\nbest_expr.get_infix_sympy()\n```\n```\n>>> -g*m*z - v*v*sin(1.0)**2*1.0*m\n```\n\nA sympy expression (with evaluated free constants values):\n\n```\nbest_expr.get_infix_sympy(evaluate_consts=True)[0]\n```\n\n```\n>>> 1.74275713004454*v**2*sin(1.0)**2 + 12.1018380702846*z\n```\n\nA latex string:\n\n```\nbest_expr.get_infix_latex()\n```\n\n```\n>>> '\\\\frac{m \\\\left(- 1000000000000000 g z - 708073418273571 v^{2}\\\\right)}{1000000000000000}'\n```\n\nA latex string (with evaluated free constants values):\n```\nsympy.latex(best_expr.get_infix_sympy(evaluate_consts=True))\n```\n\n```\n>>> '\\\\mathtt{\\\\text{[1.74275713004454*v**2*sin(1.0)**2 + 12.1018380702846*z]}}'\n```\n\n__Getting free constant values:__\n\n```\nbest_expr.free_consts\n```\n```\n>>> FreeConstantsTable\n     -> Class consts (['g' 'm']) : (1, 2)\n     -> Spe consts   ([]) : (1, 0, 1)\n```\n\n```\nbest_expr.free_consts.class_values\n```\n```\n>>> tensor([[ 6.9441, -1.7428]], dtype=torch.float64)\n```\n\n### Checking exact symbolic recovery\n\n```\n# To sympy\nbest_expr = best_expr.get_infix_sympy(evaluate_consts=True)\n\nbest_expr = best_expr[0]\n\n# Printing best expression simplified and with rounded constants\nprint(\"best_expr : \", su.clean_sympy_expr(best_expr, round_decimal = 4))\n\n# Target expression was:\ntarget_expr = sympy.parse_expr(\"1.234*9.807*z + 1.234*v**2\")\nprint(\"target_expr : \", su.clean_sympy_expr(target_expr, round_decimal = 4))\n\n# Check equivalence\nprint(\"\\nChecking equivalence:\")\nis_equivalent, log = su.compare_expression(\n                        trial_expr  = best_expr,\n                        target_expr = target_expr,\n                        handle_trigo            = True,\n                        prevent_zero_frac       = True,\n                        prevent_inf_equivalence = True,\n                        verbose                 = True,\n)\nprint(\"Is equivalent:\", is_equivalent)\n```\n\n```\n>>> best_expr :  1.234*v**2 + 12.1018*z\n    target_expr :  1.234*v**2 + 12.1018*z\n    \n    Checking equivalence:\n      -> Assessing if 1.234*v**2 + 12.101838*z (target) is equivalent to 1.74275713004454*v**2*sin(1.0)**2 + 12.1018380702846*z (trial)\n       -> Simplified expression : 1.23*v**2 + 12.1*z\n       -> Symbolic error        : 0\n       -> Symbolic fraction     : 1\n       -> Trigo symbolic error        : 0\n       -> Trigo symbolic fraction     : 1\n       -> Equivalent : True\n    Is equivalent: True\n```\n\n# Documentation\n\nFurther documentation can be found at [physo.readthedocs.io](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002F).\n\nQuick start guide for __Symbolic Regression__ : [HERE](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002Fr_sr.html#getting-started-sr)  \n\nQuick start guide for __Class Symbolic Regression__ : [HERE](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002Fr_class_sr.html#getting-started-class-sr)  \n\n# Citing this work\n \nSymbolic Regression with reinforcement learning & dimensional analysis\n\n```\n@ARTICLE{PhySO_RL_DA,\n       author = {{Tenachi}, Wassim and {Ibata}, Rodrigo and {Diakogiannis}, Foivos I.},\n        title = \"{Deep Symbolic Regression for Physics Guided by Units Constraints: Toward the Automated Discovery of Physical Laws}\",\n      journal = {ApJ},\n         year = 2023,\n        month = dec,\n       volume = {959},\n       number = {2},\n          eid = {99},\n        pages = {99},\n          doi = {10.3847\u002F1538-4357\u002Fad014c},\narchivePrefix = {arXiv},\n       eprint = {2303.03192},\n primaryClass = {astro-ph.IM},\n       adsurl = {https:\u002F\u002Fui.adsabs.harvard.edu\u002Fabs\u002F2023ApJ...959...99T},\n      adsnote = {Provided by the SAO\u002FNASA Astrophysics Data System}\n}\n```\n\nClass Symbolic Regression\n```\n@ARTICLE{PhySO_ClassSR,\n       author = {{Tenachi}, Wassim and {Ibata}, Rodrigo and {Fran{\\c{c}}ois}, Thibaut L. and {Diakogiannis}, Foivos I.},\n        title = \"{Class Symbolic Regression: Gotta Fit 'Em All}\",\n      journal = {The Astrophysical Journal Letters},\n         year = {2024},\n        month = {jul},\n       volume = {969},\n       number = {2},\n          eid = {arXiv:2312.01816},\n        pages = {L26},\n          doi = {10.3847\u002F2041-8213\u002Fad5970},\narchivePrefix = {arXiv},\n       eprint = {2312.01816},\n primaryClass = {cs.LG},\n       adsurl = {https:\u002F\u002Fui.adsabs.harvard.edu\u002Fabs\u002F2023arXiv231201816T},\n      adsnote = {Provided by the SAO\u002FNASA Astrophysics Data System}\n}\n```","# $\\Phi$-SO：物理符号优化\n![logo](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FWassimTenachi_PhySO_readme_190bda6f7c5a.png)\n物理符号优化（$\\Phi$-SO）—— 一个专为物理学设计的符号优化工具包。\n\n[![GitHub 仓库星级](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FWassimTenachi\u002FPhySO?style=social)](https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO)\n[![文档状态](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FWassimTenachi_PhySO_readme_13d664e1afd7.png)](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002F?badge=latest)\n[![覆盖率](https:\u002F\u002Fcoveralls.io\u002Frepos\u002Fgithub\u002FWassimTenachi\u002FPhySO\u002Fbadge.svg?branch=main)](https:\u002F\u002Fcoveralls.io\u002Fgithub\u002FWassimTenachi\u002FPhySO?branch=main)\n[![Twitter 关注](https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Ffollow\u002FWassimTenachi?style=social)](https:\u002F\u002Ftwitter.com\u002FWassimTenachi)\n[![论文](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-2303.03192-b31b1b)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2303.03192)\n[![论文](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-2312.01816-b31b1b)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2312.01816)\n\n[![PyPI 版本](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fphyso.svg)](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fphyso)\n[![Conda 版本](https:\u002F\u002Fimg.shields.io\u002Fconda\u002Fvn\u002Fconda-forge\u002Fphyso.svg)](https:\u002F\u002Fanaconda.org\u002Fconda-forge\u002Fphyso)\n\n\n源代码：[WassimTenachi\u002FPhySO](https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO)\\\n文档：[physo.readthedocs.io](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002F)\n\n## 最新动态 ✨  \n\n**2025-08** ：📦 现可通过 `pip install physo` 和 `conda` 安装！  \n**2025-07** ：🐍 支持 Python 3.12 及最新版本的 `NumPy`、`PyTorch` 和 `SymPy`。  \n**2024-06** ：📚 全面更新文档。  \n**2024-05** ：🔬 **Class SR**：多数据集符号回归。  \n**2024-02** ：🎯 考虑不确定性的拟合。  \n**2023-08** ：⚡ 加速维度分析。  \n**2023-03** ：🌟 **PhySO** 初始发布（专注于物理学的符号回归）。\n\n## 亮点\n\n$\\Phi$-SO 的符号回归模块利用深度强化学习，从函数形式空间中搜索并推导出能够拟合数据点的解析物理定律。\n\n`physo` 能够利用：\n\n* 物理单位约束，通过维度分析缩小搜索空间（[[Tenachi 等, 2023]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2303.03192)）\n\n* 类约束，寻找一个能够准确拟合多个数据集的单一解析函数形式——每个数据集可能由自己独特的拟合参数集所支配（[[Tenachi 等, 2024]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2312.01816)）\n\n$\\Phi$-SO 恢复阻尼谐振子方程的过程：\n\nhttps:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Fassets\u002F63928316\u002F655b0eea-70ba-4975-8a80-00553a6e2786\n\n在来自 [SRBench](https:\u002F\u002Fgithub.com\u002Fcavalab\u002Fsrbench\u002Ftree\u002Fmaster) 的标准费曼基准测试中的表现，该基准包含《费曼物理学讲义》中的 120 个表达式，并与流行的符号回归软件进行了对比。\n\n$\\Phi$-SO 在噪声存在时（超过 0.1%）达到了最先进的性能，即使在高达 10% 的显著噪声下也能保持稳健的表现：\n\n![feynman_results](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FWassimTenachi_PhySO_readme_b8732191702d.png)\n\n# 安装\n\n该软件包已在以下平台上测试通过：\n- Linux\n- OSX（ARM 和 Intel）\n- Windows\n\n如果您在安装过程中遇到问题，建议您尝试从源码安装（[源码安装指南](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002Fr_installation.html#source-install)）。如果问题仍然存在，请参阅常见问题解答（[FAQ](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002Fr_faq.html)），或在 [GitHub 仓库](https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Fissues) 中提交问题。\n\n## 使用 pip 安装\n\n从 PyPI 安装 `physo`：\n```bash\npip install physo\n```\n\n## 使用 conda 安装\n\n使用 conda 安装 `physo`：\n```bash\nconda install -c conda-forge physo\n```\n## 快速入门（SR）\n\n本教程将展示如何使用 `physo` 进行符号回归（SR）。本教程的参考笔记本可在以下链接找到：[📙sr_quick_start.ipynb](https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Fblob\u002Fmain\u002Fdemos\u002Fsr_quick_start.ipynb)。\n\n### 准备工作\n\n导入必要的库：\n```\n# 外部库\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport torch\n```\n\n导入 `physo`：\n```\n# 内部代码\nimport physo\nimport physo.learn.monitoring as monitoring\n```\n\n为了确保结果的可重复性，建议固定随机种子：\n```\n# 随机种子\nseed = 0\nnp.random.seed(seed)\ntorch.manual_seed(seed)\n```\n\n### 创建合成数据集\n\n创建一个玩具合成数据集：\n```\n# 创建玩具合成数据\nz = np.random.uniform(-10, 10, 50)\nv = np.random.uniform(-10, 10, 50)\nX = np.stack((z, v), axis=0)\ny = 1.234*9.807*z + 1.234*v**2\n```\n\n需要注意的是，自由常数的搜索默认从 1 开始。因此，在使用默认超参数时，强烈建议将数据归一化到数量级为 1 左右。\n\n---\n\n__DA 补充说明__：  \n$\\Phi$-SO 可以利用 DA（维度分析）来提高符号回归的效率。可以考虑 $X=(z,v)$ 的物理单位：$z$ 是长度，其维度为 $L^{1}, T^{0}, M^{0}$；$v$ 是速度，其维度为 $L^{1}, T^{-1}, M^{0}$；而 $y=E$ 是能量，其维度为 $L^{2}, T^{-2}, M^{1}$。  \n如果您处理的问题并非物理相关，且所有变量和常数均为无量纲，则无需指定任何 `xx_units` 参数（或将所有变量\u002F常数的单位设置为 `[0,0]`），此时 `physo` 将执行无量纲的符号回归任务。  \n\n---\n\n绘制数据集：\n```\nn_dim = X.shape[0]\nfig, ax = plt.subplots(n_dim, 1, figsize=(10,5))\nfor i in range (n_dim):\n    curr_ax = ax if n_dim==1 else ax[i]\n    curr_ax.plot(X[i], y, 'k.',)\n    curr_ax.set_xlabel(\"X[%i]\"%(i))\n    curr_ax.set_ylabel(\"y\")\nplt.show()\n```\n\n### SR 配置\n\n需要注意的是，`physo` 的 SR 能力高度依赖于超参数，因此建议根据具体问题调整超参数以进行科学研究。目前可用的超参数预设配置总结如下：\n\n| 配置    | 推荐用例                           | 速度    | 效果   | 备注                                |\n|:----------:|:---------------------------------------------------------:|:-----------:|:-----------------:|:--------------------------------------------------------------:|\n| `config0`  | 演示                                                     |     ★★★     |          ★        | 轻量且快速的配置。                                         |\n| `config1`  | 带有量纲分析 $^*$ 的 SR；带有量纲分析 $^*$ 的分类 SR    |       ★     |        ★★★        | 用于费曼基准和 MW 流基准的配置。    |\n| `config2`  | SR；分类 SR                                             |      ★★     |         ★★        | 用于分类基准的配置。                               |\n\n$^*$ DA = 量纲分析\n\n鼓励用户编辑配置文件（可在：[physo\u002Fconfig\u002F](https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Ftree\u002Fmain\u002Fphyso\u002Fconfig) 中找到）。默认使用 `config0`，但为了科学研究，建议遵循上述推荐配置。\n\n---\n__关于量纲分析的补充说明__:   \n1. 在前几十次迭代中，神经网络通常仍在学习量纲分析的规则，导致大多数候选表达式被丢弃而未被训练，从而有效批次大小显著减小（通常缩小 10 倍），使得评估过程的计算开销大大降低。因此，建议通过使用较大的批次大小来弥补这一现象，以便为神经网络提供足够的学习信息。  \n---\n\n日志与可视化设置：\n```\nsave_path_training_curves = 'demo_curves.png'\nsave_path_log             = 'demo.log'\n\nrun_logger     = lambda : monitoring.RunLogger(save_path = save_path_log,\n                                                do_save = True)\n\nrun_visualiser = lambda : monitoring.RunVisualiser (epoch_refresh_rate = 1,\n                                           save_path = save_path_training_curves,\n                                           do_show   = False,\n                                           do_prints = True,\n                                           do_save   = True, )\n```\n\n### 运行 SR\n\n给定变量数据 $(x_0,..., x_n)$（此处为 $(z, v)$），根变量 $y$（此处为 $E$）以及自由常数和固定常数，您可以通过以下命令运行 SR 任务以恢复 $f$。\n\n---\n\n__关于量纲分析的补充说明__:    \n在此我们允许使用一个维度为 $L^{0}, T^{0}, M^{0}$（即无量纲）的固定常数 $1$，以及维度分别为 $L^{0}, T^{0}, M^{1}$ 的自由常数 $m$ 和 $L^{1}, T^{-2}, M^{0}$ 的自由常数 $g$。需要注意的是，这里的单位向量长度为 3（例如：`[1, 0, 0]`），因为本示例中的变量仅涉及长度、时间与质量三个物理量。然而，只要在 $X$、$y$ 和常数之间保持一致，单位向量的长度可以是任意不超过 7 的值，从而允许用户表示任何单位（包括长度、时间、质量、温度、电流、光通量或物质的量等）。此外，无论单位的顺序如何，都可以进行量纲分析，因此用户可以采用任何约定（如 [长度、质量、时间] 或 [质量、时间、长度] 等），只要在 $X$、$y$ 和常数之间保持一致即可。  \n\n---\n\n```\n# 运行 SR 任务\nexpression, logs = physo.SR(X, y,\n                            # 给出变量名称（用于显示）\n                            X_names = [ \"z\"       , \"v\"        ],\n                            # 相应的物理单位（若不相关可忽略或传入零向量）\n                            X_units = [ [1, 0, 0] , [1, -1, 0] ],\n                            # 给出根变量名称（用于显示）\n                            y_name  = \"E\",\n                            y_units = [2, -2, 1],\n                            # 固定常数\n                            fixed_consts       = [ 1.      ],\n                            fixed_consts_units = [ [0,0,0] ],\n                            # 共享常数名称（用于显示）\n                            free_consts_names = [ \"m\"       , \"g\"        ],\n                            free_consts_units = [ [0, 0, 1] , [1, -2, 0] ],\n                            # 可用于构建 f 的符号运算\n                            op_names = [\"mul\", \"add\", \"sub\", \"div\", \"inv\", \"n2\", \"sqrt\", \"neg\", \"exp\", \"log\", \"sin\", \"cos\"],\n                            get_run_logger     = run_logger,\n                            get_run_visualiser = run_visualiser,\n                            # 运行配置\n                            run_config = physo.config.config0.config0,\n                            # 并行模式（仅在从 Python 脚本运行时可用，笔记本中不可用）\n                            parallel_mode = False,\n                            # 迭代次数\n                            epochs = 20\n)\n```\n\n### 检查找到的最佳表达式\n\n__获取最佳表达式：__\n\n在准确度方面找到的最佳表达式会返回在 `expression` 变量中：\n```\nbest_expr = expression\nprint(best_expr.get_infix_pretty())\n```\n```\n>>> \n                     2           \n    -g⋅m⋅z + -v⋅v⋅sin (1.0)⋅1.0⋅m\n```\n\n该表达式也可以稍后从日志文件中加载：\n```\nimport physo\nfrom physo.benchmark.utils import symbolic_utils as su\nimport sympy\n\n# 加载帕累托前沿表达式\npareto_expressions = physo.read_pareto_pkl(\"demo_curves_pareto.pkl\")\n\n# 最准确的表达式是帕累托前沿中的最后一个：\nbest_expr = pareto_expressions[-1]\nprint(best_expr.get_infix_pretty())\n```\n\n__显示：__\n\n该表达式可以转换为……  \n一个 SymPy 表达式：\n\n```\nbest_expr.get_infix_sympy()\n```\n```\n>>> -g*m*z - v*v*sin(1.0)**2*1.0*m\n```\n\n一个 SymPy 表达式（已计算自由常数的值）：\n\n```\nbest_expr.get_infix_sympy(evaluate_consts=True)[0]\n```\n\n```\n>>> 1.74275713004454*v**2*sin(1.0)**2 + 12.1018380702846*z\n```\n\n一个 LaTeX 字符串：\n\n```\nbest_expr.get_infix_latex()\n```\n\n```\n>>> '\\\\frac{m \\\\left(- 1000000000000000 g z - 708073418273571 v^{2}\\\\right)}{1000000000000000}'\n```\n\n一个 LaTeX 字符串（已计算自由常数的值）：\n```\nsympy.latex(best_expr.get_infix_sympy(evaluate_consts=True))\n```\n\n```\n>>> '\\\\mathtt{\\\\text{[1.74275713004454*v**2*sin(1.0)**2 + 12.1018380702846*z]}}'\n```\n\n__获取自由常数值：__\n\n```\nbest_expr.free_consts\n```\n```\n>>> FreeConstantsTable\n     -> 类常数（['g' 'm']）：(1, 2)\n     -> 特殊常数（[]）：(1, 0, 1)\n```\n\n```\nbest_expr.free_consts.class_values\n```\n```\n>>> tensor([[ 6.9441, -1.7428]], dtype=torch.float64)\n```\n\n### 检查精确的符号恢复\n\n```\n# 转换为 SymPy\nbest_expr = best_expr.get_infix_sympy(evaluate_consts=True)\n\nbest_expr = best_expr[0]\n\n# 打印简化后的最佳表达式，并对常数进行四舍五入\nprint(\"best_expr : \", su.clean_sympy_expr(best_expr, round_decimal = 4))\n\n# 目标表达式为：\ntarget_expr = sympy.parse_expr(\"1.234*9.807*z + 1.234*v**2\")\nprint(\"target_expr : \", su.clean_sympy_expr(target_expr, round_decimal = 4))\n\n# 检查等价性\nprint(\"\\n检查等价性：\")\nis_equivalent, log = su.compare_expression(\n                        trial_expr  = best_expr,\n                        target_expr = target_expr,\n                        handle_trigo            = True,\n                        prevent_zero_frac       = True,\n                        prevent_inf_equivalence = True,\n                        verbose                 = True,\n)\nprint(\"是否等价：\", is_equivalent)\n```\n\n```\n>>> best_expr :  1.234*v**2 + 12.1018*z\n    target_expr :  1.234*v**2 + 12.1018*z\n    \n    检查等价性：\n      -> 评估 1.234*v**2 + 12.101838*z（目标）是否与 1.74275713004454*v**2*sin(1.0)**2 + 12.1018380702846*z（试验）等价\n       -> 简化后的表达式：1.23*v**2 + 12.1*z\n       -> 符号误差：0\n       -> 符号分数：1\n       -> 三角函数符号误差：0\n       -> 三角函数符号分数：1\n       -> 是否等价：是\n    是否等价：是\n```\n\n# 文档\n\n更多文档可在 [physo.readthedocs.io](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002F) 查阅。\n\n__符号回归__ 快速入门指南：[这里](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002Fr_sr.html#getting-started-sr)  \n\n__分类符号回归__ 快速入门指南：[这里](https:\u002F\u002Fphyso.readthedocs.io\u002Fen\u002Flatest\u002Fr_class_sr.html#getting-started-class-sr)  \n\n# 引用本工作\n\n基于强化学习和量纲分析的符号回归\n\n```\n@ARTICLE{PhySO_RL_DA,\n       author = {{Tenachi}, Wassim and {Ibata}, Rodrigo and {Diakogiannis}, Foivos I.},\n        title = \"{利用单位约束引导的深度符号回归：迈向物理定律的自动化发现}\",\n      journal = {ApJ},\n         year = 2023,\n        month = dec,\n       volume = {959},\n       number = {2},\n          eid = {99},\n        pages = {99},\n          doi = {10.3847\u002F1538-4357\u002Fad014c},\narchivePrefix = {arXiv},\n       eprint = {2303.03192},\n primaryClass = {astro-ph.IM},\n       adsurl = {https:\u002F\u002Fui.adsabs.harvard.edu\u002Fabs\u002F2023ApJ...959...99T},\n      adsnote = {由 SAO\u002FNASA 天体物理数据系统提供}\n}\n```\n\n分类符号回归\n\n```\n@ARTICLE{PhySO_ClassSR,\n       author = {{Tenachi}, Wassim and {Ibata}, Rodrigo and {Fran{\\c{c}}ois}, Thibaut L. and {Diakogiannis}, Foivos I.},\n        title = \"{分类符号回归：必须适应所有情况}\",\n      journal = {天体物理学杂志快报},\n         year = {2024},\n        month = {jul},\n       volume = {969},\n       number = {2},\n          eid = {arXiv:2312.01816},\n        pages = {L26},\n          doi = {10.3847\u002F2041-8213\u002Fad5970},\narchivePrefix = {arXiv},\n       eprint = {2312.01816},\n primaryClass = {cs.LG},\n       adsurl = {https:\u002F\u002Fui.adsabs.harvard.edu\u002Fabs\u002F2023arXiv231201816T},\n      adsnote = {由 SAO\u002FNASA 天体物理数据系统提供}\n}\n```","# PhySO 快速上手指南\n\nPhySO ($\\Phi$-SO) 是一个专为物理学设计的符号优化包。它利用深度强化学习，在考虑物理单位约束（量纲分析）和类别约束的情况下，从数据点中推断出解析形式的物理定律。\n\n## 环境准备\n\n### 系统要求\nPhySO 已在以下操作系统上经过测试：\n- Linux\n- macOS (支持 ARM 和 Intel 芯片)\n- Windows\n\n### 前置依赖\n- **Python**: 支持 Python 3.12 及更高版本。\n- **核心库**: 自动安装 `NumPy`, `PyTorch`, `SymPy` 等依赖。\n- **建议**: 为了获得最佳科学计算性能，建议使用虚拟环境（如 `venv` 或 `conda`）。\n\n> **注意**：由于涉及深度学习训练，推荐使用具备 CUDA 支持的 GPU 环境以加速运算，但 CPU 亦可运行。\n\n## 安装步骤\n\n你可以选择通过 `pip` 或 `conda` 进行安装。国内用户若遇到下载速度慢的问题，可配置国内镜像源。\n\n### 方式一：使用 pip 安装\n\n**标准安装：**\n```bash\npip install physo\n```\n\n**使用国内镜像加速安装（推荐）：**\n```bash\npip install physo -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n### 方式二：使用 conda 安装\n\n**标准安装：**\n```bash\nconda install -c conda-forge physo\n```\n\n**使用国内镜像加速安装（推荐）：**\n```bash\nconda install -c https:\u002F\u002Fmirrors.tuna.tsinghua.edu.cn\u002Fanaconda\u002Fcloud\u002Fconda-forge physo\n```\n\n## 基本使用\n\n以下是一个最简单的符号回归（Symbolic Regression, SR）示例，演示如何从合成数据中恢复物理公式。\n\n### 1. 导入库与设置种子\n\n```python\nimport numpy as np\nimport torch\nimport physo\nimport physo.learn.monitoring as monitoring\n\n# 设置随机种子以保证结果可复现\nseed = 0\nnp.random.seed(seed)\ntorch.manual_seed(seed)\n```\n\n### 2. 构建合成数据集\n\n我们构造一个符合物理规律 $E = m \\cdot g \\cdot z + m \\cdot v^2$ 的数据集。\n*注意：默认情况下自由常数的搜索范围在 1 附近，因此建议将数据归一化到数量级为 1 的范围。*\n\n```python\n# 生成随机数据\nz = np.random.uniform(-10, 10, 50)\nv = np.random.uniform(-10, 10, 50)\nX = np.stack((z, v), axis=0)\n\n# 目标公式：y = 1.234 * 9.807 * z + 1.234 * v^2\n# 这里隐含了常数 m=1.234, g=9.807\ny = 1.234*9.807*z + 1.234*v**2\n```\n\n### 3. 配置日志与可视化\n\n```python\nsave_path_training_curves = 'demo_curves.png'\nsave_path_log             = 'demo.log'\n\nrun_logger     = lambda : monitoring.RunLogger(save_path = save_path_log, do_save = True)\nrun_visualiser = lambda : monitoring.RunVisualiser(epoch_refresh_rate = 1,\n                                           save_path = save_path_training_curves,\n                                           do_show   = False,\n                                           do_prints = True,\n                                           do_save   = True)\n```\n\n### 4. 运行符号回归\n\n在此示例中，我们利用**量纲分析（Dimensional Analysis）**来辅助搜索：\n- 输入变量 $z$ (长度) 和 $v$ (速度)。\n- 输出变量 $y$ (能量)。\n- 定义固定常数 $1$ (无量纲) 和自由常数 $m$ (质量), $g$ (加速度)。\n\n```python\nexpression, logs = physo.SR(X, y,\n                            # 变量名称\n                            X_names = [\"z\", \"v\"],\n                            # 变量物理单位 [长度 L, 时间 T, 质量 M]\n                            # z: 长度 [1, 0, 0], v: 速度 [1, -1, 0]\n                            X_units = [[1, 0, 0], [1, -1, 0]],\n                            \n                            # 根变量名称\n                            y_name  = \"E\",\n                            # 根变量单位 (能量): [2, -2, 1]\n                            y_units = [2, -2, 1],\n                            \n                            # 固定常数及其单位 (无量纲)\n                            fixed_consts       = [1.],\n                            fixed_consts_units = [[0, 0, 0]],\n                            \n                            # 自由常数名称及其单位\n                            # m: 质量 [0, 0, 1], g: 加速度 [1, -2, 0]\n                            free_consts_names = [\"m\", \"g\"],\n                            free_consts_units = [[0, 0, 1], [1, -2, 0]],\n                            \n                            # 可用的数学操作符\n                            op_names = [\"mul\", \"add\", \"sub\", \"div\", \"inv\", \"n2\", \"sqrt\", \"neg\", \"exp\", \"log\", \"sin\", \"cos\"],\n                            \n                            get_run_logger     = run_logger,\n                            get_run_visualiser = run_visualiser,\n                            \n                            # 运行配置：科研用途建议使用 config1 或 config2，此处演示使用轻量级的 config0\n                            run_config = physo.config.config0.config0,\n                            \n                            parallel_mode = False,\n                            epochs = 20  # 迭代次数\n)\n```\n\n### 5. 查看结果\n\n获取并打印找到的最佳表达式：\n\n```python\nbest_expr = expression\nprint(best_expr.get_infix_pretty())\n```\n\n**输出示例：**\n```text\n                     2           \n    -g⋅m⋅z + -v⋅v⋅sin (1.0)⋅1.0⋅m\n```\n\n你也可以将其转换为标准的 SymPy 表达式并计算出具体的常数值：\n\n```python\n# 获取带具体数值的 SymPy 表达式\nsympy_expr = best_expr.get_infix_sympy(evaluate_consts=True)[0]\nprint(sympy_expr)\n```\n\n**输出示例：**\n```text\n1.74275713004454*v**2*sin(1.0)**2 + 12.1018380702846*z\n```\n*(注：由于迭代次数较少且存在随机性，具体数值可能与理论值 $m \\approx 1.234, g \\approx 9.807$ 略有偏差，增加 `epochs` 或使用 `config1` 可提高精度)*","某航天工程团队正在分析新型热防护材料在极端再入大气层过程中的温度衰减数据，试图从含噪实验数据中反推其背后的物理控制方程。\n\n### 没有 PhySO 时\n- 研究人员只能依赖传统的黑盒神经网络进行拟合，虽然预测精度尚可，但无法得到可解释的解析公式，难以通过物理审查。\n- 若尝试手动推导公式，面对高噪声（超过 10%）的实验数据，传统符号回归算法极易过拟合，生成大量违背量纲一致性（如“米”加“秒”）的荒谬表达式。\n- 当需要同时处理多组不同初始条件下的实验数据集时，团队不得不分别建模，难以发现贯穿所有场景的统一物理规律，导致研发周期大幅延长。\n- 每次验证公式的物理合理性都需要人工反复检查单位量纲，耗时耗力且容易出错，严重拖慢了从数据到理论模型的转化效率。\n\n### 使用 PhySO 后\n- PhySO 利用深度强化学习直接搜索函数空间，成功从强噪声数据中还原出简洁、可解释的解析方程，让黑盒数据瞬间变为透明的物理定律。\n- 内置的量纲分析约束自动剔除了所有单位不合法的候选公式，确保生成的每一个数学表达都严格符合物理学基本原理，无需人工二次筛查。\n- 借助其“类符号回归”（Class SR）功能，PhySO 能一次性从多组不同参数的数据集中提炼出同一个通用函数形式，精准识别出材料的热扩散核心机制。\n- 即使在数据噪声高达 10% 的恶劣条件下，PhySO 仍表现出卓越的鲁棒性，输出的公式误差极低，直接通过了严苛的工程验证标准。\n\nPhySO 将原本需要数周的理论推导工作缩短至小时级，真正实现了从含噪实验数据到可信物理定律的自动化跨越。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FWassimTenachi_PhySO_190bda6f.png","WassimTenachi","Wassim Tenachi","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FWassimTenachi_77af3388.jpg","Postdoctoral Fellow in Astrophysics x ML @ MILA \u002F Université de Montréal","MILA","Montréal",null,"https:\u002F\u002Fgithub.com\u002FWassimTenachi",[84,88,92],{"name":85,"color":86,"percentage":87},"Python","#3572A5",99.7,{"name":89,"color":90,"percentage":91},"Jupyter Notebook","#DA5B0B",0.3,{"name":93,"color":94,"percentage":95},"Shell","#89e051",0.1,1959,264,"2026-03-31T08:21:25","MIT","Linux, macOS (ARM & Intel), Windows","未说明 (依赖 PyTorch，支持 CPU 和 GPU 运行)","未说明",{"notes":104,"python":105,"dependencies":106},"支持通过 pip 和 conda 安装。建议将数据归一化到数量级 1 附近以获得最佳效果。若不使用物理单位约束（量纲分析），可将单位参数设为零。默认配置适用于演示，进行科学研究时建议根据具体任务调整超参数配置（如 config1 或 config2）。","3.12+",[107,108,109,110],"numpy","torch","sympy","matplotlib",[13],[113,114,115,116,117,118,119],"deep-learning","machine-learning","physics","python","reinforcement-learning","symbolic-regression","equation-discovery","2026-03-27T02:49:30.150509","2026-04-06T05:37:29.963428",[123,128,133,138,143,148],{"id":124,"question_zh":125,"answer_zh":126,"source_url":127},9828,"导入 physo 时出现警告：\"Can not import display packages\"，如何解决？","该警告是因为无法导入用于高级调试（树形表示）的可选包。如果您不打算贡献代码或使用这些高级功能，可以直接忽略此警告。\n如果您希望安装这些包以消除警告，请执行以下步骤：\n1. 拉取最新代码：`git pull`\n2. 安装可选依赖：\n   `conda install --file requirements_display1.txt`\n   `pip install -r requirements_display2.txt`\n注意：在 Windows 上运行可能会因 LaTeX 相关问题导致此错误，建议在 Linux (如 Ubuntu) 环境下使用。","https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Fissues\u002F5",{"id":129,"question_zh":130,"answer_zh":131,"source_url":132},9829,"符号回归（PhySO）的拟合精度为什么不如神经网络高？","符号回归的设计初衷并非在拟合质量上超越神经网络。神经网络通常更灵活且更容易训练，因此在训练范围内的拟合精度（如 R² 值）往往更高。\n选择 PhySO 等符号回归方法的优势在于：\n1. 更好的泛化能力（超出训练数据范围的表现）；\n2. 可解释性和易懂性（能得到具体的物理公式）；\n3. 执行速度比神经网络快。\n如果您的首要目标是极高的拟合精度且不关心公式形式，神经网络可能是更好的选择；如果需要发现物理规律，则应接受其拟合精度可能略低的事实。","https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Fissues\u002F35",{"id":134,"question_zh":135,"answer_zh":136,"source_url":137},9830,"为什么 requirements.txt 中强制指定了 sympy == 1.10.1，可以使用新版本吗？","强制指定版本主要是出于安全考虑，防止新版本中行为变化导致问题（维护者已使用该版本进行了广泛测试）。原则上，PhySO 与新版本的 sympy 是兼容的。如果您想尝试新版本，可以手动升级，但如果遇到异常，建议回退到 1.10.1 版本。","https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Fissues\u002F31",{"id":139,"question_zh":140,"answer_zh":141,"source_url":142},9831,"如何在一次会话中连续多次运行 physo.SR 而不重置内核？","目前代码已修复，支持在不重置内核的情况下连续多次运行 `physo.SR`。\n示例代码如下，展示了如何使用不同配置连续运行：\n1. 使用默认快速超参数进行最小化运行：\n```python\nexpression, logs = physo.SR(X, y,\n                            X_units = [ [1, 0, 0] , [1, -1, 0] ],\n                            y_units = [2, -2, 1],\n                            fixed_consts       = [ 1.      ],\n                            fixed_consts_units = [ [0,0,0] ],\n                            free_consts_units  = [ [0, 0, 1] , [1, -2, 0] ],\n)\n```\n2. 使用针对科学发现优化的最佳超参数（速度较慢但效果更好）：\n```python\nexpression, logs = physo.SR(X, y,\n                            # ... 其他参数同上 ...\n                            run_config = physo.config.config1.config1\n)\n```\n注意：在实际使用中，通常不需要像教程示例那样连续运行三次相似的任務。","https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Fissues\u002F26",{"id":144,"question_zh":145,"answer_zh":146,"source_url":147},9832,"如何自定义函数来拟合特定的物理公式（例如包含对数和复杂系数的模型）？","PhySO 允许通过定义特定的函数形式来拟合复杂模型。如果您的模型涉及化学中的代理单位（proxy units）或旧制单位，可能会导致量纲不一致，从而影响拟合效果。\n建议步骤：\n1. 检查并统一所有参数的单位，确保量纲分析正确。\n2. 深入阅读 `physym` 模块源码以理解底层机制，推荐阅读顺序为：`token`, `functions`, `program`, `free const`, `dimensional analysis`, `execute`, `prior`, `reward`, `dataset`, `batch`。\n3. 利用单元测试辅助理解如何构建自定义函数。\n如果回归的自由常数不准确（例如设定 101000 却回归到 100000），通常是由于单位不一致或搜索空间设置问题，需检查输入数据的量纲定义。","https:\u002F\u002Fgithub.com\u002FWassimTenachi\u002FPhySO\u002Fissues\u002F11",{"id":149,"question_zh":150,"answer_zh":151,"source_url":137},9833,"requirements.txt 中存在 matplotlib 重复定义的问题，且新版 matplotlib 导致代码报错，该如何处理？","这是一个已知问题。由于 matplotlib 3.7.0 和 3.7.1 版本存在 Bug，导致 PhySO 无法正常工作。建议在 `requirements.txt` 中明确指定兼容的版本（如 3.5.1）。\n如果遇到此类依赖冲突，请手动将 matplotlib 版本降级至 3.5.1 或维护者推荐的其他稳定版本，避免使用最新的 3.7.x 系列，直到库本身修复相关 Bug 或 PhySO 更新适配。",[153,158],{"id":154,"version":155,"summary_zh":156,"released_at":157},107150,"v1.1.0","Release of PhySO for:\r\n- The ApJL paper \"Class Symbolic Regression: Gotta Fit 'Em All\"","2024-06-14T23:22:26",{"id":159,"version":160,"summary_zh":161,"released_at":162},107151,"v1.0.0","Release of PhySO for:\r\n- The ApJ paper \"Deep symbolic regression for physics guided by units constraints: toward the automated discovery of physical laws\"\r\n- The  NeurIPS ML4PS proceeding \"Physical Symbolic Optimization\"","2023-10-06T21:26:50"]