Knn algorithm in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Knn algorithm in java

How i can input 3 vectors and another vector to calculate distance and print vector with k=2

17th Apr 2022, 1:04 AM
Walid
Walid - avatar
3 Answers
0
Because i need solution for my exam
17th Apr 2022, 1:24 AM
Walid
Walid - avatar
0
I have no idea how i solove my problem
17th Apr 2022, 1:25 AM
Walid
Walid - avatar
0
for input use int[][] vectors = new int[numberOfVectors][2]; for (int i=0; i < numberOfVectors; i++) { vectors[i][0] = sc.nextInt(); vectors[i][1] = sc.nextInt(); } System.out.println( Arrays.deepToString( vectors) ); or use a Point class
17th Apr 2022, 8:43 AM
zemiak