
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@good-i-deer/node-red-contrib-cosine-similarity
Advanced tools
Calculates cosine similarity of two vector values in Node-RED
This module provides a node that calculates cosine similarity of two vector values in Node-RED.
This node requires node.js version 18.16.1 and Node-RED version 3.1.0.
This node calculates cosine similarity between two vectors and return it as an array. It can calculate multiple arrays of vectors. The output can be used for detecting if there are cases where the similarity is above a cerain value.
var input_array1 = [
[ "arrays of vectors 1" ],
[ "arrays of vectors 2" ],
[ "arrays of vectors 3" ]
]
var input_array2 = [
[ "arrays of vectors 4" ],
[ "arrays of vectors 5" ],
[ "arrays of vectors 6" ]
]
var outout_array = [
[ "arrays of cosine similarity between input_array2 and arrays of vectors 1" ],
[ "arrays of cosine similarity between input_array2 and arrays of vectors 2" ],
[ "arrays of cosine similarity between input_array2 and arrays of vectors 3" ]
]
The node-red-contrib-cosine-similarity requires Node-RED to be installed.
cd ~/.node-red
npm install @good-i-deer/node-red-contrib-cosine-similarity
Restart your Node-RED instance
Array of Vector Arrays
Name
File
Array of Cosine Similarity Arrays
Here are some example flows of cosine similarity.
[
{
"id": "02168a0656dc6f37",
"type": "tab",
"label": "Example Flow",
"disabled": false,
"info": "",
"env": []
},
{
"id": "0e57c1a384a6551d",
"type": "calculate-cosine",
"z": "02168a0656dc6f37",
"name": "",
"file": "C:\\Users\\SSAFY\\Desktop\\ssdc\\object\\vectors\\stored.txt",
"x": 350,
"y": 80,
"wires": [
[
"71c649b78711fc2a"
]
]
},
{
"id": "a1704726f1bf888d",
"type": "function",
"z": "02168a0656dc6f37",
"name": "temp function1",
"func": "msg.payload = msg.payload[0];\nreturn msg",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 120,
"y": 80,
"wires": [
[
"0e57c1a384a6551d"
]
]
},
{
"id": "71c649b78711fc2a",
"type": "debug",
"z": "02168a0656dc6f37",
"name": "Similarity Value",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 570,
"y": 80,
"wires": []
}
]
Use GitHub Issues to ask questions or to discuss new features.
GOOD-I-DEER in SSAFY(Samsung Software Academy for Youth) 9th
Copyright Samsung Automation Studio Team under the Apache 2.0 license
FAQs
Calculates cosine similarity of two vector values in Node-RED
We found that @good-i-deer/node-red-contrib-cosine-similarity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.