Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
association
Advanced tools
An association lib that will find an things closest associations and give helper methods to do some other interesting things
Description: General machine learning helper library that exposes a nearest neighbor algorithm that can be configured to use one of two included types of mesurement. The lib includes two methods to either compare objects as a whole to see what two share the closest similarity or compare the keys from all objects to get the inverse. Supports pearson correlation algo AND euclidean distance algo
Example:
This example will be based off of a group of people rateing movies:
My ratings:
var jordan = {
'Lord of the Rings':4.1,
'The dark night':1.7,
'Sin city':5,
'Friday night lights':2.4
};
==========================
Alec ratings:
var alec = {
'Lord of the Rings':4,
'The dark night':1,
'Sin city':4,
'Friday night lights':4,
'silence of the lambs':5,
'dawn of the dead':6
};
==========================
Randy ratings:
var randy = {
'Lord of the Rings':5,
'The dark night':5,
'Sin city':5,
'Friday night lights':2,
'silence of the lambs':3.9,
'dawn of the dead':5,
'night of the living dead':6
};
==========================
User map:
var userMap = {
alec:alec,
randy:randy
}
With this information we can run a compareAll to see who shares my views in movies.
var association = require('./index.js')
var a = new association({
formula: 'pearson' // this can also be euclidean
});
a.compareAll(2,userMap,jordan)
This will return the following(if you use pearson algo)
[ { key: 'alec', score: 0.7033391716221717 },
{ key: 'randy', score: 0.3956282840374718 } ]
This shows that my movie views match up best with alec.
I can also use this information to get recommendations of movies I have not seen yet.
var association = require('./index.js')
var a = new association({
formula: 'pearson' // this can also be euclidean
});
a.getRecommendations(a.compareAll(2,userMap,jordan),userMap,jordan)
This will return the following:
[ { key: 'night of the living dead', score: 6 },
{ key: 'dawn of the dead', score: 5.64 },
{ key: 'silence of the lambs', score: 4.603999999999999 } ]
This shows that I will like night of the living dead the most of movies I have not viewed yet followed by dawn of the dead and then silence of the lambs.
Overview:
Methods:
compareAll(num,mapOfMap,baseMap);
params:
num: the number of returns in the array by the algo
mapOfMap: the map containing all the maps that will be used
for the algo, example map of users movie ratings.
baseMap: the base map that things will find relation to.
example: my movie ratings
return:
ranking of keys in mapOfMap by comparing objects. //correlation
getReccommendations(simObj,mapOfMap,baseMap);
params:
simObj: the correlation returned by compareAll
mapOfMap: the map containing all the maps that will be used
for the algo, example map of users movie ratings.
baseMap: the base map that things will find relation to.
example: my movie ratings
return:
ranking of items not included in base map by similarity to existing items.
FAQs
An association lib that will find an things closest associations and give helper methods to do some other interesting things
The npm package association receives a total of 0 weekly downloads. As such, association popularity was classified as not popular.
We found that association demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.