项目作者: saehm

项目描述 :
A JavaScript Library for Dimensionality Reduction
高级语言: HTML
项目地址: git://github.com/saehm/DruidJS.git
创建时间: 2019-08-27T11:37:10Z
项目社区:https://github.com/saehm/DruidJS

开源协议:

下载


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

  1. @inproceedings{cutura2020druid,
  2. title={{DRUIDJS A JavaScript Library for Dimensionality Reduction}},
  3. author={Cutura, Rene and Kralj, Christoph and Sedlmair, Michael},
  4. booktitle={2020 IEEE Visualization Conference (VIS)},
  5. pages={111--115},
  6. year={2020},
  7. organization={IEEE}
  8. }

Installation

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

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

Otherwise download the files here, or use for instance @saehrimnir/druidjs">unpkg this way:

  1. <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:

  1. import * as druid from '@saehrimnir/druidjs';
  2. let data = [[...], [...], ...];
  3. let matrix = druid.Matrix.from(data);

You can create a druid.Matrix object programmatically by:

  1. let fn = (row, col) => row == col ? 1 : 0;
  2. 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:

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

There are more shortcuts for creating matrices:

  1. let matrix = new druid.Matrix(3, 3, "zeros"); // matrix would be a 3x3 matrix with zeroes
  2. let matrix = new druid.Matrix(3, 3, "center"); // matrix would be a 3x3 center matrix;
  3. let number = 12;
  4. 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).

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

DR methods

Transform

@saehrimnir/hello-druidjs">Example

Generator

@saehrimnir/hello-druidjs/2">Example

TopoMap Example

@saehrimnir/topomap">Example