Commit 6609c8e7 authored by Matthias Carnein's avatar Matthias Carnein

Fixed bug when merging micro clusters

parent e5094a36
*.o
*.dll
......@@ -111,7 +111,7 @@ textClust_R$methods(
difference = difftime(Sys.time(),startTime,units="secs")
throughput[textClust_C$t] <<- difference
if(textClust_C$verbose){
print(paste("Difference: ",difference))
print(paste("Time Difference: ",difference))
# print(paste("msg/s: ",counter))
}
......
......@@ -46,18 +46,16 @@ void MicroCluster::merge(MicroCluster mc, int t, int omega, double lambda){
if(tf.containsElementNamed(v(i))) tfVal = tf[name];
if(mc.tf.containsElementNamed(v(i))) mctfVal = mc.tf[name];
finalList[name]=tfVal + mctfVal;
// finalList.push_back(Rcpp::Named(name, (int)tf[name] + (int)mc.tf[name]));
finalList[name] = tfVal + mctfVal;
}
//update time
this->time = t;
this->tf = finalList;
}
void MicroCluster::fade(int tnow, double omega, double lambda, bool termFading){
//fade cluster
this->weight = this->weight * pow(2,(-lambda * (tnow-this->time)));
//fade tokens
//Here we fade each single entry in our TF vector according to lambda and the passed time
//From last index to first one in order to prevent problems with indices
......
......@@ -18,16 +18,17 @@ public:
Rcpp::List micro;
textClust(double r_, double lambda_, int tgap_, bool updateAll_, bool verbose_, bool termFading_) :
r(r_),
lambda(lambda_),
tgap(tgap_),
updateAll(updateAll_),
verbose(verbose_) {
omega = pow(2, (-1*lambda * tgap));
t = 0;
upToDate=1;
termFading = termFading_;
textClust(double r, double lambda, int tgap, bool updateAll, bool verbose, bool termFading){
this->r = r;
this->lambda = lambda;
this->tgap = tgap;
this->updateAll = updateAll;
this->verbose = verbose;
this->omega = 0;
if(lambda!=0) this->omega = pow(2, (-1*lambda * tgap));
this->t = 0;
this->upToDate=1;
this->termFading = termFading;
};
textClust(Rcpp::List serialized) {
......
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