This article will walk you through a step-by-step implementation of affinity propagation, a clustering algorithm by message passing by Frey and Dueck [@Frey:2007:Clustering]. Step-by-step Input data Given a similarity matrix S = rbind(c(1.0, 0.8, 0.7, 0.2, 0.5), c(0.8, 1.0, 0.75, 0.3, 0.3), c(0.7, 0.75, 1., -0.1, 0.4), c(0.2, 0.3, -0.1, 1.0, 0.8), c(0.5, 0.3, 0.4, 0.8, 1.0)) %>% set_colnames(c('A', 'B', 'C', 'D', 'E')) %>% set_rownames(c('A', 'B', 'C', 'D', 'E')) image(S, col = cm.

Continue reading

There has been a guide on how to set up Nginx as a reverse proxy for Rstudio server here. This guide attempts to go further, by making sure that Rstudio server is accessible via https. This guide was tested on Ubuntu 16.04 LTS and Ubuntu 20.04, so make sure you adapt the commands accordingly to your system. Assuming that your machine already has Nginx and Rstudio server up and running. After any change in the configuration, you may restart the servers using these commands.

Continue reading

Fast SVD

Singular value decomposition is an expensive operation. For rectangular matrices with significant different dimensions, i.e. very “fat” or “thin” matrices, there is a trick to make the computation cheaper. This trick is implemented in fast.svd() of the R package corpcor. Calculate SVD The singular value decomposition of a matrix \(M\) of size \(m \times n\). \[ M = UDV^T \] \[ \begin{align} MM^T &= (UDV^T)(UDV^T)^T \\ &= (UDV^T)V(UD)^T \\ &= UD (V^TV) (UD)^T \\ &= UD(UD)^T \quad (V\text{ is orthogonal}) \\ &= UDD^TU^T \\ \end{align} \] Thus the decomposition of \(MM^T\) gives \(U\) and \(D^2\).

Continue reading

The gist of EM Simulate data Step-by-step The likelihood of each coin E-step M-step Putting together Start with close estimates Convergence of estimated parameters from various initial positions More observations The gist of EM Initialize paramters \(\theta\) E-step: Calculate the likelihood \(P(Z | X, \theta)\), \(Z\) is hidden variable M-step: Maximize the conditional expectation of \(ln P(X,Z | \theta)\), i.

Continue reading

A number of software solutions for collaborative translation projects One Sky Phrase App poeditor.com Transifex[https://www.transifex.com/] Pootle Launchpad.net Crowdin Zanata Translation Cloud LingoHub Flitto oTranCe Translate Wiki Project Open

Continue reading

SSH server Linux Mac OSX Windows Handy commands for working with ssh in many OS. SSH server Linux [To-be-updated] Mac OSX Check if SSH Remote Login is enabled sudo systemsetup -getremotelogin Example output Remote Login: Off Enable SSH Remote Login Include the flag -f to override the prompt sudo systemsetup -f -setremotelogin on This command will give no output, but you can check the status again using sudo systemsetup -getremotelogin.

Continue reading

Efficient `reduce` in R

Combining rows Combining columns When you need to do a Reduce operation on a list, it’s more efficient to use do.call(). Combining rows a = lapply(1:100, rnorm, n = 50) microbenchmark(Reduce(rbind, a), do.call(rbind, a)) %>% boxplot(unit = 'ms', boxwex=0.2) Combining columns microbenchmark(Reduce(cbind, a), do.call(cbind, a)) %>% boxplot(unit = 'ms', boxwex = 0.2)

Continue reading

Author's picture

Trang Tran


Student

USA