Compute derivative from fitted model #414
-
Dear @MilesCranmer & community, Once I have trained my model using the MLJ interface, I would not only like to use Thanks a lot in advance. Bests |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @llamm-de, Thanks for the message. This is a bit tricky as MLJ does not have an interface for this, so you will have to use the low-level SymbolicRegression.jl calls directly. The easiest way to do this right now would be as follows: using MLJ
using SymbolicRegression as SR
...
model = ...
mach = ...
...
# Get the tree:
r = report(mach)
tree = r.equations[r.best_idx]
# Get the transposed X:
X_t, _, _ = SR.MLJInterfaceModule.get_matrix_and_info(X, model.dimensions_type)
# Get options from mach:
options = mach.fitresult.options
# Use:
eval_grad_tree_array(tree, X_t, options; variable=true/false) # or eval_diff_tree_array But it would definitely nice if there was a function to pass this through automatically. Cheers, |
Beta Was this translation helpful? Give feedback.
-
Hey @MilesCranmer, thanks for the quick answer. It works like a charm. 😊 👍 Bests Lukas |
Beta Was this translation helpful? Give feedback.
Hi @llamm-de,
Thanks for the message. This is a bit tricky as MLJ does not have an interface for this, so you will have to use the low-level SymbolicRegression.jl calls directly. The easiest way to do this right now would be as follows:
But it would definitely nice if there was a function to pass …