S YMBOLIC P HYSICS L EARNER : D ISCOVERING GOVERNING EQUATIONS VIA M ONTE C ARLO TREE SEARCH
A BSTRACT
Nonlinear dynamics is ubiquitous in nature and commonly seen in various science and engineering disciplines.
Distilling analytical expressions that govern nonlinear dynamics from limited data remains vital but challenging
To tackle this funda - mental issue, we propose a novel Symbolic Physics Learner (SPL) machine to discover the mathematical structure of nonlinear dynamics.
The key concept is to interpret mathematical operations and system state variables by computational rules and symbols, establish symbolic reasoning of mathematical formulas via expression trees and employ a Monte Carlo tree search (MCTS) agent to explore optimal expression trees based on measurement data.
The MCTS agent obtains an optimistic selection policy through the traversal of expression trees, featuring the one that maps to the arithmetic expression of underlying physics.
Salient features of the proposed framework include search flexibility and enforcement of parsimony for discovered equations.
The efficacy and superiority of the SPL machine are demonstrated by numerical examples, compared with state-of-the-art baselines
I NTRODUCTION
We usually learn the behavior of a nonlinear dynamical system through its nonlinear governing differential equations.
These equations can be formulated as ˙ y ( t ) =
d y /dt
=
F ( y ( t )) , where y ( t )
=
{ y 1 ( t ) , y 2 ( t ) , ..., y n ( t ) } ∈ R 1 × n s denotes the system state at time t , F ( · ) a nonlinear function set defining the state motions and n s the system dimension.
The explicit form of F ( · ) for some nonlinear dynamics remains underexplored.
For example, in a mounted double pendulum system, the mathematical description of the underlying physics might be unclear due to unknown viscous and frictional damping forms.
These uncertainties yield critical demands for the discovery of nonlinear dynamics given observational data.
Nevertheless, distilling the analytical form of governing equations from limited noisy data, commonly seen in practice, is an intractable challenge.
Ever since the early work on the data-driven discovery of nonlinear dynamics (Džeroski & Todorovski, 1993; Dzeroski & Todorovski, 1995), many scientists have stepped into this field of study.
During the recent decade, the escalating advances in machine learning, data science, and computing power have enabled several milestone efforts of unearthing the governing equations for nonlinear dynamical systems.
Notably, a breakthrough model named SINDy (Sparse Identification of Nonlinear Dynamics)
(Brunton et al., 2016) has shed light on tackling this achallenge.
SINDy was invented to determine the sparse solution among a pre-defined basis function library recursively through a sequential threshold ridge regression (STRidge) algorithm.
SINDy quickly became one of the state-of-art methods and kindled significant enthusiasm in this field of study (Rudy et al., 2017;
Long et al., 2018; Champion et al., 2019; Chen et al., 2021; Sun et al., 2021;
Rao et al., 2022).
However, the success of this sparsity-promoting approach relies on a properly defined candidate function library that requires good prior knowledge of the system.
It is also restricted by the fact that a linear combination of candidate functions might be insufficient to recover complicated mathematical expressions.
Moreover, when the library size is massive, it empirically fails to hold the sparsity constraint.
At the same time, attempts have been made to tackle the nonlinear dynamics discovery problems by introducing neural networks with activation functions replaced by commonly seen mathematical operators (Martius & Lampert, 2017; Sahoo et al., 2018;
Kim et al., 2019; Long et al., 2019).
The intricate formulas are obtained via symbolic expansion of the well-trained network.
This interpretation of physical laws results in larger candidate pools compared with the library-based representation of physics employed by SINDy.
Nevertheless, since the sparsity of discovered expressions is primarily achieved by empirical pruning of the network weights, this framework exhibits sensitivity to userdefined thresholds and may fall short to produce parsimonious equations for noisy and scarce data.
Alternatively, another inspiring work (Bongard & Lipson, 2007; Schmidt & Lipson, 2009) reenvisioned the data-driven nonlinear dynamics discovery tasks by casting them into symbolic regression problems which have been profoundly resolved by the genetic programming (GP) approach (Koza & Koza, 1992; Billard & Diday, 2003).
Under this framework, a symbolic regressor is established to identify the governing equations that best describe the underlying physics through free combination of mathematical operators and symbols, leading to great flexibility in model selection.
One essential weakness of this early methodology is that, driven exclusively by the goal of empirically seeking the best-fitting expression (e.g. minimizing the mean-square error) in a genetic expansion process, the GP-based model usually over-fits the target system with numerous false-positive terms under data noise, even sometimes at a subtle level, causing huge instability and uncertainty.
However, this ingenious idea has inspired a series of subsequent endeavors (Cornforth & Lipson, 2012; Gaucel et al., 2014; Ly & Lipson, 2012; Quade et al., 2016; Vaddireddy et al., 2020).
In a more recent work,
Deep Symbolic Regression (DSR) (Petersen et al., 2021; Mundhenk et al., 2021), a reinforcement learning-based model was established and generally outperformed the GP based models including the commercial Eureqa software (Langdon & Gustafson, 2010).
Additionally, the AI-Feynman methods (Udrescu & Tegmark, 2020; Udrescu et al., 2020; Udrescu & Tegmark, 2021) ameliorated symbolic regression for distilling physics laws from data by combining neural network fitting with a suite of physics-inspired techniques.
This approach is also highlighted by a recursive decomposition of a complicated mathematical expression into different parts on a tree-based graph, which disentangles the original problem and speeds up the discovery.
It outperformed Eureqa in the uncovering Feynman physics equations (Feynman et al., 1965).
However, this approach is built upon ad-hoc steps and, to some extent, lacks flexible automation in equation discovery.
The popularity of adopting the tree-based symbolic reasoning of mathematical formulas (Lample & Charton, 2019) has been rising recently to discover unknown mathematical expressions with a reinforcement learning agent (Kubalík et al., 2019; Petersen et al., 2021;
Mundhenk et al., 2021).
However, some former work attempting to apply the Monte Carlo tree search (MCTS) algorithm as an alternative to GP for symbolic regression (Cazenave, 2013; White et al., 2015; Islam et al., 2018;
Lu et al., 2021) failed to leverage the full flexibility of this algorithm, resulting in the similar shortage that
GP-based symbolic regressors possess as discussed earlier.
Despite these outcomes, we are conscious of the strengths of the MCTS algorithm in equation discovery: it enables the flexible representation of search space with customized computational grammars to guide the search tree expansion.
A sound mathematical underpinning for the trade-off between exploration and exploitation is remarkably advantageous as well.
These features make it possible to inform the MCTS agent by our prior physics knowledge in nonlinear dynamics discovery rather than randomly searching in large spaces.
Contribution.
We propose a promising model named Symbolic Physics Learner (SPL) machine, empowered by MCTS, for discovery of nonlinear dynamics.
This architecture relies on a grammar composed of (i) computational rules and symbols to guide the search tree spanning and (ii) a composite objective rewarding function to simultaneously evaluate the generated equations with observational data and enforce the sparsity of the expression.
Moreover, we design multiple adjustments to the conventional MCTS by: (1) replacing the expected reward in UCT score with maximum reward to better fit the equation discovery objective, (2) employing an adaptive scaling in policy evaluation which would eliminate the uncertainty of the reward value range owing to the unknown error of the system state derivatives, and (3) transplanting modules with high returns to the subsequent search as a single leaf node.
With these adjustments, the SPL machine is capable of efficiently uncovering the best path to formulate the complex governing equations of the target dynamical system.
B ACKGROUND
In this section, we expand and explain the background concepts brought up in the introduction to the
SPL architecture, including the expression tree (parse tree) and the MCTS algorithm.
Expression tree.
Any mathematical expression can be represented by a combinatorial set of symbols and mathematical operations, and further expressed by a parse tree structure (Hopcroft et al., 2006;
Kusner et al., 2017) empowered by a context-free grammar (CFG).
A CFG is a formal grammar characterized by a tuple comprised of 4 elements, namely, G =
( V, Σ , R, S ) , where V denotes a finite set of non-terminal nodes, Σ a finite set of terminal nodes, R a finite set of production rules, each interpreted as a mapping from a single non-terminal symbol in V to one or multiple terminal/non-terminal node(s) in ( V ∪ Σ) ∗ where ∗ represents the Kleene star operation, and S a single non-terminal node standing for a start symbol.
In our work, equations are symbolized into parse trees: we define the start node as equation symbol f , terminal symbols (leaf nodes) corresponding to the independent variables formulating the equation (e.g, x , y ), and a placeholder symbol C for identifiable constant coefficients that stick to specific production rules.
The non-terminal nodes between root and leaf nodes are represented by some symbols distinct from the start and terminal nodes (i.e., M ).
The production rules denote the commonly seen mathematical operators: unary rules (one non-terminal node mapping to one node) for operators like cos( · ) , exp( · ) , log( | · | ) , and binary rules (one non-terminal node mapping to two nodes) for operators such as + , − , × , ÷ .
A parse tree is then generated via a pre-order traversal of production rules rooted at f and terminates when all leaf nodes are entirely filled with terminal symbols.
Each mathematical expression can be represented by such a traversal set of production rules.
Monte Carlo tree search.
Monte Carlo tree search (MCTS)
(Coulom, 2006) is an algorithm for searching optimal decisions in large combinatorial spaces represented by search trees.
This technique complies with the best-first search principle based on the evaluations of stochastic simulations.
It has already been widely employed in and proved the spectacular success by various gaming artificial intelligence systems, including the famous AlphaGo and AlphaZero (Silver et al., 2017) for computer
Go game.
A basic MCTS algorithm is composed of an iterative process with four steps:
1. Selection.
The MCTS agent, starting from the root node, moves through the visited nodes of the search tree and selects the next node according to a given selection policy until it reaches an expandable node or a leaf node.
Expansion.
At an expandable node, the MCTS agent expands the search tree by selecting one of its unvisited children.
Simulation.
After expansion, if the current node is non-terminal, the agent performs one or multiple independent simulations starting from the current node until reaching the terminal state.
In this process, actions are randomly selected.
Backpropagation.
Statistics of nodes along the path from the current node to the root are updated with respect to search results (scores evaluated from the terminate states reached).
To maintain a proper balance between the less-tested paths and the best policy identified so far, the
MCTS agent sticks to a trade-off between exploration and exploitation by taking action that maximizes the Upper Confidence Bounds applied for Trees (UCT), formulated as (Kocsis & Szepesvári, 2006):
[Equation]
where Q ( s, a ) is the average result/reward of playing action a in state s in the simulations performed in the history, encouraging the exploitation of current best child node; N ( s ) is number of times state s visited, N ( s, a ) the number of times action a has been selected at state s , and (cid:112)
ln
[ N ( s )] /N
( s, a ) consequently encourages exploration of less-visited child nodes.
Constant c controls the balance between exploration and exploitation, empirically defined upon the specific problem.
Theoretical analysis of UCT-based MCTS (e.g., convergence, guarantees) is referred to Shah et al.
. M ETHODS
Existing studies show that the MCTS agent continuously gains knowledge of specified tasks via the expansion of the search tree and, based on the backpropagation of evaluation results (i.e., rewards and [Figure] number of visits), render a proper selection policy on visited states to guide the upcoming searching (Silver et al., 2017).
In the proposed SPL machine, such a process is integrated with the symbolic reasoning of mathematical expressions to reproduce and evaluate valid mathematical expressions of the physical laws in nonlinear dynamics step-by-step, and then obtain a favorable selection policy pointing to the best solution.
This algorithm is depicted in Figure 1 with an illustrative example and its overall training scheme is shown in Algorithm 1.
Discussion of the hyperparameter setting for this algorithm is given in Appendix Section A.
Rewarding.
To evaluate the mathematical expression ˜ f projected from a parse tree, we define a numerical reward r ∈ R ⊂ R based on this expression and input data D
= { Y ; ˙
Y i } , serving as the search result of the current expansion or simulation.
It is formulated as
[Equation]
where Y = { y 1 , y 2 , ..., y m } ∈ R m × N is the m dimensional state variables of a dynamical system, ˙
Y i ∈ R 1 × N the numerically estimated state derivative for i th dimension, and N the number of measurement data points.
η denotes a discount factor, assigned slightly smaller than 1; n is empirically defined as the total number of production rules in the parse tree.
This numerator arrangement is designated to penalize non-parsimonious solutions.
This rewarding formulation outputs a reasonable assessment to the distilled equations and encourages parsimonious solution by discounting the reward of a non-parsimonious one.
The rooted mean square error (RMSE) in denominator evaluates the goodness-of-fit of the discovered equation w.r.t.
the measurement data.
Training scheme.
A grammar G =
( V, Σ , R, S ) is defined with appropriate nodes and production rules to cover all possible forms of equations.
To keep track of non-terminal nodes of the parsing tree, we apply a last-in-first-out (LIFO) strategy and denote the non-terminal node placed last on the stack NT as the current node.
We define the action space
A =
R and the state space S
as all possible traversals of complete/incomplete parse trees (i.e., production rules selected) in ordered sequences.
At the current state s t = [ a 1 , a 2 , ...a t ] where t ∈ N is the discrete traversal step-index of the upcoming production rule, the MCTS agent masks out the invalid production rules for current non-terminal node and on that basis selects a valid rule as action a t +1 (i.e, the left-hand side of a valid production rule is the current non-terminal symbol).
Consequently, the parse tree gains a new terminal/non-terminal branch in accordance with a t +1 , meanwhile the agent finds itself in a new state s t +1 =
[ a 1 , a 2 , ...a t , a t +1 ] .
The agent subsequently pops off the current non-terminal symbol from NT and pushes the non-terminal nodes, if there are any, on the right-hand side of the selected rule onto the stack.
Once the agent attains an unvisited node, a certain amount of simulations are performed, where the agent starts to randomly select the next node until the parse tree is completed.
The reward is calculated or the maximal size is exceeded, resulting in a zero reward.
The best result from the attempts counts as the reward of the current simulation phase and backpropagates from the current unvisited node all the way to the root node.
Greedy search.
Different from the MCTS-based gaming AIs where the agents are inclined to pick the action with a high expected reward (average returns), the SPL machine seeks the unique optimal solution.
In the proposed training framework, we apply a greedy search heuristic to encourage the agent to explore the branch which yields the best solution in the past: Q ( s, a ) is defined as the maximum reward of the state-action pair, and its value is backpropagated from the highest reward in the simulations upon the selection of the pair.
Meanwhile, to overcome the local minima problems due to this greedy approach in policy search, we enforce a certain level of randomness by empirically adopting the ϵ -greedy algorithm, a commonly seen approach in reinforcement learning models.
Adaptive-scaled rewarding.
Owing to the unknown level of error from the numerically estimated state derivatives, the range of the RMSE in the SPL reward function is unpredictable.
This uncertainty affects the scale of rewarding values thus the balance between exploration and exploitation is presented in Eq.
Besides adding “1” to the denominator of Eq.
(2) to avoid dramatically large numerical rewards, we also apply an adaptive scale of the reward, given by
[Equation]
where r ∗ denotes the maximum reward of the state-action pair.
It is scaled by the current maximum reward among all states S and actions A to reach an equilibrium that the Q -values are stretched to the scale [0 , 1] at any time.
This self-adaptive fashion yields a well-scaled calculation of UCT under different value ranges of rewards throughout the training.
Module transplantation.
A function can be decomposed into smaller modules where each is simpler than the original one (Udrescu et al., 2020).
This modularity feature, as shown in Figure 2, helps us develop a divide-and-conquer heuristic for distilling some complicated functions: after every certain amount of MCTS iterations, the discovered parse trees with high rewards are picked out and thereupon
A A
A ×
A
A × x x
A
A × x x f
A
A ×
A
A × x x f A x
[Figure] (cid:2869)∗ [Figure] (cid:2869)∗
A
A A [Figure]
A
A A
[Figure]
A
[Figure]
A
[Figure]
A A A
[Figure]
A
A cos
A
A
[Figure]
A
A exp
A x
A
[Figure]
A
[Figure] reckoned as individual production rules and appended to the set of production rules R ; accordingly, these trees are “transplanted” to the future ones as their modules (i.e, the leaves).
To avoid early overfitting problem, we incrementally enlarge the sizes of such modules from a baseline length to the maximum allowed size of the parse tree throughout the iterations.
The augmentation part of R is refreshed whenever new production rules are created, keeping only the ones engendering high rewards.
This approach accelerates the policy search by capturing and locking some modules that likely contribute to, or appear as part of the optimal solution, especially in the cases of the mathematical expression containing “deep” operations (e.g., high-order polynomials) whose structures are difficult for the MCTS agent to repeatedly obtain during the selection and expansion.
S YMBOLIC R EGRESSION : F INDING M ATHEMATICAL F ORMULAS 4. D ATA N OISE & S CARCITY
[Figure]
The heatmaps demonstrate the recovery rate of GP-based symbolic regressor and the SPL machine under different data
Data scarcity and noise are commonly seen in measurement data and become one of the bottleneck issues for discovering the governing equations of nonlinear dynamics.
Tackling the challenges in high-level data scarcity and noise situations is traditionally regarded as an essential robustness indicator for a nonlinear dynamics discovery model.
To this end, we present an examination of the proposed SPL machine by an equation discovery task in the presence of multiple levels of data noise and volume, comparing with a GP-based symbolic regressor (implemented with gplearn python package) 1 .
The target equation is f ( x ) = 0 .
3 x 3 + 0 .
5 x 2 + 2 x , and the independent variable X is uniformly sampled in the given range [ − 10 , 10] .
Gaussian white noise is added to the dependent variable Y with the noise level defined as the root-mean-square ratio between the noise and the exact values.
For discovery, the two models are fed with equivalent search space: { + , − , × , ÷ , cost, x } as candidate mathematical operations and symbols.
The hyperparameters of the SPL machine are set as η = 0 . 99 , t max = 50 , and 10,000 episodes of training is regarded as one trail.
For the GP-based symbolic regressor, the population of programs is set as 2,000, the number of generations as 20.
The range of constant coefficient values is [ − 10 , 10] .
For 16 different data noise and scarcity levels, each model was performed 100 independent trails.
The recovery rates are displayed as a 4 × 4 mesh grid w.r.t.
different noise/scarcity levels in Figure 3.
It is observed that the SPL machine outperforms the
GP-based symbolic regressor in all the cases.
A T-test also proves that the recovery rate of the SPL machine is significantly higher than that of GP (e.g., p -value = 1 .
06 × 10 − 7 ).
[Table]
2% 4. N GUYEN ’ S S YMBOLIC R EGRESSION B ENCHMARK
Nguyen’s symbolic regression benchmark task (Uy et al., 2011) is widely used to test the model’s robustness in symbolic regression problems.
Given a set of allowed operators, a target equation, and data generated by the specified equation (see Table 1 for example), the tested model is supposed to distill the mathematical expression that is identical to the target equation, or equivalent to it (e.g.,
Nguyen-7 equation can be recovered as log( x 3 + x 2 + x +1) , Nguyen-10 equation can be recovered as sin( x + y ) , and Nguyen-11 equation can be recovered as exp( y log( x )) ).
Some variants of Nguyen’s benchmark equations are also considered in this experiment.
Their discoveries require numerical estimation of the constant coefficient values.
Each equation generates two datasets: one for training and another for testing.
The discovered equation that perfectly fits the testing data is regarded as a successful discovery (i.e., the discovered equation should be identical or equivalent to the target one).
The recovery rate is calculated based on 100 independent tests for each task.
In these benchmark tasks, three algorithms are tested: GP-based symbolic regressor, the neural-guided GP (NGGP) (Mundhenk et al., 2021), and the SPL machine.
Note that NGGP is an improved approach over DSR (Petersen et al., 2021).
They are given the same set of candidate operations: { + , − , × , ÷ , exp( · ) , cos( · ) , sin( · ) } for all benchmarks and { √ · , ln( · ) } are added to the 7, 8, 11 benchmarks.
The hyperparameters of the
GP-based symbolic regressor are the same as those mentioned in Section 4.1; configurations of the
NGGP models are obtained from its source code 2 ; detailed setting of the benchmark tasks and the
SPL model is described in Appendix Section
B. The success rates are shown in Table 1.
It is observed that the SPL machine and the NGGP model both produce reliable results in Nguyen’s benchmark problems and the SPL machine slightly outperforms NGGP.
This experiment betokens the capacity of the SPL machine in discovery of equations with divergent forms.
Ablation Study: We consider four ablation studies by removing: (a) the adaptive scaling in reward calculation, (b) the discount factor η n that drives equation parsimony in Eq.
(2), (c) module transplantation in tree generation, and (d) all of the above.
The four models were tested on the first 12 Nguyen equations (see Appendix Section C).
Results show the average recovery rates for these models are all smaller than that produced by SPL (see Appendix Table C.1), where the module transplantation brings the largest effect.
Hence, these modules are critical to guarantee the proposed model efficacy.
P HYSICAL L AW D ISCOVERY : F REE F ALLING B ALLS WITH A IR R ESISTANCE
[Table]
It is well known that, in 1589–1592, Galileo dropped two objects of unequal mass from the Leaning Tower of Pisa and drew a conclusion that their velocities were not affected by the mass.
This has been well recognized globally as the “textbook” physical law for the vertical motion of a free-falling object: the height of the object is formulated as H ( t ) =
h 0 + v 0 t − 12 gt 2 , where h 0 denotes initial height, vthe initial velocity [Table] and g the gravitational acceleration.
However, this ideal situation is rarely reached in our daily life because air resistance serves as a significant damping factor that prevents the above physical law from occurring in real-life cases.
[Table]
Many efforts have been made to uncover the effect of the air resistance and derive mathematical models to describe the free-falling objects with air resistance (Clancy, 1975; Lindemuth, 1971;
Greenwood et al., 1986).
This section provides data-driven discovery of the physical laws of relationships between height and time in the cases of free-falling objects with air resistance based on multiple experimental ball-drop datasets (de Silva et al., 2020), which contain the records of 11 different types of balls dropped from a bridge (see Appendix Figure D.1).
For discovery, each dataset is split into a training set (records from the first 2 seconds) and a testing set (records after 2 seconds).
Three mathematically derived physics models are selected from the literature as baseline models 3 , 4 , 5 for this experiment (see Table 2), and the unknown constant coefficient values are estimated by Powell’s conjugate direction method (Powell, 1964).
Based on our prior knowledge of the physical law that may appear in this case, we use { + , − , × , ÷ , exp( · ) , cosh( · ) , log( · ) } as the candidate grammars for the SPL discovery, with terminal nodes { t, const } .
The hyperparameters are set as η = 0 .
9999 , t max = 20 , and one single discovery is built upon 6,000 episodes of training.
The physical laws distilled by SPL from training data are applied to the test data and compared with the ground truth.
Their prediction errors, in terms of MSE, are presented in Table 3 (the SPL-discovered equations are shown in Appendix Table D.1).
The full results can be found in Appendix Section D. It can be concluded that the data-driven discovery of physical laws leads to a better approximation of the free-falling objects with air resistance.
C HAOTIC D YNAMICS D ISCOVERY : T HE L ORENZ S YSTEM
The first nonlinear dynamics discovery example is a 3-dimensional Lorenz system (Lorenz, 1963) whose dynamical behavior ( x, y, z ) is governed by ˙ x
= σ ( y − x ) , ˙
y
=
x ( ρ − z ) − y, ˙
z = xy − βz with parameters σ = 10 , β = 8 / 3 , and ρ = 28 .
The Lorenz attractor has two lobes and the system, starting from anywhere, makes cycles around one lobe before switching to the other and iterates repeatedly, exhibiting strong chaos.
The synthetic system states ( x, y, z ) are generated by solving the nonlinear differential equations using the Matlab ode113 (Shampine, 1975; Shampine & Reichelt, 1997) function.
5% Gaussian white noise is added to the clean data to generate noisy measurement.
The derivatives of the system states ( ˙ x, ˙ y, ˙ z ) are unmeasured but estimated by central difference and smoothed by the Savitzky–Golay filter (Savitzky & Golay, 1964) in order to reduce the noise effect. [Table]
In this experiment, the proposed SPL machine is compared with three benchmark methods: Eureqa, pySINDy and NGGP.
For Eureqa, NGGP, and the SPL machine, { + , − , × , ÷ are used as candidate tions the pySINDy candidate function library all polynomial basis ( x, y, z ) degree
Appendix Table E.1 presents the distilled governing equations by each approach and Table 4 summarizes these results: the SPL machine uncovers the explicit form of equations accurately in the context of active terms, whereas Eureqa, pySINDy and NGGP yield several false-positive terms in the governing equations.
In particular, although Eureqa and NGGP are capable of uncovering the correct terms, their performance is very sensitive to the measurement noise as indicated by the redundant terms (despite with small coefficients) shown in Appendix Table E.1.
Overall, the baseline methods fail to handle the large noise effect, essentially limiting their applicability in nonlinear dynamics discovery.
It is evident that the SPL machine is capable of distilling the concise symbolic combination of operators and variables to correctly formulate parsimonious mathematical expressions that govern the Lorenz system, outperforming the baseline methods of Eureqa, pySINDy and NGGP.
E XPERIMENTAL D YNAMICS D ISCOVERY : D OUBLE P ENDULUM
This section shows SPL-based discovery of a chaotic double pendulum system with experimental data (Asseman et al., 2018) as shown in Appendix Figure E.3.
The governing equations are given by:
[Equation]
where θ 1 , θ 2 denote the angular displacements; ω
1 = ˙
θ 1 , ω
2 = ˙
θ 2 the velocities; ˙ ω 1 , ˙
ω 2 the accelerations; R 1 and R 2 denote the unknown damping forces.
Note that ∆ θ = θ 1 − θ 2 .
The data source contains multiple camera-sensed datasets.
Here, 5,000 denoised random sub-samples from 5 datasets are used for training, 2,000 random sub-samples from another 2 datasets for validation, and 1 dataset for testing.
The derivatives of the system states are numerically estimated by the same approach discussed in the Lorenz case.
Some prior physics knowledge is employed to guide the discovery: ( 1 ) the terms ˙ ω 2 cos(∆ θ ) for ˙ ω 1 and ˙ ω 1 cos(∆ θ ) for ˙ ω 2 are assumed to be part of the governing equations based on the Lagrange derivation; ( 2 ) the angles ( θ 1 , θ 2 , ∆ θ ) are under the trigonometric functions cos( · ) and sin( · ) ; ( 3 ) directions of velocities/relative velocities may appear in damping.
Production rules fulfilling the above prior knowledge are exhibited in Appendix Section
E.2.
The hyperparameters are set as η = 1 , t max = 20 , and 40,000 episodes of training are regarded as one trail.
5 independent trials are performed and the equations with the highest validation scores are selected as the final results.
The uncovered equations are given as follows:
[Equation]
where the explicit expression of physics in an ideal double pendulum system, as displayed in Eq.
(5), are successfully distilled and damping terms are estimated.
This set of equation is validated through interpolation on the testing set and compared with the smoothed derivatives, as shown in Appendix
Figure E.4.
The solution appears felicitous as the governing equations of the testing responses.
C ONCLUSION AND D ISCUSSION
This paper introduces a Symbolic Physics Learner (SPL) machine to tackle the challenge of distilling the mathematical structure of equations for physical systems (e.g., nonlinear dynamics) with scarce/noisy data.
This framework is built upon the expression tree interpretation of mathematical operations and variables and an MCTS agent that searches for the optimistic policy to reconstruct the target mathematical formula.
With some remarkable adjustments to the MCTS algorithms, the
SPL model straightforwardly accepts our prior or domain knowledge, or any sort of constraints of the tasks in the grammar design while leveraging great flexibility in expression formulation.
The robustness of the proposed SPL machine for complex target expression discovery within a large search space is indicated in the Nguyen’s symbolic regression benchmark problems, where the SPL machine outperforms state-of-the-art symbolic regression methods.
Moreover, encouraging results are obtained in the tasks of discovering physical laws and nonlinear dynamics, based on synthetic or experimental datasets.
While the proposed SPL machine shows huge potential in both symbolic regression and physical law discovery tasks, there are still some imperfections that can be improved: (i) the computational cost is high for constant coefficient value estimation due to repeated calls for an optimization process, (ii) graph modularity is underexamined, and (iii) robustness against extreme data noise and scarcity is not optimal.
These limitations are further explained in Appendix Section F
A CKNOWLEDGMENTS
The work is supported by the National Natural Science Foundation of China (No. 92270118) and
the
Beijing Outstanding Young Scientist Program (No. BJJWZYJH012019100020098)
A PPENDIX A H YPERPARAMETER S ETTING
We perform a parametric study on the value of discount factor η based on Nguyen’s benchmark problems without measurement noise.
Empirically, setting η = 0 .
9999 ensures the scores of ground truth equations stand out and successfully enforces the sparsity in all experiments.
For the discovery of very chaotic dynamical systems based on measurement data, we expect some physics terms from the governing equations to have a weak impact on the state variables (e.g., in the chaotic double pendulum system experiments, the effects from physics terms sin( θ 1 ) and sin( θ 2 ) are hard to be captured), and the effect of data noise is unknown.
Hence, we set η = 1 to leverage the full strength of data fitting to enable the detection of physics terms that are offset or overwhelmed by data noise but are pivotal to the systems.
Nevertheless, we must acknowledge that this selection process is empirical, which depends on our desire for the degree of parsimony of the target equation(s).
As for the hyperparameters in the training schema (i.e., maximum module transplantation, episodes, maximum tree size, maximum augmented grammars), we have conducted parametric convergence tests for each experiment to ensure the learning curves (i.e., maximum scores in the history) converge.
For example, as discussed in Section B, Table B.2 shows the setting of these hyperparameters.
B N GUYEN ’ S B ENCHMARK P ROBLEMS
This section provides more detailed experiment settings for the Nguyen’s benchmark tasks that are described in Section 4.2 of the main text, where the training hyperparameters for the SPL machine in these equation discovery experiments are also listed.
Table B.1 presents the candidate mathematical operations allowed for three tested models and Table B.2 displays training hyperparameters for the
SPL machine in the Nguyen’s benchmark tasks.
Moreover, the utilization of CFG in the SPL machine facilitates the flexibility of applying some prior knowledge including the universal mathematical rules and constraints.
This feature empirically turns out to be an accessible and scalable approach for avoiding meaningless mathematical expressions.
In the Nguyen’s benchmark tasks, one or multiple mathematical constraints are given to the SPL machine.
These constraints include
Benchmark Candidate Operations
Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · )
Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · )
Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · )
Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) , log( · ) , √· Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) , log( · ) , √·
Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · )
Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) , log( · ) , √· Nguyen- + , − , × , ÷ , cos( · ) , sin( · ) , exp( · )
Nguyen-1 c + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) , const
Nguyen-2 c + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) , const
Nguyen-5 c + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) , const
Nguyen-8 c + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) , log( · ) , √· , const
Nguyen-9 c + , − , × , ÷ , cos( · ) , sin( · ) , exp( · ) , const
[Table]
[Table]
Variables in trigonometric functions, logarithms and roots are up to the polynomial of 3. 3.
Trigonometric functions, logarithms and roots are not allowed to form unreasonable composite functions with each other, such as sin(cos( ... )) .
Some small integers (e g. 1, 2) are used directly as leaves.
They can be easily implemented into the SPL machine by defining or adjusting non-terminal nodes or production rules in the customized CFG.
Constraints adopted by each task are shown in Table B.3.
C R ESULTS OF A BLATION S TUDY
We consider four ablation studies by removing the following:
(a) the adaptive scaling in reward calculation, (b) the discount factor η n that drives equation parsimony in Eq.
(2), (c) module transplantation in tree generation, (d) all of the above three.
The resulting models are denoted with Model A, Model B, Model C, and Model D (note that Model
D is equivalent to the vanilla MCTS).
The ablation study is performed on the 12 classic Nguyen’s benchmark problems, where the recovery rate of each model is calculated.
The results of the ablation study are summarized in Table C.1.
It is clear that module transplantation brings the largest gain in recovery rate.
All the ablated models fail to uncover the Nguyen-12 equation (the most difficult case), where the coefficient 1/2 needs to be represented by mathematical operators and symbols, e.g., x/ ( x + x ) , y/ ( y + y ) , etc.
D F REE F ALLING B ALLS WITH A IR R ESISTANCE
This appendix section reveals more details on discovering the physical laws, in the context of relationships between height and time, for the cases of free-falling objects with air resistance based on multiple experimental ball-drop datasets (de Silva et al., 2020).
The datasets contain the records ofdifferent types of balls, as shown in Figure D.1, dropped from a bridge, collected at a 30 Hz sampling rate.
The time between dropping and landing varies in each case due to the fact that air resistance has different effects on these free-dropping balls and induces divergent physical laws.
Consequently, we consider each ball as an individual experiment and discover the physical law for each of them.
The measurement dataset of a free-dropping ball is split into a training set (records from the firstseconds, 60 measurements) and a testing set (records after 2 seconds).
The physical laws of the three baseline models and distilled by the SPL machine from training data are exhibited in Table D.1.
These discovered physical laws are then applied to forecast the height of the balls at the time slots in the testing dataset.
These predictions, in comparison with the ground truth trajectory recorded, are shown in Figure D.2.
The prediction error is shown in the Table 3 of the main text.
E N ONLINEAR D YNAMICS D ISCOVERY
This appendix section elaborates more details on the two governing equation discovery experiments presented in the main text, including the datasets and full results.
[Table] [Table]
[Figure]
E. L ORENZ S YSTEM
The 3-dimensional Lorenz system is governed by
[Equation]
with parameters σ = 10 , β = 8 / 3 , and ρ = 28 , under which the Lorenz attractor has two lobes and the system, starting from anywhere, makes cycles around one lobe before switching to the
[Figure]
[Table]
other and iterates repeatedly.
The measurement data of the Lorenz system states in this experiment contains a clean signal with 5% Gaussian white noise.
The derivatives of Lorenz’s state variables are unmeasured but numerically estimated and smoothed by the Savitzky–Golay filter.
The noisy synthetic measurement data and numerically obtained derivatives are shown in Figure E.1.
Table E.1 presents the distilled governing equations for the Lorenz system by the SPL machine compared with 3 baseline models.
It is observed that the SPL machine uncovers the explicit form of equations accurately in the context of active terms, whereas Eureqa, pySINDy and NGGP yield several false-positive terms in the underlying governing equations.
The predicted system responses (starting from a different initial condition) simulated from these uncovered equations are shown in
Figure E.2.
Although it is hard to reproduce the most accurate coefficients due to the tremendous errors induced by numerical differentiation of noisy measurement data as depicted in Figure E.1, the
SPL machine is still capable of distilling the most concise symbolic combination of operators and variables to correctly formulate the parsimonious mathematical expressions that govern the Lorenz system dynamics.
The predicted responses for the governing equations unearthed by the SPL machine simulate the system in a decent manner.
Eureqa
PySINDy
SPL
[Equation]
E. M OUNTED D OUBLE P ENDULUM S YSTEM
The second nonlinear dynamics discovery experiment is a chaotic double pendulum system (Asseman et al., 2018).
The measured data, in form of videos, represents the chaotic motion of a double pendulum on the device shown in Figure E.3A filmed with a high-speed camera.
The positional data is converted into angular form based on the geometry information (see the model shown in Figure
E.3C).
The governing equations can be derived using the Euler–Lagrange method, given by
[Equation]
which, by denoting ω as the velocity
[Equation]
can be converted to the following state-space form:
[Equation]
where ∆ θ = θ 1 − θ 2 , and R 1 ( θ 1 , θ 2 , ˙ θ 1 , ˙ θ 2 ) and R 2 ( θ 1 , θ 2 , ˙ θ 1 , ˙ θ 2 ) denote the damping terms for the last two differential equations.
The data source contains multiple video datasets.
For this discovery, 5,000 denoised random subsamples from 5 datasets are used for training purposes, and 2,000 random sub-samples from another 2 datasets for validation, and 1 dataset for testing.
Some prior knowledge guiding this discovery includes:
[Table]
the two terms ˙ ω 2 cos(∆ θ ) for ˙ ω 1 and ˙ ω 1 cos(∆ θ ) for ˙ ω 2 , which can be easily derived based on our prior knowledge on the system, are assumed known in the two governing equations.
However, their coefficients are unknown and need to be estimated.
the remaining of the formulas are potentially comprised of the free combination of ˙ ω 1 , ˙ ω 2 , ω 1 , ω 2 , as well as the angles ( θ 1 , θ 2 , ∆ θ ) under the trigonometric functions cos( · ) and sin( · ) .
velocities and relative velocities of two masses, as well as their directions (sign function) might contribute to the damping.
Based on the above information, the candidate production rules for ˙ ω 1 and ˙ ω 2 equations are shown below, where non-terminal nodes are V
=
{ A, W, T, S } and C denotes the placeholder symbol for the constant coefficient values.
[Equation] A
[Equation]
A
[Equation]
A
→ ˙
ω
cos( θ 1 − θ
Note that our prior knowledge can be easily incorporated in the proposed SPL machine to improve the discovery performance, rather than relying on the free combination of mathematical operators and symbols.
The hyperparameters are set as η = 1 , t max = 20 , and 40,000 episodes of training are regarded as one trail.
5 independent trials are performed and the equations with the highest validation scores are selected as the final result.
The uncovered equations are shown in Table E.2.
They are validated through interpolation on the testing set and compared with the smoothed derivatives, as shown in Figure E.4.
The solution appears felicitous as the governing equations of the testing responses.
F D ISCUSSION AND F UTURE D IRECTIONS
The effectiveness of the proposed SPL machine is empowered by the following elements: (1) The use of MCTS enables the flexible representation of search space with customized computational grammars, composed of a finite set of mathematical operators and symbols, to guide the search tree expansion.
(2) The exploration-exploitation trade-off nature of MCTS is remarkably useful for searching the optimal mathematical expression tree.
The key adjustments, including the greedy search, the adaptive-scaled rewarding, the reward regularizer, and the expression tree module transplantation, make it possible to efficiently uncover the best path to formulate complex equations.
The SPL machine straightforwardly accepts our prior or domain knowledge, or any sort of constraints of the tasks in the grammar design while leveraging great flexibility in expression formulation.
While SPL shows huge potential in both symbolic regression and governing equation discovery tasks, there are still some imperfections to be improved.
In this appendix section, a few bottlenecks and their potential solutions are presented:
Computational cost.
Computational cost for this framework is one of the major issues, especially when constant coefficient estimation is required.
Evaluating the solution in the simulation phase happens very frequently for the MCTS algorithm where the policy selection relies heavily on a large number of historical rewards.
However, the constant coefficient value estimation, which requires repeated calls for an optimization process and can be slow,
[Figure]
[Table]
[Figure] [Table] [Figure]
[Table]
[Figure] [Table] [Figure]
[Table]
[Figure] [Table] [Figure]
[Table]
[Figure] [Table] [Figure] [Table]
[Figure]
[Table]
is needed for evaluation purposes.
In particular, the constant coefficient value is estimated via concurrently solving an optimization problem, e.g., by Powell’s conjugate direction method (Powell, 1964).
For example, when the tree structure changes or is updated, the optimization of the constant coefficients should be re-performed simultaneously.
The SPL machine is not the only symbolic regressor suffering from the computational cost in constant coefficient value estimation.
In fact, the state-of-the-art symbolic regression model, the neural-guided GP (NGGP)
(Mundhenk et al., 2021), becomes much slower in the Nguyen’s benchmark variant tasks (see Table E.3).
The current implementation of the SPL machine tries to empirically avoid this issue by limiting the number of placeholders in a discovered expression and simplifying the expression before evaluation, but still cannot reach great efficiency.
This bottleneck might be mitigated if parallel computing is introduced to the MCTS simulation phase.
Graph modularity underexamined.
The current design of the SPL training scheme does not leverage the full graph modularity: modules are reached by transforming a complete parse tree into a grammar.
However, in some cases, there might be some influential modules appearing frequently as part of the tree.
This type of graph modularity is described in the AIFeynman method (Udrescu et al., 2020).
Deploying a more comprehensive graph modularity into the SPL machine will boost its efficacy in the complex equation and nonlinear dynamics discovery tasks.
Robustness against extreme data noise and scarcity.
Although it is observed that this reinforcement learning-based method is able to unearth the parsimonious solution to the governing equations from synthetic or measurement data with a moderate level of noise and scarcity.
It is not effective when the data condition is extreme, or if there are missing values that make it challenging to numerically calculate the state derivatives.
It is reasonable to investigate the integration between the SPL framework with a differentiable surrogate model built upon neural networks (Long et al., 2018;
Chen et al., 2021) or spline learning (Sun et al., 2021) for further robustness in nonlinear dynamics discovery tasks.