Skip to content

Commit 56e5a4f

Browse files
committed
update readme
1 parent 442639d commit 56e5a4f

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

README.md

+33-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,46 @@
11
# Kneedle
2-
Implementation of knee/elbow finding algorithm 'Kneedle' in c#.
2+
Implementation of knee/elbow finding algorithm 'Kneedle' in C#.
33

44
Calculates knee points using the Kneedle algorithm. Returns the x value corresponding to the knee point when successful, null otherwise.
55

6+
Contains only batch mode implementation right now. Contributoins welcome for online/streaming implementation, as well as any other improvements!
7+
68
## Reference
79
"Finding a ‘kneedle’ in a haystack: Detecting knee points in system behavior. "
810
Satopaa, V and Albrecht, J and Irwin, D and Raghavan, B
911
31-st International Conference on Distributed Computing Systems
1012
2011
11-
[https://raghavan.usc.edu/papers/kneedle-simplex11.pdf]
13+
https://raghavan.usc.edu/papers/kneedle-simplex11.pdf
14+
15+
## Usage
16+
17+
18+
19+
```csharp
20+
var y = new double[] { 1, 1, 0.894, 0.864, 0.859, 0.856, 0.852, 0.851, 0.849, 0.848, 0.847, 0.845 };
21+
var x = new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
22+
23+
var k1 = KneedleAlgorithm.CalculateKneePoints(x, y, CurveDirection.Decreasing, Curvature.Counterclockwise, forceLinearInterpolation: false);
24+
// Returns 4
25+
26+
var k2 = KneedleAlgorithm.CalculateKneePoints(x, y, CurveDirection.Decreasing, Curvature.Clockwise, forceLinearInterpolation: false);
27+
// Returns 2
1228
29+
```
1330

1431
## Inputs
15-
Needs the data points provided x-sorted.
1632

17-
Positive curvature is when the tangent traces anti-clockwise.
33+
**x**: X axis values of the points. Points must be sorted in ascending order w.r.t. X axis.
34+
35+
**y**: Y axis values of the points.
36+
37+
**direction**: If the curve is increasing or decreasing. Make sure to set this value according to the input curve.
38+
39+
**concavity**: Whether the curve has positive or negative curvature. In other words, concave or convex. Whether the tangent rotates clockwise or counterclockwise. Make sure to set this value according to the input curve.
40+
41+
**sensitivity**: Adjusts the knee detection threshold. Defaults to 1 as per the paper.
42+
43+
**forceLinearInterpolation**: Interpolation is done using robust cubic splines. For some inputs, spline can overshoot. This param forces linear interpolation instead of cubic spline.
1844

1945
## Output
2046
Returns the x value corresponding to the knee point.
@@ -23,3 +49,6 @@ Can return null when the algorithm fails to identify a knee/elbow for various re
2349
- the number of data points is too small
2450
- there are no local maxima on the diffs, which means either the curve is a line, or the parameters provided are incompatible with the curve
2551

52+
## Dependencies
53+
54+
*MathNet.Numerics* from NuGet.

0 commit comments

Comments
 (0)