Giter Site home page Giter Site logo

ate329 / vdbpy Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 29 KB

A simple python vector database allows difference search methods (consine similarity and euclidean distance ect.)

License: MIT License

Python 100.00%
database vector-database simple-project

vdbpy's Introduction

VDBpy

A simple vector database allows difference search methods (consine similarity and euclidean distance ect.)

Usage

View example.py for details

from VDBpy.indexing import VectorIndex
from VDBpy.query import VectorQuery

# Create a new vector index
index = VectorIndex()

# Add some vectors to the index
index.add_vector([1, 2, 3], 'vector1')
index.add_vector([4, 5, 6], 'vector2')

# Create a new vector query
query = VectorQuery(index)

# Execute the query
results = query.execute([2, 2, 2], k=2)

'''
# Execute the query using cosine similarity
results = query.execute([2,2,2], k=2, metric='cosine')
# Execute the query using Manhattan distance
results = query.execute([2,2,2], k=2, metric='manhattan')
# Execute the query using Jaccard similarity
results = query.execute([2,2,2], k=2, metric='jaccard') # for some reasons jaccard similarity is not working
# Execute the query using Euclidean distance
results = query.execute([2,2,2], k=2, metric='euclidean') 
'''

# Print the results
for id, similarity in results:
  print(f"ID: {id}, Similarity: {similarity}")

Installation

pip install VDBpy

vdbpy's People

Contributors

ate329 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.