Giter Site home page Giter Site logo

Comments (7)

erikerlandson avatar erikerlandson commented on June 7, 2024 1

I added #25 and published it as 0.5.2, thanks!

from isarn-sketches-spark.

JonathanTaws avatar JonathanTaws commented on June 7, 2024

I think this also causes an issue with Spark broadcasting feature.

from random import gauss, randint
from isarnproject.sketches.spark.tdigest import *
data = spark.createDataFrame([[randint(1,10),gauss(0,1)] for x in range(1000)])
udf1 = tdigestIntUDF("_1", maxDiscrete = 25)
udf2 = tdigestDoubleUDF("_2", compression = 0.5)
agg = data.agg(udf1, udf2).first()

td = agg[0]

td_broadcast = spark.sparkContext.broadcast(td)
td_broadcast.value

Results in:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/spark/python/pyspark/broadcast.py", line 146, in value
    self._value = self.load_from_path(self._path)
  File "/usr/lib/spark/python/pyspark/broadcast.py", line 123, in load_from_path
    return self.load(f)
  File "/usr/lib/spark/python/pyspark/broadcast.py", line 129, in load
    return pickle.load(file)
TypeError: __init__() takes 5 positional arguments but 6 were given

from isarn-sketches-spark.

erikerlandson avatar erikerlandson commented on June 7, 2024

interesting, I'm sure I can make it conform to a parsable constructor expression

from isarn-sketches-spark.

JonathanTaws avatar JonathanTaws commented on June 7, 2024

interesting, I'm sure I can make it conform to a parsable constructor expression

I believe removing the nclusters from the __repr__ would achieve this:

def __repr__(self): 
     return "TDigest(%s, %s, %s, %s)" % \ 
         (repr(self.compression), repr(self.maxDiscrete), repr(self._cent), repr(self._mass)) 

from isarn-sketches-spark.

erikerlandson avatar erikerlandson commented on June 7, 2024

Closing with #23 - thanks @JonathanTaws !

from isarn-sketches-spark.

JonathanTaws avatar JonathanTaws commented on June 7, 2024

While testing with the new release, I found that it's still not working with the __repr__ change - __reduce__ also needs to be updated. I submitted a new PR here: #25. Sorry for not testing this thoroughly!

from isarn-sketches-spark.

JonathanTaws avatar JonathanTaws commented on June 7, 2024

Thanks, all working properly now.

from isarn-sketches-spark.

Related Issues (15)

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.