@@ -10,18 +10,17 @@ import 'package:ml_dataframe/ml_dataframe.dart';
1010import 'package:ml_linalg/distance.dart' ;
1111import 'package:ml_linalg/dtype.dart' ;
1212
13- /// A class that performs classification basing on `k nearest neighbours` (KNN)
13+ /// A class that performs classification based on `k nearest neighbours` (KNN)
1414/// algorithm
1515///
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.
1918///
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.
2524abstract class KnnClassifier
2625 implements
2726 Assessable ,
@@ -35,17 +34,15 @@ abstract class KnnClassifier
3534 /// [targetName] A string that serves as a name of the column containing
3635 /// outcomes.
3736 ///
38- /// [k] a number of nearest neighbours to be found among [trainData]
37+ /// [k] A number of nearest neighbours to be found among [trainData]
3938 ///
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
4241 ///
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
4543 ///
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]
4946 factory KnnClassifier (
5047 DataFrame trainData,
5148 String targetName,
@@ -95,8 +92,7 @@ abstract class KnnClassifier
9592 /// final json = await file.readAsString();
9693 /// final restoredClassifier = KnnClassifier.fromJson(json);
9794 ///
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
10096 /// ````
10197 factory KnnClassifier .fromJson (String json) =>
10298 initKnnClassifierModule ().get <KnnClassifierFactory >().fromJson (json);
@@ -106,13 +102,12 @@ abstract class KnnClassifier
106102 /// The value is read-only, it's a hyperparameter of the model
107103 int get k;
108104
109- /// A kernel type
105+ /// A kernel function type
110106 ///
111107 /// The value is read-only, it's a hyperparameter of the model
112108 KernelType get kernelType;
113109
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
116111 ///
117112 /// The value is read-only, it's a hyperparameter of the model
118113 Distance get distanceType;
0 commit comments