Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ricky Reusser
    @rreusser
    but basically that it doesn't change storage but instead affects only how you interpret the data?
    Athan
    @kgryte
    Yes, that is correct.
    Ricky Reusser
    @rreusser
    that makes sense. if i'm being honest, it seems logically consistent and defensible but a bit counterintuitive that the convenience interface doesn't do what I (to pick one biased sample) would expect, which is to treat an array of arrays (which I'd assume is primarily a friendly convenience interface in the first place) as a list of columns when you specify the input is column-major
    or maybe it's a tension between the technical and english-language meaning of "column major"
    Athan
    @kgryte
    I think maybe the ambiguity is more apparent when providing a square matrix based on nested arrays, say, 3x3. If you specify the order as column-major, does that mean the data is already in column-major order? or does it mean that we should copy elements around to be localized in memory according to column-major order? Not clear to me which we should choose without the user providing additional info, etc, because two different users could each want different things.
    The current behavior simply assumes that a user is a bit more “expert” in having already constructed nested arrays to generate the desired linear layout and then just tells us the order in order to ensure proper data access.
    Ricky Reusser
    @rreusser
    I worded it in my head as: "here is input. by "column major" I mean that I am specifying it by walking down a column first
    yeah. to be honest it's probably best to deemphasize the feature for general usage and perhaps really provide in the docs an example like this where it will bite you
    a related question: I was adapting mikola's fft module to work with @stdlib/ndarray
    Athan
    @kgryte
    Yeah, I get that. But that basically means we need to hop around in the nested arrays and do a manual copy to ensure the right layout.
    Re: docs. Agreed.
    Ricky Reusser
    @rreusser
    if I were to write a module that uses ndarrays, how do I need to handle row vs. column major data?
    are my choices to either
    1. use getters/setters everywhere
    2. implement support for row and column major separately
    Athan
    @kgryte
    I would just use the getter/setter APIs.
    Ricky Reusser
    @rreusser
    I haven't benchmarked this, but past benchmarking has made me doubt JS engine's ability to inline things like this
    specifically, I'd expect a non-negligible performance hit from some combination of 1) executing get/set via callbacks, and 2) bounds-checking every access in inner loops
    Athan
    @kgryte

    Re: 2. The lower-level API (i.e., base) does not do bounds checking.

    Re: 1. This should get inlined in modern engines. https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/ndarray/base/ctor/lib/compile_get.js

    Ricky Reusser
    @rreusser
    (anecdotally, I measured a 25x speedup on a task similar to computing the surface area of a mesh by inlining dot and cross products and similar operations rather than leaning on gl-matrix for everything)
    That should be readily inlined.
    Ricky Reusser
    @rreusser
    got it, thanks. I'll benchmark this once I get it working
    Athan
    @kgryte
    …but we’d need to use an updated version of something like IRHydra to be sure.
    Ricky Reusser
    @rreusser
    last time I benchmarked it was probably a year and a half ago. I was rather disappointed.
    Athan
    @kgryte
    I’d be surprised if modern compilers did not inline the getter.
    If getters and setters are not compiled, I can imagine that non-compiled getters/setters would be harder to inline. https://github.com/stdlib-js/stdlib/blob/65a0057aca6be5022275ae740c113376d73fd3e7/lib/node_modules/%40stdlib/ndarray/base/ctor/lib/get.js
    Ricky Reusser
    @rreusser
    anyway, thanks. I'll give this a try when i get there.
    Athan
    @kgryte
    Awesome. Thanks for raising this issue!
    Athan
    @kgryte

    @rreusser For reference, you can find getter/setter benchmarks here: https://github.com/stdlib-js/stdlib/blob/8c3884542fd9b04dfc82ca8a12260e783cf70e96/lib/node_modules/%40stdlib/ndarray/base/ctor/benchmark/benchmark.js#L833

    Inlined benchmarks are not included, but could be.

    Athan
    @kgryte

    Heads-up for all those working on stdlib development atm. Currently a bug in one of our dev dependencies that is causing Markdown linting and example execution to fail. (see unifiedjs/unified-engine#41)

    Until this is resolved, if you are committing Markdown files, you’ll need to use the —no-verify Git command-line flag.

    Terence Yang
    @Tranced
    Just wanted to tackle the issues surrounding the mathematical functions (sec, cosc ect). Can't wait to tackle those in the next few days. Thought I should ping here instead of replying on 13 different issues.
    Athan
    @kgryte
    @Tranced That’s awesome! Thanks!
    Athan
    @kgryte
    @Tranced After submitting a PR for sec, just comment on the next RFC you want to resolve, and we’ll iterate from there. :)
    Gabriel Dodan
    @gabrieldodan_twitter
    Hi, is there support for kernel regression https://en.wikipedia.org/wiki/Kernel_regression ?
    i have searched in the documentation but havn't found anything related to kernel regression
    thanks!
    Philipp Burckhardt
    @Planeshifter
    @gabrieldodan_twitter Currently, we do not have kernel regression inside of stdlib. I worked on it in the past (https://github.com/Planeshifter/kernel-smooth), and could prioritize bringing this functionality into stdlib. May I ask you about the timeline when you would need to have a kernel regression package available?
    broskees
    @broskees

    Hey guys. Just checking out the library for the first time, and trying to see it's viability for my project.
    The code below was written in python with numpy.
    How would I achieve the node - stdlib equivalent of it?

    import numpy as np
    
    # bc.encode(pair) returns two vectors
    # e.g. "hello world" to [0.1, 0.3, 0.9] "Lorem ipsum" to [0.4, 0.8, 0.6]
    def scoring(pair):
        import math
        query_vec_1, query_vec_2 = bc.encode(pair)
        cosine = np.dot(query_vec_1, query_vec_2) / (np.linalg.norm(query_vec_1) * np.linalg.norm(query_vec_2))
        return 1/(1 + math.exp(-100*(cosine - 0.95)))

    Forgive me if this is the wrong place to ask this.

    Ryan Seal
    @rseal_gitlab
    @kgryte - I see you made a lot of RFC issues for the BLAS level 1 routines. Sorry I've been out of touch for the last 6 months. I've finally finished the snrm2 implementation. Do you want me to keep working on the BLAS routines or are you working on them yourself?
    Athan
    @kgryte
    No worries! I’d love some help! We’d just need to make sure we divvy up the tasks so we don’t duplicate each other’s work! Feel free to submit the snrm2 PR and we can go from there. 😃
    Athan
    @kgryte
    @rseal_gitlab Reviewed your PR!
    Ryan Seal
    @rseal_gitlab
    Awesome, I'll take a look today and fix everything up. Then I'll move on to dnrm2
    Athan
    @kgryte
    @rseal_gitlab If you haven’t already started drnm2, you think you’d be interested in working on srotg: stdlib-js/stdlib#280 ?
    I can do dnrm2 on my end along with the generic implementation.
    Ryan Seal
    @rseal_gitlab
    Okay, sounds good, I'll work on srotg this week
    Athan
    @kgryte
    Awesome! Thanks!
    Athan
    @kgryte
    @broskees Just looking back through the message log and saw your message! Sorry for the late reply. With stdlib, we don’t have an equivalent to the Bert Client (i.e., bc.encode), but, provided you have the encodings, you can, if using the latest develop, use @stdlib/blas/base/ddot and @stdlib/blas/base/dnrm2 to compute the dot product and Euclidean distances.
    tourman
    @tourman
    Hi there. Assume I have a tabulated data, which I want to use to generate mean and standard deviation, which in turn should be used to generated random data later. So is there a tool to get both mu and sigma from the data-set? Thanks in advance.
    Athan
    @kgryte

    @tourman There are iterator utilities which should allow you to compute the desired quantities: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/iter

    For example,

    $ npm install @stdlib/stdlib

    and then in your project

    // Load stdlib modules:
    var array2iterator = require( ‘@stdlib/array/to-iterator’ );
    var mean = require( ‘@stdlib/stats/iter/mean’ );
    var stdev = require( ‘@stdlib/stats/iter/stdev’ );
    
    // Load your tabulated data…
    
    // Convert your tabulated data to arrays…
    
    // Convert the array(s) to iterator(s):
    var it = array2iterator( x );
    
    // Compute the quantities:
    var mu = mean( it );
    var sigma = stdev( it );
    Once you have computed the quantities, you can use one of the PRNGs in stdlib to generate random data: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/random/base
    Hope that helps!