Registry / ai-ml / simplecosine

simplecosine

JSON →
library1.2pypypiunverified

Simple cosine distance calculation for vectors. Version 1.2 provides a straightforward function to compute cosine similarity or distance between two vectors. No active development, stable API.

pip install simplecosine
INSTALL
IMPORT
SIG · SIMPLECOSINE
S
simplecosine
ai-mlpythonv1.2
Install
3.6s avg
Import
Disk
89MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 89.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.6s · import 0.000s · 86MB
89MB installed
● package 89MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cosine_distance
from simplecosine import cosine_distance
from simplecosine.cosine import cosine_distance

Compute cosine distance between two vectors

import os from simplecosine.cosine import cosine_distance v1 = [1, 0, 0] v2 = [0, 1, 0] result = cosine_distance(v1, v2) print(result) # Output: 1.0
Debug
Known issues
gotchacosine_distance returns cosine distance (1 - similarity), not similarity. Many users expect similarity and misinterpret the result.
fix
Use 1 - cosine_distance(a, b) to get cosine similarity
affects: all
gotchaThe function only works with 2D vectors; does not support sparse arrays or arrays of different lengths. It will raise error or give wrong results.
fix
Ensure both vectors are Python lists of floats/ints of same length
affects: all
Upgrade
Version history
1.2latest on PyPI · released Jun 15, 2017
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources
simplecosine — pip install simplecosine · libregistry