Giter Club home page Giter Club logo

Comments (9)

lindahua avatar lindahua commented on June 12, 2024

I believe this is a very basic device that is useful out of this package. For example, it may also be useful in constructing contingency tables (see JuliaStats/StatsKit.jl#32).

What about we implement this in Stats.jl and thus provide such support to other packages that may also want it?

from dataarrays.jl.

johnmyleswhite avatar johnmyleswhite commented on June 12, 2024

That works for me. What interface will we be using? Something like `levelsmap(["a", "b", "A", "A"]) -> ["a" => 1, "b" => 2, "A" => 3]?

from dataarrays.jl.

lindahua avatar lindahua commented on June 12, 2024

FWIW, there's already indexmap in Stats.jl. (see https://github.com/JuliaStats/Stats.jl#miscelleneous-functions)

from dataarrays.jl.

johnmyleswhite avatar johnmyleswhite commented on June 12, 2024

We don't want to use that as our canonical numbering, right? That could produce numbers that are spaced very unevenly.

from dataarrays.jl.

lindahua avatar lindahua commented on June 12, 2024

Oh, yes ... we can then add a levelmap method for this?

from dataarrays.jl.

johnmyleswhite avatar johnmyleswhite commented on June 12, 2024

That seems right to me. Should I submit a PR to discuss implementation details?

from dataarrays.jl.

lindahua avatar lindahua commented on June 12, 2024

Sure.

from dataarrays.jl.

lindahua avatar lindahua commented on June 12, 2024

Think about it more. Probably, we may want a data structure that maintain cross-reference between levels & indexes.

Something along this line?

immutable LevelMap{T}
    levels::Vector{T}   # index -> level
    indmap::Dict{T, Int}   # level -> index
end

with some functions to make doing the translation convenient.

from dataarrays.jl.

johnmyleswhite avatar johnmyleswhite commented on June 12, 2024

Not sure. For involved indexing operations, it seems like you'd want to maintain all of the indices for each level since that would make it much easier to repeat the levels calculation on subsets of the data.

from dataarrays.jl.

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.