-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add SequenceExample viewing support to What-If Tool #1513
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
Conversation
|
For #1502 |
| padding-top: 10px; | ||
| } | ||
| .multi-class-checkbox { | ||
| .checkbox { |
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.
nit: you can just use paper-checkbox probably
| }, | ||
|
|
||
| makeAsyncRequest_: function(url, thenDoFn, postData){ | ||
| var self = this; |
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.
Using arrow function, now, you don't need this self
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.
done
| this.requestManager.request(url, postData).then(wrapperFn); | ||
| this.requestManager.request(url, postData).then(wrapperFn) | ||
| .catch(reason => { | ||
| this.exampleStatusStr = 'Request failed' |
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.
nit: add semi-colon at the end for consistency
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.
done
| v = v[0]; | ||
| // For numeric feature values, convert the string to a number. | ||
| if (!isNaN(v)) { | ||
| v = Number(v); |
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.
> isNaN('a')
< true
> Number('a')
< NaN
I believe it is more kosher to use parseInt(str, 10) to cast string to number.
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.
I don't want to just cast ints, must handle floats too
| } | ||
| }); | ||
| } | ||
| if (v) { |
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.
For easier readability, can you use a separate and descriptive variable name for v? Reading between lines, it seems like v up to this line is regarded as string (or null) and we are returning oneOf [null, NaN, number, string] (string in case squeeze == false)
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.
clarified with vars valueList and singleValue
| // Extract the standard features from examples or context features from | ||
| // sequence examples. | ||
| const featureRoot = example.features || example.context; | ||
| const features = 'features' in example ? |
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.
You may need to update this condition
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.
good catch
| value="{{examplesPath}}" class="flex-grow"> | ||
| </paper-input> | ||
| <paper-checkbox checked="{{sequenceExamples}}" class="checkbox"> | ||
| SequenceExamples |
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.
would you want a whitespace between two words instead of CamelCase?
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.
I used camel case since SequenceExample is the proto message name that this checkbox is for.
| examples = [] | ||
| updated_example_indices = set() | ||
| sprite = None | ||
| example_class = tf.train.Example |
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.
Unsure but first character of the class name may need to be capitalized instead of snake_case
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.
Seems like a conflict between style for member variables (snake) and class names (CamelCase), of which this is both. Will keep as this to make it clear its a member variable, since the name documents that it is a class, if that is ok
With this change, WIT can display sequence examples, but it still cannot use them for inference in models, as the Classification and Regression APIs do not support them. Will unlock their use in models in future PRs.