Coder Social home page Coder Social logo

Comments (9)

cnuernber avatar cnuernber commented on May 24, 2024 1

It does - due to previous bugs it uses a linked hash map.

from tech.ml.dataset.

harold avatar harold commented on May 24, 2024

Which bugs? Why is it better this way?

from tech.ml.dataset.

cnuernber avatar cnuernber commented on May 24, 2024

Specifically you use a linked hash map when you care about order of insertion or modification there was an issue around group-by-column I think but I can't find it. There is an expectation among people coming from R that the order of the returned map matches the order the data was found in the original column.

We don't respect this for group-by-column-agg as there we use the concurrent hashmap but for the non-massive cases of group-by I tried to respect this ordering.

from tech.ml.dataset.

harold avatar harold commented on May 24, 2024

oic, that's cool and makes sense - I wonder if it would be possible 🍰 to have cake and also eat it by using a Clojure sorted-map? --- this situation was very confusing yesterday because CSV import helpfully made a column integers (nice, saves ram!) but then after group-by-column->indexes another source of the same numbers must have been Longs, and so every lookup was returning nil.

from tech.ml.dataset.

cnuernber avatar cnuernber commented on May 24, 2024

Linked is not same as sorted - linked is insertion order so order of the column data.

The map itself should have had longs in it regardless - are you saying the keys in the group-by-column->indexes were integers? Regardless that sounds like a lot of pain. We should file a small repro of that because it is annoying. I am working on a linked hash map in hamf to address this which will use the normal equiv pathways.

Unequivically it is fairly wrong but it is extremely wrong if the map keys aren't longs.

from tech.ml.dataset.

cnuernber avatar cnuernber commented on May 24, 2024

The big change is in hamf

from tech.ml.dataset.

harold avatar harold commented on May 24, 2024

Linked is not same as sorted - linked is insertion order so order of the column data.

Got it! I was thinking of it wrong.

are you saying the keys in the group-by-column->indexes were integers?

Ah, no, sorry for the confusion, the keys in the lookup map (result of group-by-column->indexes) were longs, but the column values they were derived from were int32.

So, when the ints in the column were used to lookup from the map key'd by longs, it failed.

We should file a small repro of that because it is annoying.

Here's a minimal case - the real case, in the annealer, was more delicate and convoluted, as you can imagine

However, this demonstrates the unexpected nil.

repl'ing this stuff is 🎲 actually dicey, because Integers print as things that read as Longs - so it's very easy to get confused.

user> (require '[tech.v3.dataset :as ds])
nil
user> (spit "tmp.csv" "a\n111111\n2222222\n333333\n")
nil
user> (def ds (ds/->dataset "tmp.csv"))
#'user/ds
user> (get ds "a")
#tech.v3.dataset.column<int32>[3]
a
[111111, 2222222, 333333]
user> (def lookup (ds/group-by-column->indexes ds "a"))
#'user/lookup
user> (def v (first (int-array (get ds "a"))))
#'user/v
user> v
111111
user> (get lookup v)
nil
user> (get lookup 111111)
[0]

from tech.ml.dataset.

cnuernber avatar cnuernber commented on May 24, 2024

The bigger question to me is when will we find the first subtle issues with the linkedhashmap implementation...

from tech.ml.dataset.

harold avatar harold commented on May 24, 2024

when will we find the first subtle issues with the linkedhashmap implementation...

With a sufficently royal interpretation of the 'we' in this question, the answer becomes "in due time" (:

New tests look cool and relevant, I look forward to upgrading and taking out some of the hacks (into {} ...) I've put in place.

from tech.ml.dataset.

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.