Giter VIP home page Giter VIP logo

Comments (4)

terrytangyuan avatar terrytangyuan commented on September 28, 2024

You can use predict_proba instead of predict to get class
probabilities.

Thanks.

On Mon, Feb 8, 2016 at 4:33 PM, michael4john [email protected]
wrote:

I'm looking at the text_classificationpy

classifierpredict(X-test) gets the class number with the highest
probability But I wonder how to get the probabilities for all the classes
per input

Thanks in advance!


Reply to this email directly or view it on GitHub
#95.

from skflow.

michael4john avatar michael4john commented on September 28, 2024

Thanks for the prompt response, @terrytangyuan . predict_proba does work, but it returns me 15 probabilities, which I think has something to do with the n_classes argument of the TensorFlowEstimator function. I changed it to 5 because I only have 5 categories to predict, but the following error message is returned:

Traceback (most recent call last):
File "search_classification.py", line 88, in
classifier.fit(X_train, y_train, logdir='/tmp/tf_examples/word_rnn')
File "/home/fz1662/skflow/estimators/base.py", line 214, in fit
feed_params_fn=self._data_feeder.get_feed_params)
File "/home/fz1662/skflow/trainer.py", line 143, in train
feed_dict = feed_dict_fn()
File "/home/fz1662/skflow/io/data_feeder.py", line 212, in _feed_dict_fn
out.itemset((i, self.y[sample]), 1.0)
IndexError: index 5 is out of bounds for axis 1 with size 5

from skflow.

ilblackdragon avatar ilblackdragon commented on September 28, 2024

@michael4john If you are only have 5 classes then this errors indicates that you are using 1-based identification for them. You should make sure your classes are all indexes from 0 to n_classes - 1.

Note, you can always use some of skflow.preprocessing.CategoricalProcessor functionality to remap output classes into 0 to 4.

from skflow.

michael4john avatar michael4john commented on September 28, 2024

@ilblackdragon I reindexed my dataset from 0 to 4. And it works! Thank you so much!

from skflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.