DSF | R Documentation |
Abstract base classes for all data stream filter (DSF) classes. Data stream filters transform a data stream (DSD).
DSF(...)
## S3 method for class 'DSF'
reset_stream(dsd, pos = 1)
## S3 method for class 'DSF'
get_points(x, n = 1L, info = TRUE, ...)
## S3 method for class 'DSF'
update(object, dsd = NULL, n = 1L, return = "data", ...)
## S3 method for class 'DSF'
close_stream(dsd, ...)
... |
Further arguments passed on. |
dsd |
a stream object of class DSD. |
pos |
position in the stream. |
x , object |
a |
n |
number of points to get/use for the update. |
info |
return additional columns with information about the data point (e.g., a known cluster assignment). |
return |
a character string indicating what update returns. The only
value is currently |
The DSF
class cannot be instantiated, but it serve as a base
class from which other DSF classes inherit.
Data stream filters transform a DSD data stream. DSF
can be used in two ways.
DSD Adapter:
When a data stream (dsd
) is specified in the constructor, then the DSF acts as an a
adapter for a connected data stream. The DSF implementations inherit the
interface from DSD and provide:
get_points()
get the transformed points.
reset_stream()
reset the underlying stream
close_stream()
close the underlying stream
Stream Transformer:
When no data stream (dsd
) is specified in the constructor, then the DSF acts like a
DST data stream task and provides:
update()
to transform the points from a specified DSD
.
It is convenient to use the pipe (magrittr::%>%) to apply one or more filters to data
streams (see Examples section).
reset_stream(DSF)
: reset the attached stream if reset is supported.
get_points(DSF)
: DSD-like interface to get points if the DSF was created with an attached stream.
update(DSF)
: updates with data and returns the filtered data.
close_stream(DSF)
: close the attached stream if close is supported.
Michael Hahsler
Other DSF:
DSF_Convolve()
,
DSF_Downsample()
,
DSF_ExponentialMA()
,
DSF_FeatureSelection()
,
DSF_Func()
,
DSF_Scale()
,
DSF_dplyr()
Other DSD:
DSD()
,
DSD_BarsAndGaussians()
,
DSD_Benchmark()
,
DSD_Cubes()
,
DSD_Gaussians()
,
DSD_MG()
,
DSD_Memory()
,
DSD_Mixture()
,
DSD_NULL()
,
DSD_ReadDB()
,
DSD_ReadStream()
,
DSD_Target()
,
DSD_UniformNoise()
,
DSD_mlbenchData()
,
DSD_mlbenchGenerator()
,
animate_data()
,
close_stream()
,
get_points()
,
plot.DSD()
,
reset_stream()
DSF()
# Example 1: Use as a DSD adapter
stream <- DSD_Gaussians(k = 3, d = 2) %>%
DSF_Func(func = function(x) cbind(x, Xsum = x$X1 + x$X2))
stream
get_points(stream, n = 5)
# Example 2: Use as a stream transformer
trans <- DSF_Func(func = function(x) cbind(x, Xsum = x$X1 + x$X2))
trans
update(trans, stream, n = 5)
# Example 3: Use as a DST preprocessor
clusterer <- DSF_Func(func = function(x) cbind(x, X1_squared = x$X1^2)) %>%
DST_Runner(DSC_Kmeans(k = 3))
clusterer
update(clusterer, stream, n = 100)
# Example 5: Specify a complete pipeline DSD -> DSF -> DST
pipeline <- DSD_Gaussians(k = 3, d = 2) %>%
DSF_Func(func = function(x) cbind(x, X1_squared = x$X1^2)) %>%
DST_Runner(DSC_Kmeans(k = 3))
pipeline
update(pipeline, n = 100)
plot(pipeline$dst)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.