INNER CODE UNIT · Python

find_neighbors

TheAlgorithms/Jupyter · machine_learning/dbscan/dbscan.py:60

def find_neighbors(db, q, eps):
    """
        Finds all points in the db that
        are within a distance of eps from Q

        eps value should be a number
        >>> find_neighbors({ (1,2):{'label':'undefined'}, (2,3):{'label':'undefined'}}, (2,5),'a')
        Traceback (most recent call last):
        ...
        ValueError: eps should be either int or float

        Q must be a 2-d point as list or tuple
        >>> find_neighbors({ (1,2):{'label':'undefined'}, (2,3):{'label':'undefined'}}, 2, 0.5)
        Traceback (most recent call last):
        ...
        TypeError: Q must a 2-dimentional point in the format (x,y) or [x,y]

        Points must be in correct format

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…