ml-dataset-metadata

0.3.0 • Public • Published

dataset-metadata

NPM version build status Test coverage David deps npm download

a class to manipulate metadata for statistical analysis

Installation

$ npm i dataset-metadata

API Documentation

Examples

to import the package use

const METADATA = require('dataset-metadata');

or

import { METADATA } from 'ml-dataset-metadata';

to create a metadata object use

import { getClasses } from 'ml-dataset-iris';
const metadata = getClasses();
let L = new METADATA([metadata], { headers: ['iris'] });

this will create an array with the class of the famous iris dataset and create a METADATA object L.

List all the available metadata

L.list()

returns an array with all the metadata headers.

Retrieve information (number of classes, counts for each classes) about a particular metadata using

L.get('iris');

Retrieve values of a particular metadata as a Matrix object. This will coerce any string class into a Matrix of number with first class being "0", second being "1", etc.

L.get('iris', { format: 'matrix' }).values

For supervised method it is usual to sample a class to get a training set and a test set.

L.sample('iris')

returns an object with four arrays: trainIndex, testIndex, mask (a boolean filter), and classVector (the original class).

To append another metadata.

let newMetadata = metadata;
L.append(NewMetadata, 'column', { header: 'duplicated' });

To remove the duplicated metadata.

L.remove('duplicated', 'column');

Import and export METADATA object.

let L = new METADATA([metadata], { headers: ['iris'] });
    L = JSON.stringify(L.toJSON());
    let newL = METADATA.load(JSON.parse(L));

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i ml-dataset-metadata

Weekly Downloads

5

Version

0.3.0

License

MIT

Unpacked Size

95.6 kB

Total Files

7

Last publish

Collaborators

  • jwist