forked from sterlesser/Cancer-Classification
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathNearestNeighbor.ctxt
More file actions
29 lines (29 loc) · 3.52 KB
/
NearestNeighbor.ctxt
File metadata and controls
29 lines (29 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#BlueJ class context
comment0.params=
comment0.target=NearestNeighbor()
comment0.text=\n\ default\ constructor\ for\ NearestNeighbor\ class\n\ \n
comment1.params=
comment1.target=void\ random20()
comment1.text=\n\ Generates\ a\ random\ list\ of\ index\ numbers.\ These\ data\ occoring\ at\ these\ index\ numbers\ of\ the\ data\ array\ are\ put\ into\ the\ test\ data\ array.\n
comment2.params=data
comment2.target=void\ createArrays(double[][])
comment2.text=\n\ Creates\ two\ arrays,\ test\ data\ and\ training\ data,\ based\ on\ the\ numbers\ generated\ by\ random\ 20.\ test\ data\ contains\ the\ data\ in\ the\ data\ array\ occoring\ at\ index\ numbers\ generated\ by\ randome20.\ Training\ data\ contains\ the\ other\ 80%\ of\ the\ data.\n\ @param\ arrayindexes\ this\ array\ contains\ the\ list\ of\ index\ numbers\ generated\ by\ Random20\n
comment3.params=array1\ array2
comment3.target=double\ findDistance(double[],\ double[])
comment3.text=\n\ Finds\ the\ distance\ between\ two\ tumors\ by\ using\ the\ distance\ formula,\ taking\ the\ difference\ between\ each\ of\ the\ 30\ values,\ squaring\ them\ and\ then\ rooting\ the\ sum.\n\ @param\ array1\ contains\ data\ for\ the\ 1st\ tumor\n\ @param\ array2\ contains\ data\ for\ the\ 2nd\ tumor\n\ @return\ returns\ the\ distance\ between\ the\ two\ tumors.\n
comment4.params=testdata\ trainingdata
comment4.target=double\ findNearestNeighborAccuracy(double[][],\ double[][])
comment4.text=\n\ Finds\ the\ accuracy\ of\ the\ Nearest\ neighbor\ algorithm\ on\ this\ dataset\n\ @param\ testdata\ the\ array\ with\ data\ which\ needs\ to\ be\ checked\n\ @param\ trainingdata\ the\ array\ with\ training\ data\ used\ to\ predict\ the\ testdata\n\ @return\ the\ accuracy\ of\ the\ nearest\ neighbor\ algorithm\ on\ the\ dataset\n
comment5.params=indexoftestdata
comment5.target=double[][]\ getDistances(int)
comment5.text=\n\ finds\ the\ distance\ between\ a\ point\ in\ the\ test\ data\ and\ all\ points\ in\ training\ data.\n\ @param\ indexoftestdata\ the\ index\ of\ the\ point\ in\ test\ data\n\ @return\ a\ two\ array\ with\ distances\ between\ the\ point\ at\ indextestdata\ of\ testdata\ and\ all\ points\ in\ training\ data,\ as\ well\ as\ the\ classification\ of\ whether\ malignant\ or\ benign.\n
comment6.params=data
comment6.target=double\ getNearestNeighborAccuracy(double[][])
comment6.text=\n\ Gets\ the\ Accuracy\ of\ the\ Nearest\ Neighbor\ Algorithm,\ by\ calling\ the\ random20\ method,\ the\ createArrays\ method\ and\ then\ the\ findNearestNeighborAccuracy\ method\n\ @return\ returns\ the\ accuracy\ of\ the\ nearest\ neighbor\ algorithm\ for\ one\ test\n
comment7.params=valueofk\ data
comment7.target=double\ kNearestNeighbor(int,\ double[][])
comment7.text=\n\ implements\ the\ kNearestNeighbor\ algorithm,\ to\ predict\ the\ value\ of\ a\ tumor,\ and\ finds\ the\ accuracy\ of\ the\ prediction.\n\ @param\ valueofk\ the\ value\ of\ k\ to\ use\n\ @return\ returns\ the\ accuracy\ of\ the\ algorithm\ for\ that\ value\ of\ k\n
comment8.params=arrayofdistances
comment8.target=double[][]\ sortDistances(double[][])
comment8.text=\n\ sorts\ an\ array\ using\ bubblesort.\ used\ to\ sort\ the\ array\ of\ distances\ in\ ascending\ order\ to\ be\ used\ to\ predict\ the\ value\ of\ a\ tumor\ in\ the\ kNearestNeighbor\ algorithm.\n\ @param\ arrayofdistances\ the\ 2-d\ array\ with\ classification\ of\ the\ tumor\ in\ the\ trainingdata\ and\ its\ distance\ from\ a\ tumor\ in\ the\ testdata\ array\ \n\ @return\ the\ 2-d\ array\ of\ distances\ and\ classification\ sorted\ in\ ascending\ order\ by\ distances.\n
numComments=9