<commit_before>pyfof
=====

Friends of Friends cluster finding in python.

This implements the friends-of-friends algorithm to find clusters of points,
accelerated with an R*-tree.

## Requirements
 * c++11 complient compiler
 * [Cython](http://cython.org/)
 * [numpy](http://www.numpy.org/)
 * [boost](http://www.boost.org/)

## Examples

### Two Gaussian blobs

```python
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import pyfof

npts = 10000
data = np.vstack((np.random.normal(-1,0.2,(npts/2,2)),\
                  np.random.normal(1,0.2,(npts/2,2))))

groups = pyfof.friends_of_friends(data, 0.4)

colors = cm.rainbow(np.linspace(0, 1, len(groups)))
for g,c in zip(groups, colors):
    plt.scatter(data[g,0], data[g,1], color=c, s=3)

plt.show()
```

![gaussian_example](/../screenshots/img/gaussian_example.png)
<commit_msg>Added stream example to the readme<commit_after>pyfof
=====

Friends of Friends cluster finding in python.

This implements the friends-of-friends algorithm to find clusters of points,
accelerated with an R*-tree.

## Requirements
 * c++11 complient compiler
 * [Cython](http://cython.org/)
 * [numpy](http://www.numpy.org/)
 * [boost](http://www.boost.org/)

## Examples

### Two Gaussian blobs

```python
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import pyfof

npts = 10000
data = np.vstack((np.random.normal(-1,0.2,(npts/2,2)),\
                  np.random.normal(1,0.2,(npts/2,2))))

groups = pyfof.friends_of_friends(data, 0.4)

colors = cm.rainbow(np.linspace(0, 1, len(groups)))
for g,c in zip(groups, colors):
    plt.scatter(data[g,0], data[g,1], color=c, s=3)

plt.show()
```

![gaussian_example](/../screenshots/img/gaussian_example.png)

### A more complicated example

![stream_example](/../screenshots/img/stream_example.png)
{'fraction_non_alphanumeric': 0.16911364872213158, 'fraction_numerical': 0.026101141924959218, 'mean_word_length': 4.2272727272727275, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1906311', 'n_tokens_mistral': 711, 'n_tokens_neox': 671, 'n_words': 152}