npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@saehrimnir/druidjs

v0.7.3

Published

A JavaScript Library for Dimensionality Reduction.

Downloads

465

Readme

DruidJS — A JavaScript Library for Dimensionality Reduction.

DruidJS is a JavaScript library for dimensionality reduction. With dimesionality reduction you can project high-dimensional data to a lower dimensionality while keeping method-specific properties of the data. DruidJS makes it easy to project a dataset with the implemented dimensionality reduction methods.

Resources

@inproceedings{cutura2020druid,
  title={{DRUIDJS — A JavaScript Library for Dimensionality Reduction}},
  author={Cutura, Rene and Kralj, Christoph and Sedlmair, Michael},
  booktitle={2020 IEEE Visualization Conference (VIS)},
  pages={111--115},
  year={2020},
  organization={IEEE}
}

Installation

If you use npm, install with npm install @saehrimnir/druidjs, and use it with

import * as druid from "@saehrimnir/druidjs";

Otherwise download the files here, or use for instance unpkg this way:

<script src="https://unpkg.com/@saehrimnir/druidjs"></script>

Matrix

DruidJS uses internally the Matrix class for storing data. You can use it by creating a druid.Matrix object for instance with the function from, in example:

    import * as druid from '@saehrimnir/druidjs';

    let data = [[...], [...], ...];
    let matrix = druid.Matrix.from(data);

You can create a druid.Matrix object programmatically by:

    let fn = (row, col) => row == col ? 1 : 0;
    let matrix = new druid.Matrix(rows, columns, fn);

If rows == columns, then matrix would be a identity matrix. A shortcut for a identity matrix is:

    let matrix = new druid.Matrix(rows, columns, "I");
    // or
    let matrix = new druid.Matrix(rows, columnbs, "identity");

There are more shortcuts for creating matrices:

    let matrix = new druid.Matrix(3, 3, "zeros"); // matrix would be a 3x3 matrix with zeroes
    let matrix = new druid.Matrix(3, 3, "center"); // matrix would be a 3x3 center matrix;
    let number = 12;
    let matrix = new druid.Matrix(3, 3, number); // matrix would b a 3x3 matrix filled with 'number'

If you want to use a druid.Matrix object, for instance, with d3, you can use either the to2dArray property, the iterate_rows generator function, or just use the druid.Matrix object as an iterable (works with d3 since version 6).

    let data = await d3.csv("data.csv");
    let matrix = druid.Matrix.from(data);
    d3.selectAll("datapoints").data(matrix.to2dArray)//...
    d3.selectAll("datapoints").data(matrix.iterate_rows())//...
    d3.selectAll("datapoints").data(matrix)//...

DR methods

Transform

Example

Generator

Example

TopoMap Example

Example ...