Spaces:
Sleeping
Sleeping
File size: 478 Bytes
1bd0408 fadf4db 1bd0408 fadf4db fe1cb56 d26d668 9ff66c9 fadf4db 1bd0408 7d4300a fadf4db a9212fa 7d4300a fadf4db e9073ea fadf4db 1bd0408 d26d668 1bd0408 fe1cb56 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import numpy as np
X = 2 * np.random.randn(100, 5)
y = 2.5382 * np.cos(X[:, 3]) + X[:, 0] ** 2 - 0.5
from pysr import PySRRegressor
model = PySRRegressor(
niterations=40,
binary_operators=["+", "*"],
unary_operators=[
"cos",
"exp",
"sin",
"inv(x) = 1/x", # Custom operator (julia syntax)
],
model_selection="best",
loss="loss(x, y) = (x - y)^2", # Custom loss function (julia syntax)
)
model.fit(X, y)
print(model)
|