-
Notifications
You must be signed in to change notification settings - Fork 4
yax #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Currently is failing with
|
|
||
ds_p_f = ds_yax[col=At(forcing_names ∪ predictor_names)] | ||
ds_t = ds_yax[col=At(target_names)] | ||
ds_t_nan = .!isnan.(ds_t) # produces 1×35064 YAXArray{Float32, 2}, not a Bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has to be done with map otherwise it's not a Bool
#return mean(abs2, yh .- yt) | ||
|
||
# Option 2: Use YAXArray directly but map has to be used | ||
return mean(x -> x, map((a,b)->(a-b)^2, ŷ[y_nan], y[y_nan])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here broadcast does not work - map works or we it an array. Not quite sure how we proceed from here. Should our model give a DimArray back? Not at all a YaxArrays / DimArrays expert ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in principle all types should work, so YAXArrays should be fine.
ds_t_nan = .!isnan.(ds_t) # produces 1×35064 YAXArray{Float32, 2}, not a Bool | ||
ds_t_nan = map(x -> !isnan(x), ds_t) # 1×35064 YAXArray{Bool, 2} | ||
|
||
ls = EasyHybrid.lossfn(RbQ10, ds_p_f, (ds_t, ds_t_nan), ps, st, LoggingLoss()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This runs now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, yes indeed it seems to be the nan mask. Let's the most generic version so that all input cases work.
end | ||
function loss_fn(ŷ, y, y_nan, ::Val{:mse}) | ||
return mean(abs2, (ŷ[y_nan] .- y[y_nan])) | ||
# Option 1: Convert to Array and compute MSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option 1 would be converting to an array but what I am not sure is where it would use a view, when it copies and when comes into memory and so on
No description provided.