Skip to content

Commit 90cf47d

Browse files
committed
format markdown
1 parent 59edde8 commit 90cf47d

File tree

11 files changed

+167
-149
lines changed

11 files changed

+167
-149
lines changed

.JuliaFormatter.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
style = "sciml"
1+
style = "sciml"
2+
format_markdown = true

README.md

+87-88
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,87 @@
1-
# DataDrivenDiffEq.jl
2-
3-
[![Join the chat at https://julialang.zulipchat.com #sciml-bridged](https://img.shields.io/static/v1?label=Zulip&message=chat&color=9558b2&labelColor=389826)](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged)
4-
[![Global Docs](https://img.shields.io/badge/docs-SciML-blue.svg)](https://docs.sciml.ai/DataDrivenDiffEq/stable/)
5-
[![DOI](https://zenodo.org/badge/212827023.svg)](https://zenodo.org/badge/latestdoi/212827023)
6-
7-
[![codecov](https://codecov.io/gh/SciML/DataDrivenDiffEq.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/SciML/DataDrivenDiffEq.jl)
8-
[![Build Status](https://github.com/SciML/DataDrivenDiffEq.jl/workflows/CI/badge.svg)](https://github.com/SciML/DataDrivenDiffEq.jl/actions?query=workflow%3ACI)
9-
10-
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
11-
[![SciML Code Style](https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826)](https://github.com/SciML/SciMLStyle)
12-
13-
DataDrivenDiffEq.jl is a package in the SciML ecosystem for data-driven differential equation
14-
structural estimation and identification. These tools include automatically discovering equations
15-
from data and using this to simulate perturbed dynamics.
16-
17-
For information on using the package,
18-
[see the stable documentation](https://docs.sciml.ai/DataDrivenDiffEq/stable/). Use the
19-
[in-development documentation](https://docs.sciml.ai/DataDrivenDiffEq/dev/) for the version of
20-
the documentation which contains the un-released features.
21-
22-
## Quick Demonstration
23-
24-
```julia
25-
## Generate some data by solving a differential equation
26-
########################################################
27-
using DataDrivenDiffEq
28-
using ModelingToolkit
29-
using OrdinaryDiffEq
30-
using DataDrivenSparse
31-
using LinearAlgebra
32-
33-
# Create a test problem
34-
function lorenz(u,p,t)
35-
x, y, z = u
36-
37-
= 10.0*(y - x)
38-
= x*(28.0-z) - y
39-
= x*y - (8/3)*z
40-
return [ẋ, ẏ, ż]
41-
end
42-
43-
u0 = [1.0;0.0;0.0]
44-
tspan = (0.0,100.0)
45-
dt = 0.1
46-
prob = ODEProblem(lorenz,u0,tspan)
47-
sol = solve(prob, Tsit5(), saveat = dt)
48-
49-
50-
## Start the automatic discovery
51-
ddprob = DataDrivenProblem(sol)
52-
53-
@variables t x(t) y(t) z(t)
54-
u = [x;y;z]
55-
basis = Basis(polynomial_basis(u, 5), u, iv = t)
56-
opt = STLSQ(exp10.(-5:0.1:-1))
57-
ddsol = solve(ddprob, basis, opt, options = DataDrivenCommonOptions(digits = 1))
58-
println(get_basis(ddsol))
59-
```
60-
61-
```
62-
Explicit Result
63-
Solution with 3 equations and 7 parameters.
64-
Returncode: success
65-
Sparsity: 7.0
66-
L2 Norm Error: 26.7343984476783
67-
AICC: 1.0013570199499398
68-
69-
Model ##Basis#366 with 3 equations
70-
States : x(t) y(t) z(t)
71-
Parameters : 7
72-
Independent variable: t
73-
Equations
74-
Differential(t)(x(t)) = p₁*x(t) + p₂*y(t)
75-
Differential(t)(y(t)) = p₃*x(t) + p₄*y(t) + p₅*x(t)*z(t)
76-
Differential(t)(z(t)) = p₇*z(t) + p₆*x(t)*y(t)
77-
78-
Parameters:
79-
p₁ : -10.0
80-
p₂ : 10.0
81-
p₃ : 28.0
82-
p₄ : -1.0
83-
p₅ : -1.0
84-
p₆ : 1.0
85-
p₇ : -2.7
86-
```
87-
88-
![](LorenzResult.png)
1+
# DataDrivenDiffEq.jl
2+
3+
[![Join the chat at https://julialang.zulipchat.com #sciml-bridged](https://img.shields.io/static/v1?label=Zulip&message=chat&color=9558b2&labelColor=389826)](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged)
4+
[![Global Docs](https://img.shields.io/badge/docs-SciML-blue.svg)](https://docs.sciml.ai/DataDrivenDiffEq/stable/)
5+
[![DOI](https://zenodo.org/badge/212827023.svg)](https://zenodo.org/badge/latestdoi/212827023)
6+
7+
[![codecov](https://codecov.io/gh/SciML/DataDrivenDiffEq.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/SciML/DataDrivenDiffEq.jl)
8+
[![Build Status](https://github.com/SciML/DataDrivenDiffEq.jl/workflows/CI/badge.svg)](https://github.com/SciML/DataDrivenDiffEq.jl/actions?query=workflow%3ACI)
9+
10+
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor%27s%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
11+
[![SciML Code Style](https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826)](https://github.com/SciML/SciMLStyle)
12+
13+
DataDrivenDiffEq.jl is a package in the SciML ecosystem for data-driven differential equation
14+
structural estimation and identification. These tools include automatically discovering equations
15+
from data and using this to simulate perturbed dynamics.
16+
17+
For information on using the package,
18+
[see the stable documentation](https://docs.sciml.ai/DataDrivenDiffEq/stable/). Use the
19+
[in-development documentation](https://docs.sciml.ai/DataDrivenDiffEq/dev/) for the version of
20+
the documentation which contains the un-released features.
21+
22+
## Quick Demonstration
23+
24+
```julia
25+
## Generate some data by solving a differential equation
26+
########################################################
27+
using DataDrivenDiffEq
28+
using ModelingToolkit
29+
using OrdinaryDiffEq
30+
using DataDrivenSparse
31+
using LinearAlgebra
32+
33+
# Create a test problem
34+
function lorenz(u, p, t)
35+
x, y, z = u
36+
37+
= 10.0 * (y - x)
38+
= x * (28.0 - z) - y
39+
= x * y - (8 / 3) * z
40+
return [ẋ, ẏ, ż]
41+
end
42+
43+
u0 = [1.0; 0.0; 0.0]
44+
tspan = (0.0, 100.0)
45+
dt = 0.1
46+
prob = ODEProblem(lorenz, u0, tspan)
47+
sol = solve(prob, Tsit5(), saveat = dt)
48+
49+
## Start the automatic discovery
50+
ddprob = DataDrivenProblem(sol)
51+
52+
@variables t x(t) y(t) z(t)
53+
u = [x; y; z]
54+
basis = Basis(polynomial_basis(u, 5), u, iv = t)
55+
opt = STLSQ(exp10.(-5:0.1:-1))
56+
ddsol = solve(ddprob, basis, opt, options = DataDrivenCommonOptions(digits = 1))
57+
println(get_basis(ddsol))
58+
```
59+
60+
```
61+
Explicit Result
62+
Solution with 3 equations and 7 parameters.
63+
Returncode: success
64+
Sparsity: 7.0
65+
L2 Norm Error: 26.7343984476783
66+
AICC: 1.0013570199499398
67+
68+
Model ##Basis#366 with 3 equations
69+
States : x(t) y(t) z(t)
70+
Parameters : 7
71+
Independent variable: t
72+
Equations
73+
Differential(t)(x(t)) = p₁*x(t) + p₂*y(t)
74+
Differential(t)(y(t)) = p₃*x(t) + p₄*y(t) + p₅*x(t)*z(t)
75+
Differential(t)(z(t)) = p₇*z(t) + p₆*x(t)*y(t)
76+
77+
Parameters:
78+
p₁ : -10.0
79+
p₂ : 10.0
80+
p₃ : 28.0
81+
p₄ : -1.0
82+
p₅ : -1.0
83+
p₆ : 1.0
84+
p₇ : -2.7
85+
```
86+
87+
![](LorenzResult.png)

docs/src/basis.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Basis
55
```
66

7-
## API
7+
## API
88

99
Next to [ModelingToolkits API](https://docs.sciml.ai/ModelingToolkit/stable/basics/AbstractSystem/) for `AbstractSystems`, a [`Basis`](@ref) can be called with the following methods:
1010

@@ -15,7 +15,6 @@ get_parameter_values
1515
get_parameter_map
1616
```
1717

18-
1918
## Generators
2019

2120
```@docs
@@ -25,4 +24,4 @@ sin_basis
2524
cos_basis
2625
fourier_basis
2726
chebyshev_basis
28-
```
27+
```

docs/src/index.md

+52-34
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ DataDrivenDiffEq.jl is a package for finding systems of equations automatically
55
The methods in this package take in data and return the model which generated the data. A known model is not required as input. These methods can estimate equation-free and equation-based models for discrete, continuous differential equations or direct mappings.
66

77
There are two main types of estimation, depending on if you need the result to be human-understandable:
8-
+ Structural identification - returns a human-readable result in symbolic form.
9-
+ Structural estimation - returns a function that predicts the derivative and generates a correct time series, but is not necessarily human-readable.
8+
9+
- Structural identification - returns a human-readable result in symbolic form.
10+
- Structural estimation - returns a function that predicts the derivative and generates a correct time series, but is not necessarily human-readable.
1011

1112
A quick-start example:
1213

@@ -18,27 +19,26 @@ using DataDrivenSparse
1819
using LinearAlgebra
1920
2021
# Create a test problem
21-
function lorenz(u,p,t)
22+
function lorenz(u, p, t)
2223
x, y, z = u
2324
24-
ẋ = 10.0*(y - x)
25-
ẏ = x*(28.0-z) - y
26-
ż = x*y - (8/3)*z
25+
ẋ = 10.0 * (y - x)
26+
ẏ = x * (28.0 - z) - y
27+
ż = x * y - (8 / 3) * z
2728
return [ẋ, ẏ, ż]
2829
end
2930
30-
u0 = [1.0;0.0;0.0]
31-
tspan = (0.0,100.0)
31+
u0 = [1.0; 0.0; 0.0]
32+
tspan = (0.0, 100.0)
3233
dt = 0.1
33-
prob = ODEProblem(lorenz,u0,tspan)
34+
prob = ODEProblem(lorenz, u0, tspan)
3435
sol = solve(prob, Tsit5(), saveat = dt)
3536
36-
3737
## Start the automatic discovery
3838
ddprob = DataDrivenProblem(sol)
3939
4040
@variables t x(t) y(t) z(t)
41-
u = [x;y;z]
41+
u = [x; y; z]
4242
basis = Basis(polynomial_basis(u, 5), u, iv = t)
4343
opt = STLSQ(exp10.(-5:0.1:-1))
4444
ddsol = solve(ddprob, basis, opt, options = DataDrivenCommonOptions(digits = 1))
@@ -53,6 +53,7 @@ To use [DataDrivenDiffEq.jl](https://github.com/SciML/DataDrivenDiffEq.jl), inst
5353
using Pkg
5454
Pkg.add("DataDrivenDiffEq")
5555
```
56+
5657
## Package Overview
5758

5859
Several algorithms for structural estimation and identification are implemented in the following subpackages.
@@ -70,18 +71,18 @@ Pkg.add("DataDrivenDMD")
7071

7172
### Sparse Regression
7273

73-
Uses Sparse Regression algorithms to find a suitable and sparse combination of basis functions to approximate a system of (differential) equations.
74+
Uses Sparse Regression algorithms to find a suitable and sparse combination of basis functions to approximate a system of (differential) equations.
7475

7576
To use this functionality, install [DataDrivenSparse](@ref) via:
7677

7778
```julia
7879
using Pkg
7980
Pkg.add("DataDrivenSparse")
80-
```
81+
```
8182

8283
### Symbolic Regression
8384

84-
Uses SymbolicRegression.jl to find a suitable set of equations to match the data.
85+
Uses SymbolicRegression.jl to find a suitable set of equations to match the data.
8586

8687
To use this functionality, install [DataDrivenSR](@ref) via:
8788

@@ -90,73 +91,90 @@ using Pkg
9091
Pkg.add("DataDrivenSR")
9192
```
9293

93-
9494
## Contributing
9595

96-
- Please refer to the
97-
[SciML ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://github.com/SciML/ColPrac/blob/master/README.md)
98-
for guidance on PRs, issues, and other matters relating to contributing to SciML.
99-
- See the [SciML Style Guide](https://github.com/SciML/SciMLStyle) for common coding practices and other style decisions.
100-
- There are a few community forums:
101-
- The #diffeq-bridged and #sciml-bridged channels in the
102-
[Julia Slack](https://julialang.org/slack/),
103-
you can message @AlCap23 to start a discussion.
104-
- The #diffeq-bridged and #sciml-bridged channels in the
105-
[Julia Zulip](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged)
106-
- On the [Julia Discourse forums](https://discourse.julialang.org)
107-
- See also [SciML Community page](https://sciml.ai/community/)
96+
- Please refer to the
97+
[SciML ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://github.com/SciML/ColPrac/blob/master/README.md)
98+
for guidance on PRs, issues, and other matters relating to contributing to SciML.
99+
100+
- See the [SciML Style Guide](https://github.com/SciML/SciMLStyle) for common coding practices and other style decisions.
101+
- There are a few community forums:
102+
103+
+ The #diffeq-bridged and #sciml-bridged channels in the
104+
[Julia Slack](https://julialang.org/slack/),
105+
you can message @AlCap23 to start a discussion.
106+
+ The #diffeq-bridged and #sciml-bridged channels in the
107+
[Julia Zulip](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged)
108+
+ On the [Julia Discourse forums](https://discourse.julialang.org)
109+
+ See also [SciML Community page](https://sciml.ai/community/)
108110

109111
## Reproducibility
112+
110113
```@raw html
111114
<details><summary>The documentation of this SciML package was built using these direct dependencies,</summary>
112115
```
116+
113117
```@example
114118
using Pkg # hide
115119
Pkg.status() # hide
116120
```
121+
117122
```@raw html
118123
</details>
119124
```
125+
120126
```@raw html
121127
<details><summary>and using this machine and Julia version.</summary>
122128
```
129+
123130
```@example
124131
using InteractiveUtils # hide
125132
versioninfo() # hide
126133
```
134+
127135
```@raw html
128136
</details>
129137
```
138+
130139
```@raw html
131140
<details><summary>A more complete overview of all dependencies and their versions is also provided.</summary>
132141
```
142+
133143
```@example
134144
using Pkg # hide
135-
Pkg.status(;mode = PKGMODE_MANIFEST) # hide
145+
Pkg.status(; mode = PKGMODE_MANIFEST) # hide
136146
```
147+
137148
```@raw html
138149
</details>
139150
```
151+
140152
```@raw html
141153
You can also download the
142154
<a href="
143155
```
156+
144157
```@eval
145158
using TOML
146-
version = TOML.parse(read("../../Project.toml",String))["version"]
147-
name = TOML.parse(read("../../Project.toml",String))["name"]
148-
link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/Manifest.toml"
159+
version = TOML.parse(read("../../Project.toml", String))["version"]
160+
name = TOML.parse(read("../../Project.toml", String))["name"]
161+
link = "https://github.com/SciML/" * name * ".jl/tree/gh-pages/v" * version *
162+
"/assets/Manifest.toml"
149163
```
164+
150165
```@raw html
151166
">manifest</a> file and the
152167
<a href="
153168
```
169+
154170
```@eval
155171
using TOML
156-
version = TOML.parse(read("../../Project.toml",String))["version"]
157-
name = TOML.parse(read("../../Project.toml",String))["name"]
158-
link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/Project.toml"
172+
version = TOML.parse(read("../../Project.toml", String))["version"]
173+
name = TOML.parse(read("../../Project.toml", String))["name"]
174+
link = "https://github.com/SciML/" * name * ".jl/tree/gh-pages/v" * version *
175+
"/assets/Project.toml"
159176
```
177+
160178
```@raw html
161179
">project</a> file.
162180
```

0 commit comments

Comments
 (0)