Skip to content

Conversation

@jameswex
Copy link
Contributor

@jameswex jameswex commented Oct 12, 2018

  • Added checkbox in WIT loader to specify if examples are sequence examples
  • Added URL params for checkboxes in WIT loader, matching other settings
  • Correctly load and update SequenceExamples in python code
  • Correctly parse and display SequenceExamples in javascript code
  • Also updated inference display logic to not fail when ground truth label feature is missing

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.

@jameswex
Copy link
Contributor Author

For #1502

@jameswex jameswex requested a review from nfelt October 12, 2018 15:25
@jameswex jameswex requested a review from stephanwlee October 15, 2018 15:59
padding-top: 10px;
}
.multi-class-checkbox {
.checkbox {
Copy link
Contributor

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;
Copy link
Contributor

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

Copy link
Contributor Author

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'
Copy link
Contributor

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

Copy link
Contributor Author

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

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)

Copy link
Contributor Author

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 ?
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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

@jameswex jameswex merged commit f58f7fe into tensorflow:master Oct 15, 2018
@jameswex jameswex deleted the seq branch October 15, 2018 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants