https://github.com/paulwilcox/fluent-data

Manipulate datasets by chaining methods. Includes capacity to map, filter, sort, group, reduce, and merge data. Built in reducers include multiple regression.

https://github.com/paulwilcox/fluent-data

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.6%) to scientific vocabulary

Keywords

aggregation dataset fold javascript join merge reducer regression sorting statistics
Last synced: 5 months ago · JSON representation

Repository

Manipulate datasets by chaining methods. Includes capacity to map, filter, sort, group, reduce, and merge data. Built in reducers include multiple regression.

Basic Info
  • Host: GitHub
  • Owner: paulwilcox
  • License: isc
  • Language: JavaScript
  • Default Branch: master
  • Homepage:
  • Size: 909 KB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 1
  • Releases: 0
Topics
aggregation dataset fold javascript join merge reducer regression sorting statistics
Created about 7 years ago · Last pushed almost 3 years ago
Metadata Files
Readme License

readMe.md

See the Video Series Here

Summary

This library allows you to work with data structured as a table or as a matrix and provides you with many of the methods you would expect when working with such things. It also provides various convenience and statistical functions.

A dataset represents a collection of object-rows. Among other capacities, here you have the ability to map, filter, sort, group, reduce, and join. These methods can seem similar to those found on Array. However, they are designed to work with objects as rows. Furthermore, some SQL-like capacity (e.g. left join, exists) and deeper statistics (e.g. multiple regression) are available that you just cannot get in vanilla javacript.

A matrix is a rectangular collection of numbers on which particular mathematical operations are defined. This library offers many of the expected operations of matrix algebra. This includes matrix multiplication, addition, various methods of 'apply' functionality, varous decompositions, pseudoinvering, and production of eigen values and vectors.

Click on the links below to see more information in each area:

Getting Started

To install:

npm install fluent-data

To import:

// client
import $$ from './node_modules/fluent-data/dist/fluent-data.client.js';

// server
let $$ = require('fluent-data');

// but the examples in this documentation will use
let $$ = require('./dist/fluent-data.server.js');

Dataset Example:

Consider the following arrays:

let customers = [
    { id: 1, name: 'Alice' },
    { id: 2, name: 'Benny' } 
];

let purchases = [
    { customer: 2, speed: 15, rating: 50, storeId: 1 },
    { customer: 1, speed: 5, rating: 90, storeId: 1 },
    { customer: 1, speed: 7, rating: 55, storeId: 1 },
    { customer: 2, speed: 6, rating: 88, storeId: 1 },
    { customer: 1, speed: 25, rating: 35, storeId: 1 },
    { customer: 1, speed: 40, rating: 2, storeId: 3, closed: true },
    { customer: 2, speed: 4, rating: 88, storeId: 1 },
    { customer: 1, speed: 1, rating: 96, storeId: 2 },
    { customer: 1, speed: 2, rating: 94, storeId: 2 },
    { customer: 1, speed: 1, rating: 94, storeId: 2 }
];

[--]: # ()

The following example converts the to dataset and uses many of the methods available.

let $$ = require('./dist/fluent-data.server.js');

$$(purchases)
    .filter(p => !p.closed)
    .joinLeft(customers, (p,c) => p.customer == c.id) 
    .group(p => [p.customer, p.storeId]) 
    .reduce({
        customer: $$.first(p => p.name),
        store: $$.first(p => p.storeId),
        orders: $$.count(p => p.id), 
        speed: $$.avg(p => p.speed),
        rating: $$.avg(p => p.rating),
        correlation: $$.cor(p => [p.speed, p.rating]) 
        // other reducers, such as multiple regression, are built in!
    })
    .sort(p => [p.customer, -p.rating]) 
    .log(null, 'purchases:', 
        p => $$.round({ ...p, orders: undefined}, 1e-3)
    );

// use 'get' as opposed to 'log' to assign to a variable

[--]: # ()

This results in three rows for analysis:

purchases:
┌──────────┬───────┬────────┬────────┬─────────────┐
│ customer │ store │ speed  │ rating │ correlation │
├──────────┼───────┼────────┼────────┼─────────────┤
│ Alice    │ 2     │ 1.333  │ 94.667 │ -0.5        │
│ Alice    │ 1     │ 12.333 │ 60     │ -0.832      │
│ Benny    │ 1     │ 8.333  │ 75.333 │ -0.985      │
└──────────┴───────┴────────┴────────┴─────────────┘

[--]: # ()

Matrix Example:

Consider the following arrays, converted to matricies:

let $$ = require('./dist/fluent-data.server.js');

let community = $$([
    { marker: 'Applewood Park', x: 0, y: 0 },
    { marker: 'Orangewood School', x: 10, y: 0},
    { marker: 'Kiwitown Market', x: 1, y: 10 },
    { marker: `The Millers`, x: -5, y: 0 },
    { marker: 'The Romeros', x: 0, y: -5 },
    { marker: 'The Lees', x: 5, y: 5 },
    { marker: 'The Keitas', x: 5, y: 0 },
    { marker: 'The Lebedevs', x: 15, y: 5 }
]).matrix('x, y', 'marker');

let transformer = new $$.matrix([
    [ 1, 0.4 ],
    [ 0, Math.pow(3,0.5) / 2 ]
]);

[--]: # ()

The following exmaple transforms the community data so that the new positions of the park, school, and market form an equilateral triangle. Then it analyzes the eigen properties of the transformer matrix.

let eigen = transformer.eigen();

community
    .transform(transformer)
    .log(null, 'Equilateralized Community:', 1e-8);

console.log('\nTransformer Eigenvalues:', eigen.values);

eigen.vectors.log(null, '\nTransformer Eigenvectors:', 1e-8); 

[--]: # ()

Equilateralized Community:
┌───────────────────┬────┬─────────────┐
│                   │ x  │ y           │
├───────────────────┼────┼─────────────┤
│ Applewood Park    │ 0  │ 0           │
│ Orangewood School │ 10 │ 0           │
│ Kiwitown Market   │ 5  │ 8.66025404  │
│ The Millers       │ -5 │ 0           │
│ The Romeros       │ -2 │ -4.33012702 │
│ The Lees          │ 7  │ 4.33012702  │
│ The Keitas        │ 5  │ 0           │
│ The Lebedevs      │ 17 │ 4.33012702  │
└───────────────────┴────┴─────────────┘

Transformer Eigenvalues: [ 1, 0.8660254 ]

Transformer Eigenvectors:
┌────┬────┬─────────────┐
│    │ c0 │ c1          │
├────┼────┼─────────────┤
│ r0 │ 1  │ -0.94822626 │
│ r1 │ 0  │ 0.31759558  │
└────┴────┴─────────────┘

[--]: # ()

Owner

  • Login: paulwilcox
  • Kind: user

GitHub Events

Total
Last Year

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 728
  • Total Committers: 2
  • Avg Commits per committer: 364.0
  • Development Distribution Score (DDS): 0.003
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
paulwilcox t****8@g****m 726
paulwilcox p****x@g****g 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 month
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.67
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 3
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • dependabot[bot] (3)
Top Labels
Issue Labels
Pull Request Labels
dependencies (3)

Packages

  • Total packages: 1
  • Total downloads:
    • npm 46 last-month
  • Total dependent packages: 3
  • Total dependent repositories: 1
  • Total versions: 16
  • Total maintainers: 1
npmjs.org: fluent-data

Work with tables and matricies in fluent fashion within javascript.

  • Versions: 16
  • Dependent Packages: 3
  • Dependent Repositories: 1
  • Downloads: 46 Last month
Rankings
Dependent packages count: 5.9%
Dependent repos count: 10.3%
Average: 11.8%
Downloads: 13.0%
Stargazers count: 14.5%
Forks count: 15.4%
Maintainers (1)
Last synced: 6 months ago

Dependencies

package-lock.json npm
  • array-find-index 1.0.2 development
  • balanced-match 1.0.2 development
  • bl 2.2.1 development
  • brace-expansion 1.1.11 development
  • bson 1.1.6 development
  • commenting 1.1.0 development
  • concat-map 0.0.1 development
  • core-util-is 1.0.2 development
  • denque 1.5.0 development
  • fs.realpath 1.0.0 development
  • fsevents 2.3.2 development
  • glob 7.2.0 development
  • inflight 1.0.6 development
  • inherits 2.0.3 development
  • isarray 1.0.0 development
  • lodash 4.17.21 development
  • magic-string 0.26.1 development
  • memory-pager 1.5.0 development
  • minimatch 3.1.2 development
  • mkdirp 1.0.4 development
  • moment 2.29.2 development
  • mongodb 3.6.9 development
  • once 1.4.0 development
  • optional-require 1.0.3 development
  • package-name-regex 2.0.6 development
  • path-is-absolute 1.0.1 development
  • process-nextick-args 2.0.1 development
  • readable-stream 2.3.7 development
  • rollup 2.52.7 development
  • rollup-plugin-license 2.7.0 development
  • safe-buffer 5.1.2 development
  • safe-buffer 5.2.1 development
  • sampledb 0.0.11 development
  • saslprep 1.0.3 development
  • sourcemap-codec 1.4.8 development
  • sparse-bitfield 3.0.3 development
  • spdx-compare 1.0.0 development
  • spdx-exceptions 2.3.0 development
  • spdx-expression-parse 3.0.1 development
  • spdx-expression-validate 2.0.0 development
  • spdx-license-ids 3.0.9 development
  • spdx-ranges 2.1.1 development
  • spdx-satisfies 5.0.1 development
  • string_decoder 1.1.1 development
  • util-deprecate 1.0.2 development
  • wrappy 1.0.2 development
package.json npm
  • rollup-plugin-license ^2.7.0 development
  • sampledb 0.0.11 development