Skip to content

mohdmot/KAGSA-KNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KAGSA KNN

a simple KNN algorithm in KAGSA Programming Language

Test

i use this small dataset that have [Cigarettes, Weight] in X and [0:Bad , 1:Good] in y.

i. Cigarettes Weight
0 7 70 0
1 7 40 0
2 3 40 1
3 1 40 1
4 3 70 0

cigarettes.kg :

include "KNeighbors.kgl"

// X : [Cigarettes, Weight]
// y : [0:Bad , 1:Good]
data = ``{
    "x": [[7,70],[7,40],[3,40],[1,40],[3,70]],
    "y": [0,0,1,1,0],
    "k":2
}``
data = JSON.parse(data)
new_x = list(7,50)

pred = KNeighbors.KNN(data.k ,data.x , data.y, new_x)
if pred {
    write 'Good'
}else {
    write 'Bad'
}

About

a simple KNN algorithm in KAGSA Programming Language

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors