Coder Social home page Coder Social logo

dice algorithm NaN about clj-fuzzy HOT 7 CLOSED

yomguithereal avatar yomguithereal commented on June 9, 2024
dice algorithm NaN

from clj-fuzzy.

Comments (7)

Yomguithereal avatar Yomguithereal commented on June 9, 2024

Hello @Globegitter,
Well this is rather unfortunate. I'll give it a look as soon as possible. This bugs applies to the 0.1.9 version or the 0.1.8?

For other cases, does the algorithm work correctly?

from clj-fuzzy.

Globegitter avatar Globegitter commented on June 9, 2024

@Yomguithereal It applies to both. Otherwise it seems to be working really well - thanks for the library, it is really useful.

from clj-fuzzy.

Yomguithereal avatar Yomguithereal commented on June 9, 2024

@Globegitter,
I've checked this and can affirm the bug comes from the clojure part and therefore replicates into its JavaScript counterpart.

I can fix it but I have a problem here and you might be able to help me:

The Dice coefficient works using bigrams. So, traditionnally, if you compare h and h, this will return 0, which is a total nonsense since both strings are the same.

So here is the choice I have to make:

  • Follow most of the classical mathematical implementations of the algorithm and bear that on strings with less than two characters the coefficient will produce nonsense.
  • Create a finer implementation that would deal with this edge case and return correct similarities on an intellectual level.

Any opinion?

from clj-fuzzy.

Yomguithereal avatar Yomguithereal commented on June 9, 2024

I've fixed the implementation. You can install the latest dev version with the following command for node if needed:

npm i git+https://github.com/Yomguithereal/clj-fuzzy.git

from clj-fuzzy.

Globegitter avatar Globegitter commented on June 9, 2024

Oh that is great thank you! How did you resolve it then?

from clj-fuzzy.

Yomguithereal avatar Yomguithereal commented on June 9, 2024

Second choice. I found other libraries - in python notably - that prefer to fix the rationale of the algorithm. So I went with that so now h / h --> 1.0.

from clj-fuzzy.

Globegitter avatar Globegitter commented on June 9, 2024

Awesome thank you, will test asap.

from clj-fuzzy.

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.