-
Notifications
You must be signed in to change notification settings - Fork 5
for list comprehension of train_history #196
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
| end | ||
|
|
||
| # Required methods for AbstractVector | ||
| Base.size(w::WrappedTuples) = (length(w.data), length(first(w.data))) |
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.
we need this.
The intended use of this is to first do something like soc = WrappedTuples(SOC.history), and then soc.nse to get all values, without the need to use list comprehension.
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.
| struct WrappedTuples{T <: AbstractVector{<:NamedTuple}} <: AbstractVector{NamedTuple} |
It's also just odd to have an 2D vector 😆
|
What do we need it for? train and the train_board works. For saving? |
|
When I do soc.nse, it is still a bit weird format which is not straightforward to extract (for me ;-)) 11×5 Matrix{@NamedTuple{SOC::Float32, CQ::Float32, CB::Float32, mean::Float32}}:
(SOC = -16210.9, CQ = -27.1608, CB = -55.532, mean = -5431.19) (SOC = -16210.9, CQ = -27.1608, CB = -55.532, mean = -5431.19) … (SOC = -16210.9, CQ = -27.1608, CB = -55.532, mean = -5431.19)
(SOC = -86.3123, CQ = -23.1424, CB = -59.6994, mean = -56.3847) (SOC = -86.3123, CQ = -23.1424, CB = -59.6994, mean = -56.3847) (SOC = -86.3123, CQ = -23.1424, CB = -59.6994, mean = -56.3847)``` |
is for convenient access of nested arrays of tuples. your output from above could further be |
|
Hmm, I do not see the convenience of doing this Both work with my small change btw. This also related to Andrés issue I think #174 I think we need some convenience functions for this. Maybe we have them already and I forgot 😃 |
Needed to make this
[row.nse.SOC for row in o_SOC.val_history]workOtherwise I would need to do this
[row.nse.SOC for row in o_SOC.val_history.data]The .data is not very intuitive. Does not affect train (I tested), not sure if this would affect anything else @lazarusA