Learn R Programming

stream (version 2.0-1)

predict: Make a Prediction for a Data Stream Mining Task

Description

predict() for data stream mining tasks DST.

Usage

# S3 method for DST
predict(object, newdata, ...)

# S3 method for DSC predict( object, newdata, type = c("auto", "micro", "macro"), method = "auto", ... )

Value

A data.frame with columns containing the predictions. The columns depend on the type of the data stream mining task.

Arguments

object

The DST object.

newdata

The points to make predictions for as a data.frame.

...

Additional arguments are passed on.

type

Use micro- or macro-clusters in DSC for assignment.

method

assignment method

  • "model" uses the assignment method of the underlying algorithm (unassigned points return NA). Not all algorithms implement this option.

  • "nn" performs nearest neighbor assignment using Euclidean distance.

  • "auto" uses the model assignment method. If this method is not implemented/available then method "nn" is used instead.

Author

Michael Hahsler

See Also

Other DST: DSAggregate(), DSClassifier(), DSC(), DSOutlier(), DSRegressor(), DST_SlidingWindow(), DST_WriteStream(), DST(), evaluate, stream_pipeline, update()

Other DSC: DSC_Macro(), DSC_Micro(), DSC_R(), DSC_SlidingWindow(), DSC_Static(), DSC_TwoStage(), DSC(), animate_cluster(), evaluate.DSC, get_assignment(), plot.DSC(), prune_clusters(), read_saveDSC, recluster()

Examples

Run this code
set.seed(1500)
stream <- DSD_Gaussians(k = 3, d = 2, noise = .1)

dbstream <- DSC_DBSTREAM(r = .1)
update(dbstream, stream, n = 100)
plot(dbstream, stream, type = "both")

# find the assignment for the next 100 points to
# micro-clusters in dsc. This uses the model's assignment function
points <- get_points(stream, n = 10)
points

pr <- predict(dbstream, points, type = "macro")
pr

# Note that the clusters are labeled in arbitrary order. Check the
# agreement.
agreement(pr[,".class"], points[,".class"])

Run the code above in your browser using DataLab