Commit 68cdfc7c authored by Matthias Carnein's avatar Matthias Carnein

Improved Documentation, fixed param order

parent 178fcd31
......@@ -7,8 +7,10 @@
#' Evolutionary algorithms create slight variations by combining and randomly modifying existing solutions.
#' By iteratively selecting better solutions, an evolutionary pressure is created which improves the clustering over time.
#' Since the evolutionary algorithm is incremental, it is possible to apply it between observations, e.g. in the idle time of the stream.
#' Alternatively it can be applied as a traditional reclustering step, or a combination of both.
#' This implementation allows to use a fixed number of generations after each observation and during reclustering.
#' Whenever there is idle time, we can call the \code{recluster} function of the reference class to improve the macro-clusters (see example).
#' Alternatively, the evolutionary algorithm can be applied as a traditional reclustering step, or a combination of both.
#' For simplicity, this implementation allows to evaluate a fixed number of generations after each observation and during reclustering.
#' Alternatively, the \code{recluster} function can be called explicitly based on the available time.
#'
#' @param r radius threshold for micro-cluster assignment
#' @param lambda decay rate
......@@ -24,15 +26,35 @@
#' @author Matthias Carnein \email{Matthias.Carnein@@uni-muenster.de}
#'
#' @examples
#' stream <- DSD_Gaussians(k = 3, d = 2)
#' stream <- DSD_Memory(DSD_Gaussians(k = 3, d = 2), 1000)
#'
#' ## init evoStream
#' evoStream <- DSC_evoStream(r=0.05, k=3, incrementalGenerations=5, reclusterGenerations=2000)
#' update(evoStream, stream, n = 1200)
#'
#' ## insert observations
#' update(evoStream, stream, n = 1000)
#'
#' ## micro clusters
#' get_centers(evoStream, type="micro")
#'
#' ## macro clusters
#' get_centers(evoStream, type="macro")
#'
#' ## plot result
#' reset_stream(stream)
#' plot(evoStream, stream, type = "both")
#'
#' ## if we have time, evaluate additional generations. This can be called at any time, also between observations.
#' evoStream$RObj$recluster(1000)
#'
#' ## plot improved result
#' reset_stream(stream)
#' plot(evoStream, stream, type="both")
#'
#' @export
DSC_evoStream <- function(r, lambda=0.001, tgap=100, incrementalGenerations=5, reclusterGenerations=2000, k=2, crossoverRate=.8, mutationRate=.001, populationSize=100, initializeAfter=2*k) {
DSC_evoStream <- function(r, lambda=0.001, tgap=100, k=2, incrementalGenerations=5, reclusterGenerations=2000, crossoverRate=.8, mutationRate=.001, populationSize=100, initializeAfter=2*k) {
evoStream <- evoStream_R$new(r, lambda, tgap, incrementalGenerations, reclusterGenerations, k, crossoverRate, mutationRate, populationSize, initializeAfter)
evoStream <- evoStream_R$new(r, lambda, tgap, k, incrementalGenerations, reclusterGenerations, crossoverRate, mutationRate, populationSize, initializeAfter)
structure(
list(
......
......@@ -4,8 +4,8 @@
\alias{DSC_evoStream}
\title{evoStream - Evolutionary Stream Clustering}
\usage{
DSC_evoStream(r, lambda = 0.001, tgap = 100,
incrementalGenerations = 5, reclusterGenerations = 2000, k = 2,
DSC_evoStream(r, lambda = 0.001, tgap = 100, k = 2,
incrementalGenerations = 5, reclusterGenerations = 2000,
crossoverRate = 0.8, mutationRate = 0.001, populationSize = 100,
initializeAfter = 2 * k)
}
......@@ -16,12 +16,12 @@ DSC_evoStream(r, lambda = 0.001, tgap = 100,
\item{tgap}{time-interval between outlier detection and clean-up}
\item{k}{number of macro-clusters}
\item{incrementalGenerations}{number of EA generations performed after each observation}
\item{reclusterGenerations}{number of EA generations performed during reclustering}
\item{k}{number of macro-clusters}
\item{crossoverRate}{cross-over rate for the evolutionary algorithm}
\item{mutationRate}{mutation rate for the evolutionary algorithm}
......@@ -37,15 +37,37 @@ The micro-clusters are then incrementally reclustered using an evloutionary algo
Evolutionary algorithms create slight variations by combining and randomly modifying existing solutions.
By iteratively selecting better solutions, an evolutionary pressure is created which improves the clustering over time.
Since the evolutionary algorithm is incremental, it is possible to apply it between observations, e.g. in the idle time of the stream.
Alternatively it can be applied as a traditional reclustering step, or a combination of both.
This implementation allows to use a fixed number of generations after each observation and during reclustering.
Whenever there is idle time, we can call the \code{recluster} function of the reference class to improve the macro-clusters (see example).
Alternatively, the evolutionary algorithm can be applied as a traditional reclustering step, or a combination of both.
For simplicity, this implementation allows to evaluate a fixed number of generations after each observation and during reclustering.
Alternatively, the \code{recluster} function can be called explicitly based on the available time.
}
\examples{
stream <- DSD_Gaussians(k = 3, d = 2)
stream <- DSD_Memory(DSD_Gaussians(k = 3, d = 2), 1000)
## init evoStream
evoStream <- DSC_evoStream(r=0.05, k=3, incrementalGenerations=5, reclusterGenerations=2000)
update(evoStream, stream, n = 1200)
## insert observations
update(evoStream, stream, n = 1000)
## micro clusters
get_centers(evoStream, type="micro")
## macro clusters
get_centers(evoStream, type="macro")
## plot result
reset_stream(stream)
plot(evoStream, stream, type = "both")
## if we have time, evaluate additional generations. This can be called at any time, also between observations.
evoStream$RObj$recluster(1000)
## plot improved result
reset_stream(stream)
plot(evoStream, stream, type="both")
}
\author{
Matthias Carnein \email{Matthias.Carnein@uni-muenster.de}
......
......@@ -98,13 +98,13 @@ public:
// since exposed constructors have a limited number of parameters, we expose a setter function and use the default constructor
void setFields(double r, double lambda, int tgap, int incrementalGenerations, int reclusterGenerations, unsigned int k, double crossoverRate, double mutationRate, int populationSize, unsigned int initializeAfter){
void setFields(double r, double lambda, int tgap, unsigned int k, int incrementalGenerations, int reclusterGenerations, double crossoverRate, double mutationRate, int populationSize, unsigned int initializeAfter){
this->r=r;
this->lambda=lambda;
this->tgap=tgap;
this->k=k;
this->incrementalGenerations = incrementalGenerations;
this->reclusterGenerations = reclusterGenerations;
this->k=k;
this->crossoverRate=crossoverRate;
this->mutationRate=mutationRate;
this->populationSize=populationSize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment