Commit 467d20b5 authored by Matthias Carnein's avatar Matthias Carnein

Fixed data structure during evaluation

parent 057cd028
......@@ -83,6 +83,9 @@ DSC_textClust <- function(r=.4, lambda=0.1, tgap=1000, nmin=1, nmax=1, k=NA_inte
#' @export
get_assignment.DSC_textClust <- function(dsc, points, ...) {
## select text column
points = points[,dsc$RObj$textCol, drop = FALSE]
## get mcs
microClusters = dsc$RObj$C$get_microclusters()
......
......@@ -96,6 +96,8 @@ evaluate <- function (dsc, dsd, measure, n = 100,
type <- stream:::get_type(dsc, type)
points <- get_points(dsd, n, cluster = TRUE)
## select text column
points = points[,dsc$RObj$textCol, drop = FALSE]
actual <- attr(points, "cluster")
if(missing(measure) || is.null(measure)) {
......@@ -462,7 +464,7 @@ silhouette <- function(points, actual, predict, dsc) {
if(!is.null(actual)) noise <- actual==0 & predict==0
else noise <- predict==0
points <- points[!noise,]
points <- points[!noise,,drop=F]
predict <- predict[!noise]
# if(any(predict==0)) warning("silhouette: ", sum(predict==0), " non-noise points were predicted noise incorrectly and form their own cluster.")
......@@ -473,7 +475,7 @@ silhouette <- function(points, actual, predict, dsc) {
tf = as.list(table(tokens))
if(length(tf)==0) return(NA)
## create temporary mc from text and timestamp
new(MicroCluster, tf, dsc$RObj$C$t)
new(MicroCluster, tf, dsc$RObj$C$t, 1)
})
predict = predict[!is.na(clusters)]
......
......@@ -43,7 +43,7 @@ void MicroCluster::unmerge(MicroCluster* mc, int t, int omega, double lambda, bo
// search key in current map (this)
std::unordered_map<std::string, double>::iterator valIt = this->tf.find(it->first);
if ( valIt != this->tf.end() ) {
// if element found: sum elements
// if element found: subtract elements
valIt->second -= it->second;
// remove insufficient elements
if(valIt->second <= omega){
......
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