## Autoencoders

There are many things, systems, that have Principal Components Analysis as the result of their evolution, their computation; their dynamics. Things like neural networks, for example. So, this time, I decided to play with autoencoders.

An autoencoder is a feed forward neural network that satisfies three properties:

1. It has only one hidden layer
2. If $n_i$ is the dimension of the input layer, $n_o$ the dimension of the output layer and $p$ the dimension of the hidden one; then $n_i = n_o = n$ and $p < n$
3. The output should be as close as possible to the input (In some sense, usually the quadratic error one)

This is the dimensionality reduction setup of the autoencoder, portraying the characteristic funnel architecture shown in figure 1b; it can be seen as a sequence of two affine maps between 3 vector spaces $X$$H$ and $Y$  as in the figure 1a.

## The curvature of curves and its computation

How much does a curve bend? That looks like an important question to ask. Indeed, it is THE question to ask because curvature is everything we need to know about a curve (modulo some annoying groups we will talk about in the future). If you are too shy to ask, you can compute it and that is what this post is about. In order to compute the curvature you need a bunch of things and for each one there is a bunch of ways of doing it, so, let’s talk about some of them.

## On the curve generated by plotting one sine against another

A circle? A line? Actually, it depends. It depends upon parameters like the frequency or the phase; when these change, really interesting things happen. What I mean by “against another” is that the first sine function will be the $x$-coordinate while the other, the $y$-coordinate; then, if you studied engineering you might say “$y$ vs. $x$” but if you studied biology you might be used to say “$x$ vs. $y$” (personal observation). We end up then with a curve, say $\gamma(t) = (x(t), y(t))$, where

$x(t) = A_1\sin(\omega_1 t + \phi_1)$

and

$y(t) = A_2\sin(\omega_2 t + \phi_2)$.

## An asymmetric pdf with infinite support

When was the last time you needed an asymmetric (skewed) probability density function (pdf) with infinite support? Traditional skewed  distributions like the gamma family suffer from a semi-infinite support, that is, $\mathrm{supp}(p) = [0, +\infty)$. The support, if you are out of the loop, is the set of values $x$ in the domain of $p$ such that $p(x) > 0$. Why is this inconvenient? well, I will give more details about the specific application later, meanwhile, let’s say that the fact that its derivative is discontinuous at $0$ is problematic; even more, I need my function to be at least in $C^3$, that is, to have at least $3$ continuous derivatives!.

This post constitutes a somewhat dirty solution being as unwilling as I am to review any literature in depth (I might be inventing the wheel again, some wheel, but who cares; this is a blog!). Here we go.

## An example application with JPA and JavaFX

We are going to create an example application with JPA and JavaFX 2 using Netbeans 7.4 as our IDE. It is assumed that you have installed the JDK 7 and have the Java FX Scene Builder installed and configured in your computer. Our example will be scientifically oriented due to the author’s interests (I know, the content of the example is insubstantial.. but just for the fun of imagination). Let’s assume we are asked to build an application to register the data of an experiment in which some parameters need to be collected from a sample of rats in a laboratory.