Skip to content

Commit

Permalink
docs: fix older TemplateExpressionSpec syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Feb 25, 2025
1 parent 5426ea0 commit 5f0a282
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ the category as a column of `X`:
spec = TemplateExpressionSpec(
expressions=["f", "g"],
variable_names=["x1", "x2", "class"],
parameters={"p1": 3, "p2": 1},
combine="p1[class] * sin(f(x1, x2)) + p2[class]",
)
```
Expand Down Expand Up @@ -689,13 +690,9 @@ x = np.random.uniform(1, 10, (1000,)) # Integrand sampling points
y = 1 / (x**2 * np.sqrt(x**2 - 1)) # Evaluation of the integrand

expression_spec = TemplateExpressionSpec(
["f"],
"""
function diff_f_x((; f), (x,))
df = D(f, 1) # Symbolic derivative of f with respect to its first arg
return df(x)
end
"""
expressions=["f"],
variable_names=["x"],
combine="df = D(f, 1); df(x)",
)

model = PySRRegressor(
Expand Down

0 comments on commit 5f0a282

Please sign in to comment.