Commit 24977ee5 authored by Matthias Carnein's avatar Matthias Carnein

fixed order of parameters

parent 36e62e59
......@@ -30,7 +30,7 @@
#' stream <- DSD_Memory(DSD_Gaussians(k = 3, d = 2), 1000)
#'
#' ## init evoStream
#' evoStream <- DSC_evoStream(r=0.05, k=3, incrementalGenerations=5, reclusterGenerations=2000)
#' evoStream <- DSC_evoStream(r=0.05, k=3, incrementalGenerations=1, reclusterGenerations=1000)
#'
#' ## insert observations
#' update(evoStream, stream, n = 1000)
......@@ -38,24 +38,35 @@
#' ## micro clusters
#' get_centers(evoStream, type="micro")
#'
#' ## micro weights
#' get_weights(evoStream, type="micro")
#'
#' ## macro clusters
#' get_centers(evoStream, type="macro")
#'
#' ## macro weights
#' get_weights(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)
#' ## by default, 1 generation is evaluated after each observation and 1000 generations during reclustering (parameters)
#' evoStream$RObj$recluster(2000)
#'
#' ## plot improved result
#' reset_stream(stream)
#' plot(evoStream, stream, type="both")
#'
#' ## get assignment of micro to macro clusters
#' microToMacro(evoStream)
#'
#'
#' @export
DSC_evoStream <- function(r, lambda=0.001, tgap=100, k=2, incrementalGenerations=5, reclusterGenerations=2000, crossoverRate=.8, mutationRate=.001, populationSize=100, initializeAfter=2*k) {
DSC_evoStream <- function(r, lambda=0.001, tgap=100, k=2, crossoverRate=.8, mutationRate=.001, populationSize=100, initializeAfter=2*k, incrementalGenerations=1, reclusterGenerations=1000) {
evoStream <- evoStream_R$new(r, lambda, tgap, k, incrementalGenerations, reclusterGenerations, crossoverRate, mutationRate, populationSize, initializeAfter)
evoStream <- evoStream_R$new(r, lambda, tgap, k, crossoverRate, mutationRate, populationSize, initializeAfter, incrementalGenerations, reclusterGenerations)
structure(
list(
......
......@@ -30,25 +30,43 @@ devtools::install_git("https://wiwi-gitlab.uni-muenster.de/m_carn01/evoStream")
```R
library(stream)
## library(evoStream)
#library(evoStream)
## create data stream
stream <- DSD_Gaussians(k = 3, d = 2)
stream <- DSD_Memory(DSD_Gaussians(k = 3, d = 2), 1000)
## initialize evoStream
evoStream <- DSC_evoStream(r=0.05, k=3)
## init evoStream
evoStream <- DSC_evoStream(r=0.05, k=3, incrementalGenerations=1, reclusterGenerations=1000)
## update model
update(evoStream, stream, n = 1200)
## insert observations
update(evoStream, stream, n = 1000)
## plot the result
plot(evoStream, stream, type = "both")
## get micro-clusters
## micro clusters
get_centers(evoStream, type="micro")
## get macro-clusters
## micro weights
get_weights(evoStream, type="micro")
## macro clusters
get_centers(evoStream, type="macro")
## macro weights
get_weights(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.
## by default, 1 generation is evaluated after each observation and 1000 generations during reclustering (parameters)
evoStream$RObj$recluster(2000)
## plot improved result
reset_stream(stream)
plot(evoStream, stream, type="both")
## get assignment of micro to macro clusters
microToMacro(evoStream)
```
......
......@@ -5,9 +5,9 @@
\title{evoStream - Evolutionary Stream Clustering}
\usage{
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)
initializeAfter = 2 * k, incrementalGenerations = 1,
reclusterGenerations = 1000)
}
\arguments{
\item{r}{radius threshold for micro-cluster assignment}
......@@ -18,10 +18,6 @@ DSC_evoStream(r, lambda = 0.001, tgap = 100, k = 2,
\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{crossoverRate}{cross-over rate for the evolutionary algorithm}
\item{mutationRate}{mutation rate for the evolutionary algorithm}
......@@ -29,6 +25,10 @@ DSC_evoStream(r, lambda = 0.001, tgap = 100, k = 2,
\item{populationSize}{number of solutions that the evolutionary algorithm maintains}
\item{initializeAfter}{number of micro-cluster required for the initialization of the evolutionary algorithm.}
\item{incrementalGenerations}{number of EA generations performed after each observation}
\item{reclusterGenerations}{number of EA generations performed during reclustering}
}
\description{
Stream clustering algorithm based on evolutionary optimization.
......@@ -45,7 +45,7 @@ In addition, this implementation also allows to evaluate a fixed number of gener
stream <- DSD_Memory(DSD_Gaussians(k = 3, d = 2), 1000)
## init evoStream
evoStream <- DSC_evoStream(r=0.05, k=3, incrementalGenerations=5, reclusterGenerations=2000)
evoStream <- DSC_evoStream(r=0.05, k=3, incrementalGenerations=1, reclusterGenerations=1000)
## insert observations
update(evoStream, stream, n = 1000)
......@@ -53,20 +53,31 @@ update(evoStream, stream, n = 1000)
## micro clusters
get_centers(evoStream, type="micro")
## micro weights
get_weights(evoStream, type="micro")
## macro clusters
get_centers(evoStream, type="macro")
## macro weights
get_weights(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)
## by default, 1 generation is evaluated after each observation and 1000 generations during reclustering (parameters)
evoStream$RObj$recluster(2000)
## plot improved result
reset_stream(stream)
plot(evoStream, stream, type="both")
## get assignment of micro to macro clusters
microToMacro(evoStream)
}
\references{
Carnein M. and Trautmann H. (2018), "evoStream - Evolutionary Stream Clustering Utilizing Idle Times", Big Data Research.
......
......@@ -98,17 +98,17 @@ 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, unsigned int k, int incrementalGenerations, int reclusterGenerations, double crossoverRate, double mutationRate, int populationSize, unsigned int initializeAfter){
void setFields(double r, double lambda, int tgap, unsigned int k, double crossoverRate, double mutationRate, int populationSize, unsigned int initializeAfter, int incrementalGenerations, int reclusterGenerations){
this->r=r;
this->lambda=lambda;
this->tgap=tgap;
this->k=k;
this->incrementalGenerations = incrementalGenerations;
this->reclusterGenerations = reclusterGenerations;
this->crossoverRate=crossoverRate;
this->mutationRate=mutationRate;
this->populationSize=populationSize;
this->initializeAfter=initializeAfter;
this->incrementalGenerations = incrementalGenerations;
this->reclusterGenerations = reclusterGenerations;
this->macroFitness = Rcpp::NumericVector(this->populationSize);
this->omega = pow(2, (-1*lambda * tgap));
......
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