Socket
Book a DemoInstallSign in
Socket

compute-cosine-similarity

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compute-cosine-similarity

Computes the cosine similarity between two arrays.

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
169K
-13.44%
Maintainers
2
Weekly downloads
 
Created

What is compute-cosine-similarity?

The compute-cosine-similarity npm package is used to calculate the cosine similarity between two vectors. Cosine similarity is a measure of similarity between two non-zero vectors of an inner product space that measures the cosine of the angle between them. This is commonly used in various applications such as text analysis, recommendation systems, and clustering.

What are compute-cosine-similarity's main functionalities?

Calculate Cosine Similarity

This feature allows you to calculate the cosine similarity between two vectors. The code sample demonstrates how to use the package to compute the similarity between two example vectors, vectorA and vectorB.

const cosineSimilarity = require('compute-cosine-similarity');

const vectorA = [1, 2, 3];
const vectorB = [4, 5, 6];

const similarity = cosineSimilarity(vectorA, vectorB);
console.log(similarity); // Output: 0.9746318461970762

Other packages similar to compute-cosine-similarity

Keywords

compute.io

FAQs

Package last updated on 15 Sep 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.