Skip to content
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

Handing errors #77

Closed
shiffman opened this issue Mar 1, 2018 · 3 comments
Closed

Handing errors #77

shiffman opened this issue Mar 1, 2018 · 3 comments

Comments

@shiffman
Copy link
Member

shiffman commented Mar 1, 2018

Thanks also to @dariusk I'm writing this issue to open a discussion about error handling. We should develop a plan and style guide for handling errors. At a minimum we should have custom console.logs to give users information about errors, but we should likely use some sort of try, catch, throw magic.

A good example scenario as demonstrated by @dariusk is the following:

let average = wordVectors.average(['red', 'askdjfkjalksdjf'], 1); 

Right now the error produced is a lot of NDArray garble and we should alert the user that askdjfkjalksdjf is not a word in the word2vec dictionary.

@shiffman
Copy link
Member Author

shiffman commented Mar 2, 2018

Oops, I forgot I opened #65 already! Will keep this issue in lieu of that one, but will note here that another scenario is trying to use a model before it is loaded!

@shiffman shiffman mentioned this issue Mar 2, 2018
dariusk added a commit to dariusk/ml5 that referenced this issue Mar 2, 2018
In issue ml5js#77 it's noted that Word2Vec throws an unhelpful error message
when you ask for the average of 2 words where one word isn't in the
dictionary. This can be traced to a less-than-helpful error message
thrown by `sum()`, which is called by `average()`.

This commit changes `sum()` to throw a "not found" `Error` object that
lists the words that were not found. This object propagates up to the
`average()` function.
@cvalenzuela cvalenzuela added this to the Summer milestone Apr 19, 2018
@shiffman
Copy link
Member Author

Amazing work, thank you @cvalenzuela!

joeyklee pushed a commit that referenced this issue Jun 2, 2019
In issue #77 it's noted that Word2Vec throws an unhelpful error message
when you ask for the average of 2 words where one word isn't in the
dictionary. This can be traced to a less-than-helpful error message
thrown by `sum()`, which is called by `average()`.

This commit changes `sum()` to throw a "not found" `Error` object that
lists the words that were not found. This object propagates up to the
`average()` function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants