-
Notifications
You must be signed in to change notification settings - Fork 14
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
First commit to add weighted mean square #140
Open
marcobonici
wants to merge
6
commits into
PumasAI:main
Choose a base branch
from
marcobonici:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
88fdd69
First commit to add weighted mean square
marcobonici 924c995
Update src/loss.jl according to ChrisElrod suggestion
marcobonici bc84718
Modified target method; updated tuple constructor WSL
marcobonici dfd1a25
Adding view_slice_last method
marcobonici 02ebd4f
Modified constructors wsl; loss eval ok, not train
marcobonici 0ba4462
Merge branch 'main' into main
chriselrod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Yes, the target should be sliceable and the loss should be callable on target's result to create a new one.
It's used for slicing/iterating over batches.
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.
So, the point is that
WeightedSquaredLoss(target(wsl))
should be able to run, did I get it right?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.
Yes.
Note that we also need things like
view_slice_last(target(loss), f:l)
to work.So
view_slice_last
should be implemented.Some form of
PtrArray(tgt)
should also work, but you could define a different function to use there that callsPtrArray
by default, as overloading constructors to return something else is generally frowned upon.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.
A few things @chriselrod .
So, as I thought
target(wsl)
needs to give back all the field of the struct. This is needed because, as you pointed out,WeightedSquaredLoss(target(wsl))
need to be working.So, I have updated the target method
target(wsl::WeightedSquaredLoss) = getfield(wsl, :y), getfield(wsl, :w)
Since this is giving back a tuple, I have added a constructor, using the splat operator
WeightedSquaredLoss(x::Tuple) = WeightedSquaredLoss(x...)
Do you have any consideration on that? In the meantime, I'll focus on
view_slice_last
.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.
If I correctly understand,
view_slice_last
is used to slice the fields of the loss. If so, this could possibly working.I am returning a
Tuple
assuming that this can work with my constructor I just created.