In this document, we reproduce a result as seen in Lawrence (2012). The result was about recovering the travel trajectory of a robot from the strength measurement of 30 Wifi signals.

Load the data that contains the actual coordinates of the robot.

# Load data
rm(list = ls())
library(magrittr)
library(plotly)

fpath <- system.file("robot_wireless", "wireless_complete.csv", package = "maniTools")
wireless_full <- read.csv(fpath, header = FALSE)

ground_truth <- wireless_full[, 1:3]
names(ground_truth) <- c("x", "y", "time")

Load the Wifi signal data

fpath <- system.file("robot_wireless", "wireless.csv", package = "maniTools")
wireless <- read.csv(fpath, header = FALSE) %>% as.matrix()
dim(wireless)  # 215 datapoints of 30 wifi signal strength.

Perform dimensionality reduction

# Perform dimensionality reduction
proj_data <- RDRToolbox::Isomap(wireless, dim = 2, k = 7)[[1]] %>% as.data.frame()
names(proj_data) <- c('x', 'y')

Results

# Plotting
p1 <- plot_ly(ground_truth[c('x', 'y')], x = ~x, y = ~y, name = "Truth")
p2 <- plot_ly(data = proj_data, x = ~x, y = ~y, mode = 'markers+lines', name = "Isomap")
subplot(p1, p2) %>% layout(title = "Isomap")

In the above, we recovered the travel trajectory of the robot from the Wifi signals. Note that the scale of the projected data are off because the data we use had been preprocessed and standardised before we loaded them here.

Comparisons

library(maniTools)
# Laplacian Eigenmaps
LE_proj_data <- Laplacian_Eigenmaps(wireless, k = 7, d = 2)[[1]] %>% as.data.frame()
names(LE_proj_data) <- c('x', 'y')

# Locally Linear Embedding
LLE_proj_data <- LLE2(wireless, dim = 2, k = 7) %>% as.data.frame()
names(LLE_proj_data) <- c('x', 'y')

p3 <- plot_ly(data = LE_proj_data, x = ~x, y = ~y, mode = 'markers+lines', name = "Laplacian Eigenmaps")
p4 <- plot_ly(data = LLE_proj_data, x = ~x, y = ~y, mode = 'markers+lines', name = "Locally Linear Embedding")
subplot(p3, p4)

Reference



kcf-jackson/maniTools documentation built on April 20, 2020, 8:29 a.m.