https://github.com/mhahsler/stream
A framework for data stream modeling and associated data mining tasks such as clustering and classification. - R Package
https://github.com/mhahsler/stream
data-stream-clustering datastream stream-mining
Last synced: 4 months ago
JSON representation
A framework for data stream modeling and associated data mining tasks such as clustering and classification. - R Package
- Host: GitHub
- URL: https://github.com/mhahsler/stream
- Owner: mhahsler
- Created: 2015-10-28T16:37:22.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-03-12T18:09:28.000Z (over 1 year ago)
- Last Synced: 2026-01-26T11:51:17.584Z (5 months ago)
- Topics: data-stream-clustering, datastream, stream-mining
- Language: R
- Homepage:
- Size: 4.08 MB
- Stars: 40
- Watchers: 4
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r echo=FALSE, results = 'asis'}
pkg <- 'stream'
source("https://raw.githubusercontent.com/mhahsler/pkg_helpers/main/pkg_helpers.R")
pkg_title(pkg)
```
## Introduction
The package provides support for modeling and simulating data streams as well as an extensible framework for implementing, interfacing and
experimenting with algorithms for various data stream mining tasks. The main advantage of stream is that it seamlessly integrates with the large existing infrastructure provided by R. The package provides:
* **Stream Sources:** streaming from files, databases, in-memory data, URLs, pipes,
socket connections and several data stream generators including
dynamically streams with concept drift.
* **Stream Processing** with filters (convolution, scaling, exponential moving average, ...)
* **Stream Aggregation:** sampling, windowing.
* **Stream Clustering:** **BICO**, **BIRCH**, **D-Stream**, **DBSTREAM**, and **evoStream**.
* **Stream Outlier Detection** based on **D-Stream**, **DBSTREAM**.
* **Stream Classification** with **DecisionStumps**, **HoeffdingTree**, **NaiveBayes**
and **Ensembles** (streamMOA via RMOA).
* **Stream Regression** with **Perceptron**, **FIMTDD**, **ORTO**, ... (streamMOA via RMOA).
* **Stream Mining Evaluation** with prequential error estimation.
Additional packages in the stream family are:
* [streamConnect](https://github.com/mhahsler/streamConnect): Connect stream mining
components using sockets and web services.
* [streamMOA](https://github.com/mhahsler/streamMOA): Interface to clustering
algorithms implemented in the [MOA](https://moa.cms.waikato.ac.nz/) framework.
The package interfaces clustering algorithms like of **DenStream**, **ClusTree**,
**CluStream** and **MCOD**.
The package also provides an interface to [RMOA](https://github.com/jwijffels/RMOA) for
MOA's stream classifiers and stream regression models.
* [rEMM](https://github.com/mhahsler/rEMM): Provides implementations of
**threshold nearest neighbor clustering** (tNN) and
**Extensible Markov Model** (EMM) for modelling temporal relationships between clusters.
```{r echo=FALSE, results = 'asis'}
pkg_citation(pkg, 2)
pkg_install(pkg)
```
## Usage
```{r echo=FALSE}
options(digits = 3)
```
Load the package and a random data stream with 3 Gaussian clusters and 10\% noise and scale the data to z-scores.
```{r stream}
library("stream")
set.seed(2000)
stream <- DSD_Gaussians(k = 3, d = 2, noise= .1) %>% DSF_Scale()
get_points(stream, n = 5)
plot(stream)
```
Cluster a stream of 1000 points using D-Stream which estimates point density in grid cells.
```{r Dstream}
dsc <- DSC_DStream(gridsize = .1)
update(dsc, stream, 1000)
plot(dsc, stream, grid = TRUE)
```
```{r Dstream_eval}
evaluate_static(dsc, stream, n = 100)
```
Outlier detection using DBSTREAM which uses micro-clusters with a given radius.
```{r DSOutlier_DBSTREAM}
dso <- DSOutlier_DBSTREAM(r = .1)
update(dso, stream, 1000)
plot(dso, stream)
```
```{r DSO_eval}
evaluate_static(dso, stream, n = 100, measure = c("numPoints", "noiseActual", "noisePredicted", "noisePrecision"))
```
Preparing complete stream process pipelines that can be run using a single `update()` call.
```{r pipeline}
pipeline <- DSD_Gaussians(k = 3, d = 2, noise= .1) %>%
DSF_Scale() %>%
DST_Runner(DSC_DStream(gridsize = .1))
pipeline
update(pipeline, n = 500)
pipeline$dst
```
## Acknowledgments
The development of the stream package was supported in part by NSF IIS-0948893, NSF CMMI 1728612, and NIH R21HG005912.
## References
* Michael Hahsler, Matthew Bolaños, and John Forrest. [stream: An extensible framework for data stream clustering research with R.](https://dx.doi.org/10.18637/jss.v076.i14) _Journal of Statistical Software,_ 76(14), February 2017.
* [stream package vignette](https://cran.r-project.org/package=stream/vignettes/stream.pdf) with complete examples.
* [stream reference manual](https://cran.r-project.org/package=stream/stream.pdf)