Ml5-library: predict() or classify()?

Created on 8 Aug 2018  路  5Comments  路  Source: ml5js/ml5-library

In making video tutorials, I noticed that we sometimes use predict() for a classifier and sometimes classify(). For example with imageClassifier('MobileNet') it's predict() but with featureExtractor('MobileNet').classification() it's classify(). Should we use classify() everywhere it's specifically "classification" and predict() for regression and other things like PoseNet, etc. Or just stick with predict() no matter what?

API

Most helpful comment

I agree. It felt confusing when making the tutorial that it was predict() for plain MobileNet but switched to classify() when re-training. Let's switch to classify() as you suggested but preserve predict() (marking as deprecated?) for backwards compatibility until 1.0? 0.5.0?

All 5 comments

The predict() method in imageClassifier('MobileNet') was inherit from tf.js Model.predict

For featureExtractor('MobileNet') I think the choice was to make the method call explicit to what the extractor was set to do. As a classifier, it should classify() and as a regressor it should predict().

It might be confusing to have different use cases for predict(). I think we should we use classify() everywhere it's specifically "classification" and predict() for regressions.

I agree. It felt confusing when making the tutorial that it was predict() for plain MobileNet but switched to classify() when re-training. Let's switch to classify() as you suggested but preserve predict() (marking as deprecated?) for backwards compatibility until 1.0? 0.5.0?

sounds good, will work on it!

I agree. It felt confusing when making the tutorial that it was predict() for plain MobileNet but switched to classify() when re-training. Let's switch to classify() as you suggested but preserve predict() (marking as deprecated?) for backwards compatibility until 1.0? 0.5.0?

I am not able to classify the image that i draw on canvas

Hi All - I will close this issue as it seems we've begun to converge on our naming conventions. We can add additional clarifications here in our budding development guidelines -- https://github.com/ml5js/ml5-library/blob/development/docs/styleguide/development-guidelines.md

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

harshitmahendra picture harshitmahendra  路  3Comments

oveddan picture oveddan  路  9Comments

sci2lab picture sci2lab  路  5Comments

K1ngjulien picture K1ngjulien  路  6Comments

dianebecheras picture dianebecheras  路  6Comments