Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-prib-functions

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-prib-functions - npm Package Compare versions

Comparing version 0.16.0 to 0.16.1

dataAnalysis/arrayLast.js

30

dataAnalysis/dataAnalysis.js
const logger = new (require("node-red-contrib-logger"))("Data Analysis");
logger.sendInfo("Copyright 2020 Jaroslav Peter Prib");
Object.defineProperty(Array.prototype, "last", {
value() {
return this[this.length-1];
},
writable: true,
configurable: true
});
require("./arrayLast");
const ed=require("./euclideanDistance.js");
require("./forNestedEach");

@@ -123,4 +119,14 @@ function crossNormalisedDeltas() {

}
function getColumns(node) {
if(node.columns) {
if(node.columns instanceof Array) return node.columns
return eval("["+node.columns+"]");
}
}
functions={
avg:(d)=>functions.sum(d)/d.length,
arrayMax:(d)=>{ // not tested
let max=[],indices
a.forNestedEach((e,f,l)=>{const i=l[l.length-1];if(max[l]<e) {max=e,indices=l}})
},
covariance: (d)=>{

@@ -145,7 +151,12 @@ const means=[],covars=[],dl=d.length,dlminus1=dl-1,N=d[0].length;

const stdDev=d.map(c=>functions.stdDev(c));
logger.send({label:"test",d:d,covars:covars,stdDev:stdDev});
return 1//covars.map((a)=>a.map((c,i)=>c==null?null:c/(stdDev[i+1]*stdDev[i])));
return covars.map((a)=>a.map((c,i)=>c==null?null:c/(stdDev[i+1]*stdDev[i])));
},
deltas :(d)=>d.map( (c,i)=>c-(d[i-1]||0) ),
deltaNormalised :(d)=>d.map( (c,i)=>(c-(d[i-1]||0)) / (d[i-1]||0) ),
distances: (d,term,node)=>{
if(node.columns) return ed.distances(d,getColumns(node))
return ed.distances(d);
},
distancesMin: (d,term,node)=>ed.minDistances(d,getColumns(node)),
distancesMax: (d,term,node)=>ed.maxDistances(d,getColumns(node)),
max: (d)=> Math.max(...d),

@@ -389,2 +400,3 @@ median:(d)=>{

} catch(ex) {
if(logger.active) logger.send({label:"error input",action:node.action,message:ex.message,stack:ex.stack});
msg.error=ex.message;

@@ -391,0 +403,0 @@ if(node.maxErrorDisplay) {

{
"name": "node-red-contrib-prib-functions",
"version": "0.16.0",
"version": "0.16.1",
"description": "Node-RED added node functions.",

@@ -9,3 +9,3 @@ "dependencies": {

"node-red-contrib-logger": "^0.0.6",
"xlsx": "^0.16.9"
"xlsx": "^0.17.0"
},

@@ -22,3 +22,3 @@ "devDependencies": {

"scripts": {
"test": "mocha \"test/**/*.js\""
"test": "mocha \"test/**/e*.js\""
},

@@ -44,2 +44,4 @@ "repository": {

"delta",
"distance",
"euclidian distance",
"EMA",

@@ -46,0 +48,0 @@ "EWMA",

@@ -53,2 +53,7 @@ # [node-red-contrib-prib-functions][2]

Array data
* distances
* minimum distance(s) between points
* maximum distance(s) between points
![Data Analysis](documentation/DataAnalysis.JPG "Data Analysis")

@@ -246,2 +251,4 @@

0.16.10 data analysis add eulcidean distance functions. Add array pairs
0.16.0 fix data analysis variance and stddev, add sample, add tests

@@ -248,0 +255,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc