Skip to content

Commit

Permalink
feat: functional KNN
Browse files Browse the repository at this point in the history
  • Loading branch information
c0utin committed Sep 30, 2024
1 parent 975dd1a commit 62f8cec
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/parsekoto_backend/main.mo
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ actor {
return studytimeDiff + absencesDiff;
};

public func calculateAllDistances(newRecord: Types.StudentRecord): async [(Types.StudentRecord, Float)] {
public func calculateAllDistancesMock(newRecord: Types.StudentRecord): async [(Types.StudentRecord, Float)] {
var distances: [(Types.StudentRecord, Float)] = [];

for (mockRecord in mock.vals()) {
Expand All @@ -93,5 +93,17 @@ actor {
return distances;
};


public func calculateAllDistances(newRecord: Types.StudentRecord): async [(Types.StudentRecord, Float)] {
var distances: [(Types.StudentRecord, Float)] = [];

for (realRecord in stable_decoded_student.vals()) {
let distance = await calculateDistance(newRecord, realRecord);
distances := Array.append(distances, [(realRecord, distance)]);
};

return distances;
};

};

0 comments on commit 62f8cec

Please sign in to comment.