source: branches/2886_SymRegGrammarEnumeration/ExpressionClustering_R/ClusteringScript.R @ 15924

Last change on this file since 15924 was 15924, checked in by gkronber, 4 years ago

#2886 remove obsolete code in C# program for the evaluation of sentences, switch to NSME as quality measure. Tried plotting functions within clusters in R

File size: 941 bytes
Line 
1library(largeVis)
2library(ggplot2)
3library(dplyr)
4
5
6
7sentenceFileName <- "D:/heal/documents/trunk/Publications/2018/GPTP/data/evaluations_allSentences_2018-04-13_16-40_TreeSize-7_1d.csv.gz";
8evalData <- read.csv(sentenceFileName,header = TRUE, sep = ";", dec=",");
9qualities <- evalData$R2.keijzer4;
10outputs <- evalData[,6:105];
11
12lv <- largeVis(outputs, dim=2, K = 50, n_trees = 50) # TODO scale?
13clusters <- hdbscan(lv, minPts = 3, K=50);
14
15
16
17m <- data.frame(x=t(lv$coords)[,1], y=t(lv$coords)[,2], c=clusters$clusters, q=qualities, outputs)
18# plot mapped points
19ggplot(data=m, aes(x=x, y=y)) + geom_point(aes(color=c))  + theme(legend.position = "none") ;
20
21cluster_n <- dplyr::filter(m, c==5);
22cluster_evals <- data.frame(x=seq(1,100,1), t(cluster_n[,5:104]))
23evals_cluster_n <- tidyr::gather(cluster_evals,"f", "fx", 2:ncol(cluster_evals))
24
25p <- ggplot(evals_cluster_n, aes(x=x, y=fx,color=f)) + geom_line();
26p
27
Note: See TracBrowser for help on using the repository browser.