The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
In this vignette, we are evaluating neighborhood-search, network-centralities and vicinities using Bayesian estimators as implemented in mmb.
Using some gradient-coloring:
library(mmb)
library(Rtsne)
library(ggplot2)
library(ggpubr)
set.seed(1)
1
chooseSample <-
iris[sample(rownames(iris)), ]
df <-#df <- iris[,]
Rtsne::Rtsne(df[, 1:4], check_duplicates = FALSE)
tsne <-# Attach:
$X <- tsne$Y[, 1]
df$Y <- tsne$Y[, 2]
df
# Let's pick one sample to calculate the vicinity for:
df[chooseSample, 1:4]
s <- mmb::vicinitiesForSample(doEcdf = FALSE, shiftAmount = 1,
vics <-df = df[, 1:4], sampleFromDf = s, selectedFeatureNames = colnames(s),
retainMinValues = 5)
#> Warning in value[[3L]](cond): Density estimation failed: Error in bw.SJ(x, method = "ste"): sample is too sparse to find TD
#> Warning in `[<-.data.frame`(`*tmp*`, names(centralities), , value = list(:
#> provided 7 variables to replace 1 variables
# Attach to df:
$vics <- vics$vicinity
df# TEMP TEMP TEMP: Discretize vics
mmb::discretizeVariableToRanges(df$vics, numRanges = length(levels(df$Species)))
mmbd <-$vicsD <- sapply(df$vics, function(v) {
dffor (i in 1:length(mmbd)) {
mmbd[[i]]
r <-if (v >= r[1] && v < r[2]) return(paste("R", i, sep = "_"))
}
})
# Also, create a binary classification:
$vicsB <- sapply(df$vics, function(v) {
dfreturn(if (v > 0.1) "P" else "N")
})
# Additionally, compute the Euclidean-distance:
$vicsE <- as.vector(philentropy::distance(df[, 1:4])[1,])
df#> Metric: 'euclidean'; comparing: 150 vectors.
$vicsE <- max(df$vicsE) - df$vicsE
df
geom_point(shape=1, size=3, color="#000000", data=df[chooseSample,], mapping=aes(x=df[chooseSample,]$X, y=df[chooseSample,]$Y))
pointCommon <-
ggplot(df, aes(x=X, y=Y, color=Species)) +
g1 <- geom_point() +
pointCommon +
stat_ellipse()
ggplot(df, aes(x=X, y=Y)) +
g2 <- geom_point(aes(color=vics)) +
#stat_ellipse() +
scale_color_gradient(low="blue", high="red")
# TEMP TEMP TEMP
ggplot(df, aes(x=X, y=Y, color=vicsD)) +
g3 <- geom_point() #+
#stat_ellipse()
ggplot(df, aes(x=X, y=Y, color=vicsB)) +
g4 <- geom_point() +
stat_ellipse()
ggplot(df, aes(x=X, y=Y)) +
g5 <- geom_point(aes(color=vicsE)) +
#stat_ellipse() +
scale_color_gradient(low="blue", high="red")
ggarrange(g1, g2, g3, g4, g5)
#> Warning in MASS::cov.trob(data[, vars]): Probable convergence failure
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.