Skip to content

Question about input X's dimension #584

Answered by MilesCranmer
qizzhao asked this question in Q&A
Discussion options

You must be logged in to vote

You can do it with a custom loss function in the loss_function parameter: https://astroautomata.com/SymbolicRegression.jl/dev/api/ or https://astroautomata.com/PySR/examples/#9-custom-objectives. The idea is to flatten X into a 2D array, and then reshape it to 3D within the loss function.

To use eval_tree_array you have to pass a 2D array. Imagine batching a computation over all pixels.

const nx = 32
const ny = 20  # For example
function default_objective(tree, dataset::Dataset{T,L}, options)::L where {T,L}
    X = dataset.X
    (prediction, completion) = eval_tree_array(tree, X, options)
    if !completion
        return L(Inf)
    end
    # Here, X is a 2D array of shape [nx * ny, num_f…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@MilesCranmer
Comment options

@MilesCranmer
Comment options

@qizzhao
Comment options

@MilesCranmer
Comment options

@qizzhao
Comment options

Answer selected by qizzhao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
SymbolicRegression.jl SymbolicRegression.jl-related discussion
2 participants