Git Product home page Git Product logo

Comments (8)

acikmese avatar acikmese commented on June 3, 2024 4

I would definitely not integrate jenkspy in your environment. Your library works perfectly in my tests, but jenkspy have some problematic outputs. I don't trust to outputs of jenkspy.

from mapclassify.

martinfleis avatar martinfleis commented on June 3, 2024 1

I can modify the code to add the signatures and submit a PR

That would be very welcome! Thanks!

from mapclassify.

ljwolf avatar ljwolf commented on June 3, 2024

Do you happen to have numba installed? Our FisherJenks implementation should be accelerated using that... we'd definitely invite a rigorous performance comparison there 😄

Also, the *Sampled variants are useful in extremely large data, since a random subsample of the target data can often yield the same results.

Do either of these work for your use case?

from mapclassify.

martinfleis avatar martinfleis commented on June 3, 2024

@ljwolf shall we maybe add a warning here

from numba import jit
when Numba isn't loaded?

from mapclassify.

cheginit avatar cheginit commented on June 3, 2024

Ah, I didn't notice there's numba support. I just gave it a try and compared it with jenkspy. I noticed that you're just simply using jit without type specification. So I replaced @jit with @njit("f8[:](f8[:], u2, b1)") and compared the three versions with the following data:

import jenkspy
from mapclassify.classifiers import _fisher_jenks_means
import numpy as np

data = np.random.random(12000) * 5000
data = data.astype("f8")

Here are the results.

image

from mapclassify.

cheginit avatar cheginit commented on June 3, 2024

I ran the same test using an array with 120,000 elements instead of 12,000. Here's the results:
image

BTW, I ran these tests on my iMac with 8 cores and 16 G RAM.

from mapclassify.

martinfleis avatar martinfleis commented on June 3, 2024

That is interesting!

In any case, I would rather not add jenskpy as a dependency here. We don't know how maintained it is and it may be a hassle to install. They offer wheels only for Windows and only up to Python 3.8. I assume that this could cause a lot of friction for users.

from mapclassify.

cheginit avatar cheginit commented on June 3, 2024

Right, it makes sense.

You can shave off a few more seconds by adding cache to njit like so @njit("f8[:](f8[:], u2, b1)", cache=True). Feel free to close or if interested, I can modify the code to add the signatures and submit a PR.

from mapclassify.

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.