Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2886_SymRegGrammarEnumeration/ExpressionClustering_R/FindClustersForGPLog.R @ 16123

Last change on this file since 16123 was 15936, checked in by gkronber, 7 years ago

#2886 mapping GP solutions in R

File size: 1.1 KB
Line 
1# find nearest neighbors for GP indiviuals
2
3library(ggplot2);
4
5gp_log <- read.csv2("C:/Users/P24581/filebox/GPTP 2018/symbreg-models-13.05.2018-1418.csv",header = FALSE,sep='\t',dec=',');
6idx <- seq(1:nrow(gp_log));
7# check popSize in gp_log
8gp_log[seq(1,34000,500),1]
9popSize <- 500;
10
11# check qualities
12# ggplot(gp_log, aes(x=idx,y=gp_log$V1)) + geom_line();
13
14# generations <- seq(1,34000/popSize,1);
15generations <- seq(1,15,1);
16numClusters <- max(m$c);
17
18gp_evals <- gp_log[,seq(3,202,2)];
19all_evals <- m[,6:105];
20for(gen_i in generations) {
21#gen_i <- 15;
22  selectedRows <- seq((gen_i - 1)*popSize + 1, gen_i * popSize,1);
23  min(selectedRows)
24  max(selectedRows)
25  xcorrel <- cor(t(all_evals[,]), t(gp_evals[selectedRows,]))^2
26  mapped_gp_log <- m[max.col(t(xcorrel)), 1:5]
27#check
28#cor(t(all_evals[128082,]), t(gp_evals[2,]))^2
29#max(cor(t(all_evals[,]), t(gp_evals[2,]))^2)
30  ggplot(mapped_gp_log, aes(x=x, y=y)) + xlim(-75,75) + ylim(-75,75) + geom_point();
31  ggsave(paste("scatter",gen_i,".png"))
32
33  ggplot(mapped_gp_log, aes(x=c)) +xlim(0,numClusters+1) + geom_histogram(binwidth = 1);
34  ggsave(paste("cluster_freq",gen_i,".png"))
35}
Note: See TracBrowser for help on using the repository browser.