Conversation
Superjomn
reviewed
Jan 4, 2018
server/visualdl/lib.py
Outdated
|
|
||
| def get_scalar(storage, mode, tag, num_records=300): | ||
| # if sample amount is negative, 0 or 1, use default | ||
| if num_records <= 1: |
Contributor
There was a problem hiding this comment.
assert num_records > 1
serious error.
server/visualdl/lib.py
Outdated
| res.append(data[id]) | ||
| return [v for v in reversed(res)] | ||
| # if sample amount is larger than actual data amount, then choose all data | ||
| if num_records > len(data): |
Contributor
There was a problem hiding this comment.
conflicts with line 45
no need to sample again.
server/visualdl/lib.py
Outdated
| span = float(len(data)) / (num_records - 1) | ||
| span_multiply = 0 | ||
|
|
||
| data_idx = int(span_multiply * span) |
Contributor
There was a problem hiding this comment.
span_multiply -> span_offset ?
server/visualdl/lib.py
Outdated
| span_multiply += 1 | ||
| data_idx = int(span_multiply * span) | ||
|
|
||
| sampled_data.append(data[-1]) |
Contributor
There was a problem hiding this comment.
sample from data[-1] to data[0], so the latest record can be taken naturally.
Superjomn
reviewed
Jan 4, 2018
server/visualdl/lib.py
Outdated
| sampled_data = [] | ||
|
|
||
| while data_idx < len(data): | ||
| sampled_data.append(data[len(data) - data_idx - 1]) |
Contributor
There was a problem hiding this comment.
len(...) will run every time in the iter
place it outside the whileloop like:
data_size = len(data)
while ...:
...
jacquesqiao
pushed a commit
to jacquesqiao/VisualDL
that referenced
this pull request
Jan 12, 2018
* optimize sampling * fix comments * len(data) only once
jacquesqiao
pushed a commit
to jacquesqiao/VisualDL
that referenced
this pull request
Jan 13, 2018
* optimize sampling * fix comments * len(data) only once
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.