-
Notifications
You must be signed in to change notification settings - Fork 0
/
drifter.R
59 lines (47 loc) · 2.19 KB
/
drifter.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
rm(list=ls())
#***************************************************************************************************************************
## The concept drift analysis using drifter tools
#***************************************************************************************************************************
#Link to the tool:
#Documentation: https://cran.r-project.org/web/packages/drifter/drifter.pdf
#Paper reference:
#===========================================================================================================================
#Short Description:
# Concept drift refers to the change in the data distribution or in the relationships between variables over time.
# 'drifter' calculates distances between variable distributions or variable relations and identifies both types of drift.
#===========================================================================================================================
#Path:
setwd('C:/Users/Jana Schwarzerova/Desktop/PhD/KiNG/Iwbbio2021/R_Tools')
#Installation Notes
install.packages("drifter")
library(drifter)
#Loading dataset:
BM <- read.csv("C:/Users/Jana Schwarzerova/Desktop/PhD/KiNG/Iwbbio2021/Dataset/BM.csv",header=T,sep = ";")
GM <- read.csv("C:/Users/Jana Schwarzerova/Desktop/PhD/KiNG/Iwbbio2021/Dataset/GM.csv",header=T,sep = ";")
#UM <- read.csv("C:/Users/Jana Schwarzerova/Desktop/PhD/KiNG/Iwbbio2021/Dataset/UM.csv",header=T,sep = ";")
ppBM <- BM;
ppGM <- GM;
pom <- 1;
#Pre-processing:
for (i in 1:length(BM$annotation)){
for (j in 1:length(GM$Top.annotation.name)){
if (BM$annotation[i] == GM$Top.annotation.name[j]){
ppBM[pom,] <- BM[i,];
ppGM[pom,] <- GM[j,];
pom <- pom + 1;
}
}
}
ppBM <- ppBM[1:pom-1,3:length(ppBM)];
ppGM <- ppGM[1:pom-1,c(8:length(ppGM))];
#Calculate Covariate Drift for two data frames:
LacDrift <- calculate_covariate_drift(ppBM[1,], ppGM[1,]); #Lac / Lactate
PyrDrift <- calculate_covariate_drift(ppBM[2,], ppGM[2,]); #Pyr / Pyruvate
match <- 0;
for (i in 1:length(LacDrift$variables)){
for (j in 1:length(PyrDrift$variables)){
if (LacDrift$variables[i] == PyrDrift$variables[j]){
match <- match + 1;
}
}
}