Skip to content
This repository was archived by the owner on Aug 10, 2024. It is now read-only.

Commit 909ea46

Browse files
authored
Update README.md
1 parent 0d9ed25 commit 909ea46

File tree

1 file changed

+22
-51
lines changed

1 file changed

+22
-51
lines changed

README.md

+22-51
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,46 @@
1-
# Pair Adjacent Violators
1+
# KWeb
22

33
## Overview
44

5-
An implementation of the [Pair Adjacent Violators](http://gifi.stat.ucla.edu/janspubs/2009/reports/deleeuw_hornik_mair_R_09.pdf) algorithm for [isotonic regression](https://en.wikipedia.org/wiki/Isotonic_regression). Written in [Kotlin](http://kotlinlang.org/) but usable from Java or any [other JVM language](https://en.wikipedia.org/wiki/List_of_JVM_languages).
65

7-
Note this algorithm is also known as "Pool Adjacent Violators".
8-
9-
While not widely known, I've found this algorithm useful in a variety of circumstances, particularly when it comes to [calibration of predictive model outputs](http://scikit-learn.org/stable/modules/calibration.html).
10-
11-
A picture is worth a thousand words:
12-
13-
![PAV in action](https://sanity.github.io/pairAdjacentViolators/pav-example.png)
146

157
## Features
168

17-
* Tries to do one thing and do it well with minimal bloat, no external dependencies (other than Kotlin's stdlib)
18-
* Fairly comprehensive [unit tests](https://github.com/trystacks/pairAdjacentViolators/tree/master/src/test/kotlin/com/github/sanity/pav) (using [Kotlintest](https://github.com/kotlintest/kotlintest))
19-
* Employs an isotonic spline algorithm for smooth interpolation
20-
* Fairly efficient implementation without compromizing code readability
21-
* While implemented in Kotlin, works nicely from Java and other JVM languages
22-
* Supports reverse-interpolation
23-
249
## Usage
2510

2611
### Adding library dependency
2712

2813
You can use this library by adding a dependency for Gradle, Maven, SBT, Leiningen or another Maven-compatible dependency management system thanks to Jitpack:
2914

30-
[![](https://jitpack.io/v/sanity/pairAdjacentViolators.svg)](https://jitpack.io/#sanity/pairAdjacentViolators)
15+
[![](https://jitpack.io/v/sanity/kweb.svg)](https://jitpack.io/#sanity/kweb)
3116

3217
### Basic usage from Kotlin
3318

3419
```kotlin
35-
import com.github.sanity.pav.PairAdjacentViolators
36-
import com.github.sanity.pav.PairAdjacentViolators.*
37-
// ...
38-
val inputPoints = listOf(Point(3.0, 1.0), Point(4.0, 2.0), Point(5.0, 3.0), Point(8.0, 4.0))
39-
val pav = PairAdjacentViolators(inputPoints)
40-
val interpolator = pav.interpolator()
41-
println("Interpolated: ${interpolator(6.0)}")
42-
```
43-
44-
### Basic usage from Java
45-
```java
46-
import com.github.sanity.pav.*;
47-
import com.github.sanity.pav.PairAdjacentViolators.*;
48-
import kotlin.jvm.functions.*;
49-
import java.util.*;
50-
51-
public class PAVTest {
52-
public static void main(String[] args) {
53-
List<Point> points = new LinkedList<>();
54-
points.add(new Point(0.0, 0.0));
55-
points.add(new Point(1.0, 1.0));
56-
points.add(new Point(2.0, 3.0));
57-
points.add(new Point(3.0, 5.0));
58-
PairAdjacentViolators pav = new PairAdjacentViolators(points);
59-
final Function1<Double, Double> interpolator = pav.interpolator();
60-
for (double x=0; x<3; x+=0.1) {
61-
System.out.println(x+"\t"+interpolator.invoke(x));
20+
import com.github.sanity.kweb.clientConduits.WebsocketsClientConduit
21+
import kotlinx.coroutines.async
22+
import kotlin.concurrent.thread
23+
24+
fun main(args: Array<String>) {
25+
WebsocketsClientConduit(8091) {
26+
thread {
27+
async {
28+
var clicks = 0
29+
val heading = doc.body.appendChild("h1")
30+
heading.setInnerHTML("0 clicks")
31+
heading.addEventListener("click") {
32+
clicks++
33+
heading.setInnerHTML("$clicks clicks")
34+
false
35+
}
36+
}
6237
}
38+
false
6339
}
40+
Thread.sleep(10000)
6441
}
65-
```
6642

67-
### Full API documentation
68-
* [1.0.0](https://jitpack.io/com/github/sanity/pairAdjacentViolators/1.0.0/javadoc/com.github.sanity.pav/index.html)
69-
* [SNAPSHOT](https://jitpack.io/com/github/sanity/pairAdjacentViolators/-SNAPSHOT/javadoc/com.github.sanity.pav/index.html) (warning: This may take a while to load as it is rebuilt on-demand)
43+
```
7044

7145
### License
7246
Released under the [LGPL](https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License) version 3 by [Ian Clarke](http://blog.locut.us/) of [Stacks](http://trystacks.com/).
73-
74-
### Development
75-
[![Build Status](https://travis-ci.org/sanity/pairAdjacentViolators.svg?branch=master)](https://travis-ci.org/sanity/pairAdjacentViolators)

0 commit comments

Comments
 (0)