Skip to content

Implement K-nearest neighbors Classification Predictor #11

Description

@Ayush789

KNNClassifier should take Input Matrix X (m x n), label vector Y (m x 1), the value of k and Point p (1 x n) to give the label to p according to k nearest neighbours.

from learnemall.knn import KNNClassifier
k = KNNClassifier()
X = np.array([1,2],[2,4],[3,6])
Y = np.array([1,2,3])
p = np.array([0,0])
print(k.classify(X,Y,p,k=1)

output:
1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions