Coder Social home page Coder Social logo

Comments (8)

ackRow avatar ackRow commented on May 11, 2024 1

I think it's a good idea too. I can try to code that and add an error message when using a Functional Model advising you to use the experimental feature.

@bml1g12 predict and predict_classes output different arrays (one the probabilities and the other the predicted label of the object to compare with the actual label) so I don't know why it works for you but I think it's not an optimal solution.

from talos.

mikkokotila avatar mikkokotila commented on May 11, 2024 1

This is now fixed in the current dev branch.

from talos.

matthewcarbone avatar matthewcarbone commented on May 11, 2024

@bml1g12 Yeah you'll get this error right now if you're not using the Sequential type model. predict_classes only works with that and doesn't work with the functional model. I think what you've done is something of a hot fix that seems to work with some cases but not others. I would be very careful to be sure that predict is doing what you want it to! Otherwise, this should be fine.

from talos.

ackRow avatar ackRow commented on May 11, 2024

I was trying to use talos with a Keras Functional Model too but surprisingly Keras didn't implemented the predict_classes function on them.

So I come up with a quick fix using argmax(self.keras_model.predict(self.x_val), axis=-1) that worked for me.
(don't forget to import argmax from numpy)

However it seems that it didn't work for everybody, resulting in weird arrays full of zeros.

I finally looked up the code of predict_classes in the Keras repo and it kind of uses argmax the way I proposed.

Therefore I'm waiting for suggestions.

from talos.

mikkokotila avatar mikkokotila commented on May 11, 2024

This is related with #39 and #42.

My suggestion is that we add an option for those that want to use the above under a parameter experimental_functional_support=True for Scan() which simply uses the above instead of the one that is being used otherwise. We need to keep in mind it's not tested (as in #42 it becomes apparent how this might not work for all cases).

@x94carbone @ackRow what do you think about this approach?

from talos.

matthewcarbone avatar matthewcarbone commented on May 11, 2024

I think this is ok. Sort of a use-at-your-own-risk kind of option. It weird because I see all over the internet people recommending this fix, but it seems for certain kinds of data input it totally breaks everything.

It is kinda crazy that Keras hasn't addressed this issue by now if you ask me.

from talos.

bml1g12 avatar bml1g12 commented on May 11, 2024

y_pred = self.keras_model.predict(self.x_val) seems to be working for me (I ran a keras run with optimal parameters selected by Talos, and got similar results between the two) .

from talos.

mikkokotila avatar mikkokotila commented on May 11, 2024

@ackRow that's great, thanks so much. At the moment there are 4 live issues related with this, so it seems like high value target :)

from talos.

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.