Function
Static Public Summary | ||
public |
assocationRuleLearning(transactions: Array, options: Object): Object returns association rule learning results |
|
public |
getTransactions(data: Array, options: Object): Object Formats an array of transactions into a sparse matrix like format for Apriori/Eclat |
|
public |
async loadCSV(filepath: string, options: Object): Object[] Asynchronously loads a CSV from either a filepath or remote URL and returns an array of objects |
|
public |
async loadCSVURI(filepath: string, options: Object): Object[] Asynchronously loads a CSV from a remote URL and returns an array of objects |
|
public |
async loadTSV(filepath: string, options: Object): Object[] Asynchronously loads a TSV from either a filepath or remote URL and returns an array of objects |
Static Public
public assocationRuleLearning(transactions: Array, options: Object): Object source
import {assocationRuleLearning} from 'modelscript/src/calc.mjs'
returns association rule learning results
Params:
Name | Type | Attribute | Description |
transactions | Array | sparse matrix of transactions |
|
options | Object | ||
options.support | Number |
|
support level |
options.minLength | Number |
|
minimum assocation array size |
options.summary | Boolean |
|
return summarized results |
options.valuesMap | Map |
|
map of values and labels (used for summary results) |
Return:
Object | Returns the result from Node-FPGrowth or a summary of support and strong associations |
See:
- https://github.com/alexisfacques/Node-FPGrowth
public getTransactions(data: Array, options: Object): Object source
import {getTransactions} from 'modelscript/src/calc.mjs'
Formats an array of transactions into a sparse matrix like format for Apriori/Eclat
Params:
Name | Type | Attribute | Description |
data | Array | CSV data of transactions |
|
options | Object | ||
options.exludeEmptyTranscations | Boolean |
|
exclude empty rows of transactions |
Return:
Object | {values - unique list of all values, valuesMap - map of values and labels, transactions - formatted sparse array} |
See:
- https://github.com/alexisfacques/Node-FPGrowth
public async loadCSV(filepath: string, options: Object): Object[] source
import {loadCSV} from 'modelscript/src/csv.mjs'
Asynchronously loads a CSV from either a filepath or remote URL and returns an array of objects
Params:
Name | Type | Attribute | Description |
filepath | string | URL to CSV path |
|
options | Object |
|
options passed to csvtojson |
Return:
Object[] | returns an array of objects from a csv where each column header is the property name |
Example:
// returns [{header:value,header2:value2}]
loadCSV('../mock/invalid-file.csv').then(csvData).catch(console.error)
public async loadCSVURI(filepath: string, options: Object): Object[] source
import {loadCSVURI} from 'modelscript/src/csv.mjs'
Asynchronously loads a CSV from a remote URL and returns an array of objects
Params:
Name | Type | Attribute | Description |
filepath | string | URL to CSV path |
|
options | Object |
|
options passed to csvtojson |
Return:
Object[] | returns an array of objects from a csv where each column header is the property name |
Example:
// returns [{header:value,header2:value2}]
loadCSVURI('https://raw.githubusercontent.com/repetere/modelscript/master/test/mock/data.csv').then(csvData).catch(console.error)
public async loadTSV(filepath: string, options: Object): Object[] source
import {loadTSV} from 'modelscript/src/csv.mjs'
Asynchronously loads a TSV from either a filepath or remote URL and returns an array of objects
Params:
Name | Type | Attribute | Description |
filepath | string | URL to CSV path |
|
options | Object |
|
options passed to csvtojson |
Return:
Object[] | returns an array of objects from a csv where each column header is the property name |
Example:
// returns [{header:value,header2:value2}]
loadCSV('../mock/invalid-file.tsv').then(csvData).catch(console.error)