1
$\begingroup$

I'm writing a paper and would like to describe my approach with formulas too. However, I have a problem with writing down the following mapping step (just a tiny step of my algorithm).

Imagine, that I have a vector of numbers (they are computer port numbers):

80, 22, 22, 443, 80, 443, ... , 80

Now I map them to the "categories" like this:

1, 2, 2, 3, 1, 3, ..., 1

where 80 is first category found, so it will be always mapped to 1, 22 - second category found, so it will be always mapped to 2, and so on.

Another example with vector of usernames, I map

bob, alice, bob, carol, bob, bob

to

1, 2, 1, 3, 1, 1

If you know R programming language, all I do is:

as.numeric(factor(v))

So now I want to describe it in the paper formally with something like:

"I have a dataset $D = \{c_1,c_2,...,c_n\}$, where each column is a vector of values:

$c_j = \{x_1,x_2,...,x_m\}$

now for each column $c_j$ I map it to

$c'_j = \{f_j(x_1),f_j(x_2),...,f_j(x_m)\}$, where $f_j(x)$ = ???"

so my question is what to write instead of ??? (Using words I can describe it as "mapping to category", but how to write it down using mathematical notation?)

$\endgroup$

2 Answers 2

2
+100
$\begingroup$

If you really want to intimidate your readers, do the following (for each column vector):

  1. Let $N$ be the number of items in the vector. Let $I = \{1, \dots, N\}$ be the index set of the objects in the vector. Let your vector be $(x_i)_{i \in I}$.

  2. Introduce a binary relation on $I$ by $i \sim j \iff x_i = x_j$. It is easy to prove that this is an equivalence relation.

  3. Let $\hat I$ be the quotient set $I / \sim$ and for each $i \in I$ let $\hat i \in \hat I$ denote its equivalence class under the relation $\sim$.

  4. Finally, create a new vector $(\hat i) _{i \in I}$ by putting on position $i$ its equivalence class $\hat i$. In your own notations, $f(x_i) = \hat i$.

This will make your readers collapse in awe and not understand anything, and your bosses humbly beg you to accept an increase of your salary (or order you shot for fearing that you would outsmart and next overthrow them).

$\endgroup$
5
  • 1
    $\begingroup$ Thanks, took a while for me to get it:) What about the following maybe easier version without binary relations: (1) let $c_j$ be a multiset and $\tilde{c_j} / = $ be a set of all equivalence classes for $c_j$. Let $K = \{1,...N\}$ be the index set of $\tilde{c_j}$, so that $\tilde{c_j} = (a_k)_{k \in K}$. Let's define surjective function $g: c_j -> \tilde{c_j}$, so that $g(x_i) = a_k$ and another surjective function $h: \tilde{c_j} -> K$, i.e. $h(a_k) = k$. Then I create a new vector $c'_j = \{f(x_1),...,f(x_n)\}$, where $f: c_j -> K$ is a surjective function, so that $f(x_i) = h(g(x_i))$. $\endgroup$ Commented Jan 23, 2016 at 21:21
  • $\begingroup$ That's correct as well. It's just that the concept of multiset is not much used by mathematicians, and I also don't know whether binary relations (equivalence relations, in particular) exist and are formulated in a similar way for multisets. If they do, then your version is equally good. $\endgroup$
    – Alex M.
    Commented Jan 23, 2016 at 21:27
  • $\begingroup$ I asked because actually I do not really want to intimidate readers, the goal is just to write research paper in a bit more formal way. $\endgroup$ Commented Jan 23, 2016 at 21:39
  • $\begingroup$ My opinion is that your solution is as (un)intimidating as mine. The idea is that not everybody knows about binary relations and quotient (multi)sets. If in your field this is considered mandatory knowledge, then you are fine. And I might have also exaggerated a little bit, for amusement; ignore that part of my answer. $\endgroup$
    – Alex M.
    Commented Jan 23, 2016 at 21:42
  • $\begingroup$ At least I didn't know (or at least remember) about binary relations and quotient sets before today:) I think, in the end it will depend on a place where I will submit a paper. My question is now answered. Thanks again. $\endgroup$ Commented Jan 23, 2016 at 21:44
0
$\begingroup$

Note: This answer is more a hint or an advice against formulas which are not essential for a proper understanding in a technical documentation. If your description is part of SW design specification or a technical user guide, it should be informative, precise and easy to read.

So, use formulas and technical terms the reader is familiar with and use them only if it is convenient for a proper understanding and a precise specification. In fact I think, that parts of your question act already perfectly valid as technical description. Maybe you need some more technical terms, in order to provide a proper documentation.

I suppose an accurate description of the data structure $D=\{c_1,c_2,\ldots,c_n\}$ already exists. So, we know what kind of data the columns $c_j$ may contain, we know about the specified maximum size of a column and the maximum number $n$ of columns in $D$.

If we describe a column $c_j$ in detail, it is convenient to denote it as $n$-tuple and not as set, since the ordering of elements is relevant. So, lets write \begin{align*} c_j=(x_1,x_2,\ldots,x_n) \end{align*}

Hint: In order to describe the mapping of the values of a vector to categories, which are in fact natural numbers you could use the familiar terms sequence numbers and FIFO and you could write

The elements $x_i$, which are e.g. port numbers or usernames are bijectively mapped to ascending sequence numbers starting from $1$ in FIFO manner. So, e.g. a vector $c_j$ of usernames is mapped to a vector $n_j$ of sequence numbers

\begin{align*} c_j&=(bob,alice,bob,carol,bob,bob,\ldots)\\ n_j&=(1,2,1,3,1,1,\ldots) \end{align*}

The explanation above together with your instructive example tells the reader formidably what he should know. So, I don't think, that formulas would help to improve this part of the documentation.

$\endgroup$
1
  • $\begingroup$ sorry, I cannot upvote anymore. I'm writing the research paper, there will be a lot of text there, and of course, I could avoid formulas at all. However, I wanted the paper to look a bit more formal, then I started looking for formulas, and then I was just curious, how to write it down correctly using math... Thanks again, I will consider your option if mathematical representation will look too scary. And in any way, I'm going to have some explanation/alternative text for each formula I use. $\endgroup$ Commented Jan 23, 2016 at 21:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .