@@ -10,18 +10,17 @@ import 'package:ml_dataframe/ml_dataframe.dart';
10
10
import 'package:ml_linalg/distance.dart' ;
11
11
import 'package:ml_linalg/dtype.dart' ;
12
12
13
- /// A class that performs classification basing on `k nearest neighbours` (KNN)
13
+ /// A class that performs classification based on `k nearest neighbours` (KNN)
14
14
/// algorithm
15
15
///
16
- /// K nearest neighbours algorithm is an algorithm that is targeted to search for
17
- /// the most similar labelled observations (number of these observations is equal
18
- /// to `k` ) to the given unlabelled one.
16
+ /// K nearest neighbours algorithm is an algorithm that is targeted to search
17
+ /// for the most similar k observations to the given one.
19
18
///
20
- /// It is possible to use majority class among the `k` found observations as a
21
- /// prediction for the given unlabelled observation, but it may lead to the
22
- /// imprecise result. Thus the weighted version of KNN algorithm is used in the
23
- /// classifier. To get weight of a particular observation one may use a kernel
24
- /// function.
19
+ /// It is possible to use the majority class among the `k` found observations
20
+ /// as a prediction for the given unlabelled observation, but it may lead to an
21
+ /// imprecise result. To overcome this, the weighted version of KNN algorithm
22
+ /// is used in the classifier. To get the weight of a particular observation
23
+ /// one may use a kernel function.
25
24
abstract class KnnClassifier
26
25
implements
27
26
Assessable ,
@@ -35,17 +34,15 @@ abstract class KnnClassifier
35
34
/// [targetName] A string that serves as a name of the column containing
36
35
/// outcomes.
37
36
///
38
- /// [k] a number of nearest neighbours to be found among [trainData]
37
+ /// [k] A number of nearest neighbours to be found among [trainData]
39
38
///
40
- /// [kernel] a type of a kernel function that is used to predict an
41
- /// outcome for a new observation
39
+ /// [kernel] A kernel function that will be used to predict an outcome for a
40
+ /// new observation
42
41
///
43
- /// [distance] a distance type that is used to measure a distance between two
44
- /// observation vectors
42
+ /// [distance] A way to measure a distance between two observation vectors
45
43
///
46
- /// [dtype] A data type for all the numeric values, used by the algorithm. Can
47
- /// affect performance or accuracy of the computations. Default value is
48
- /// [DType.float32]
44
+ /// [dtype] A data type for all the numeric values, used by the algorithm.
45
+ /// Default value is [DType.float32]
49
46
factory KnnClassifier (
50
47
DataFrame trainData,
51
48
String targetName,
@@ -95,8 +92,7 @@ abstract class KnnClassifier
95
92
/// final json = await file.readAsString();
96
93
/// final restoredClassifier = KnnClassifier.fromJson(json);
97
94
///
98
- /// // here you can use previously fitted restored classifier to make
99
- /// // some prediction, e.g. via `KnnClassifier.predict(...)`;
95
+ /// // here you can use previously fitted restored classifier
100
96
/// ````
101
97
factory KnnClassifier .fromJson (String json) =>
102
98
initKnnClassifierModule ().get <KnnClassifierFactory >().fromJson (json);
@@ -106,13 +102,12 @@ abstract class KnnClassifier
106
102
/// The value is read-only, it's a hyperparameter of the model
107
103
int get k;
108
104
109
- /// A kernel type
105
+ /// A kernel function type
110
106
///
111
107
/// The value is read-only, it's a hyperparameter of the model
112
108
KernelType get kernelType;
113
109
114
- /// A distance type that is used to measure a distance between two
115
- /// observations
110
+ /// A distance type that is used to measure how far are observations from each other
116
111
///
117
112
/// The value is read-only, it's a hyperparameter of the model
118
113
Distance get distanceType;
0 commit comments