Researchers, probably just for fun, asked that question - and surprisingly, a pretty funny (albeit a little artificial) dialogue is what came out. Watch the video here
I find it hilarious :-D
Michael Kutschke's blog about the wonderful world of computer science, and whatever.
Tuesday, September 13, 2011
Thursday, September 1, 2011
The greatness of CSV
CSV - comma-seperated values - is a simple file-format you all should know. It just consists of values, seperated by commas (or tabs, or whatever), with linebreaks seperating, well, the different lines (or records, or whatever your data may look like). You probably already knew that.
Now, let's suppose you have some data, in a CSV table. Let's also suppose the first line contains the names of the columns, like that:
"No.", "Name", "Price"
1, "Chocolade", 0.99
2, "Noodles", 0.39
and so on. As you see, really simple. Actually, why do i feel like writing about this stuff, it looks that simple you wouldn't think it's interesting to talk about it altogether. I mean, there are things like JSON nowadays...
The reason is, i found you can do an incredible lot with those simple CSV-tables.
1. easy to generate, easy to parse, thus also easy to transform in other formats
2. easy to combine, if you have several matching tables. A quick sed '1d' file1 >> file2 does the job
3. stripping the header, it is also easy to sort the lines using the sort command (see manpage)
4. import in programs like Excel, OpenOffice Calc, etc.
5. direct plotting with gnuplot http://www.gnuplot.info/docs_4.2/gnuplot.html#x1-17200043.14
6. many database programs support CSV as data source, so SQL querying is also an option. I haven't found a command-line tool to integrate SQL-Queries in a scripting workflow, but writing such a tool is not the biggest effort.(there are open-source CSV-database drivers or similar out there, for example h2database has commands to read from and write to CSV-files)
7. as i wrote here, there are also tools to directly transform a CSV-table to a LaTeX-table.
8. data-mining applications like Weka...
9. you name it ;-)
Now, let's suppose you have some data, in a CSV table. Let's also suppose the first line contains the names of the columns, like that:
"No.", "Name", "Price"
1, "Chocolade", 0.99
2, "Noodles", 0.39
and so on. As you see, really simple. Actually, why do i feel like writing about this stuff, it looks that simple you wouldn't think it's interesting to talk about it altogether. I mean, there are things like JSON nowadays...
The reason is, i found you can do an incredible lot with those simple CSV-tables.
1. easy to generate, easy to parse, thus also easy to transform in other formats
2. easy to combine, if you have several matching tables. A quick sed '1d' file1 >> file2 does the job
3. stripping the header, it is also easy to sort the lines using the sort command (see manpage)
4. import in programs like Excel, OpenOffice Calc, etc.
5. direct plotting with gnuplot http://www.gnuplot.info/docs_4.2/gnuplot.html#x1-17200043.14
6. many database programs support CSV as data source, so SQL querying is also an option. I haven't found a command-line tool to integrate SQL-Queries in a scripting workflow, but writing such a tool is not the biggest effort.(there are open-source CSV-database drivers or similar out there, for example h2database has commands to read from and write to CSV-files)
7. as i wrote here, there are also tools to directly transform a CSV-table to a LaTeX-table.
8. data-mining applications like Weka...
9. you name it ;-)
Tuesday, July 26, 2011
Converting an Excel/CSV table to LaTeX
Hi! Obviously, if you are reading this, you want a way to convert your Excel/CSV-tables to a latex table. There are some tools out there (csv2latex), but i also found this simple online converter i'd like to share:
Excel To Latex
Works with Excel Tables, CSV, and tables with other seperators as well. It does not, however, generate the table header, so you have to do that on your own.
I find this a little easier to use than a command-line tool, but of course such a tool is still useful for some. Just sorch for csv2latex.
Excel To Latex
Works with Excel Tables, CSV, and tables with other seperators as well. It does not, however, generate the table header, so you have to do that on your own.
I find this a little easier to use than a command-line tool, but of course such a tool is still useful for some. Just sorch for csv2latex.
Saturday, July 16, 2011
LaTeX: Referencing Figures
You may have had the following problem:
You want to reference a figure in your LaTeX-document, but instead of it's number, you get the section/subsection number.
First, the solution: You simply have to put the \label after the \caption of the figure.
Second, why: It seems the caption is the thing that actually SETS the number. This is a "feature" that allows multiple captions/labels per figure.
You want to reference a figure in your LaTeX-document, but instead of it's number, you get the section/subsection number.
First, the solution: You simply have to put the \label after the \caption of the figure.
Second, why: It seems the caption is the thing that actually SETS the number. This is a "feature" that allows multiple captions/labels per figure.
Wednesday, June 8, 2011
Can you boot from an email-account?
Hi! You know how there are programs like Gmail Drive that let you use your email account as normal storage space? And you also know how you can boot from the network, right?
Now, if we had our OS mirrored to our Gmail account using Gmail drive, and have some other PC forward the virtual drive to us over the LAN, could we actually boot from that?
I'd love seeing anyone trying this and tell about his experience. Of course there is absolutely no use to this, but i felt it would be a funny experiment.
Now, if we had our OS mirrored to our Gmail account using Gmail drive, and have some other PC forward the virtual drive to us over the LAN, could we actually boot from that?
I'd love seeing anyone trying this and tell about his experience. Of course there is absolutely no use to this, but i felt it would be a funny experiment.
Monday, June 6, 2011
Google Flu Trends
Hi, check out this: Google Flu Trends
Apparently, Google is generating flu statistics from their search statistics - and it seems to work! Makes you wonder what other kind of information might be hidden in that statistical data, doesn't it?
Apparently, Google is generating flu statistics from their search statistics - and it seems to work! Makes you wonder what other kind of information might be hidden in that statistical data, doesn't it?
Infinity: Hypercubes
We all know what a square and a cube is, and their generalization for higher dimensions is called Hypercube.
Now, let's see... A square has four vertices (0,0) , (0,1), (1,0), (1,1), thus representing 2 bits of information in it's vertices. A cube has 8 = 2^3 vertices and so on... You get the image.
According to wikipedia, the human genome has 3 billion DNA base pairs. We ll know there are four bases, thus every base encodes 2 bits of information. Any human's DNA is therefore one vertex of a 6 billion dimensional Hypercube. Somewhat scary, isn't it? Even more if we realize that all humans together, wo ever lived and will live, only cover an incredibly small subset of the vertices of that hypercube.
Now, let's get to something bigger - Infinity. We can encode every natural number as an infinite sequence of 0's and 1's. Therefore, every natural number is a vertex of an infinite dimensional hypercube. Note that the power set of the natural numbers can as well be expressed as an infinite sequence of 0's and 1's showing whether a number is in the subset or not. However, this does not show N = P(N), as N does not cover any vertices with an infinite amount of 1's in the sequence, while P(N) does. P(N) actually covers ALL vertices of that hypercube.
Now to an even fancier Vector space: The space of R -> R is also a vector space, but this space has uncountably infinite base vectors. R -> {0,1} is a subset of that space, our hypercube again (this time with oncountably infinite dimensions).
... Wait a second, didn't the last one look familiar? Right, looks like binary classification, doesn't it? Binary classifiers are the vertices of that last hypercube. This can be generalized to R^d -> R, but i won't discuss that further. Can we do search in such a space, maybe to find a binary classifier? Of course this is not as good as an SVM or even a Neural Network, but for the heck of it: Why not build a Bounding Volume Hierarchy (Bounding Squares, that is)? Here is how i imagine such an algorithm:
let train(i) be the i'th train data point. Let f(]x,y[) be defined such that for all x' in ]x,y[ f(x') = f(]x,y[) -> we are building some sort of hierarchical structure
1.) set f(]-∞,∞[) = 0
2.) partition(f,-∞,∞,0,n)
partition(f,a,b,i,j):-
3.) let m = (i - j)/2
3.) set f(]a,b[) = label(train(m))
4.) partition(a,train(m),i,m - 1)
5.) partition(train(m),b,m+1,j)
This should run in O(n) or O(n log n) depending on our data structures.
This can be generalized to more than 1 dimension, but it's obvious that this yields a classifier prone to overfitting (and also, i didn't want to invest too much time in something obviously bad).
Now, let's see... A square has four vertices (0,0) , (0,1), (1,0), (1,1), thus representing 2 bits of information in it's vertices. A cube has 8 = 2^3 vertices and so on... You get the image.
According to wikipedia, the human genome has 3 billion DNA base pairs. We ll know there are four bases, thus every base encodes 2 bits of information. Any human's DNA is therefore one vertex of a 6 billion dimensional Hypercube. Somewhat scary, isn't it? Even more if we realize that all humans together, wo ever lived and will live, only cover an incredibly small subset of the vertices of that hypercube.
Now, let's get to something bigger - Infinity. We can encode every natural number as an infinite sequence of 0's and 1's. Therefore, every natural number is a vertex of an infinite dimensional hypercube. Note that the power set of the natural numbers can as well be expressed as an infinite sequence of 0's and 1's showing whether a number is in the subset or not. However, this does not show N = P(N), as N does not cover any vertices with an infinite amount of 1's in the sequence, while P(N) does. P(N) actually covers ALL vertices of that hypercube.
Now to an even fancier Vector space: The space of R -> R is also a vector space, but this space has uncountably infinite base vectors. R -> {0,1} is a subset of that space, our hypercube again (this time with oncountably infinite dimensions).
... Wait a second, didn't the last one look familiar? Right, looks like binary classification, doesn't it? Binary classifiers are the vertices of that last hypercube. This can be generalized to R^d -> R, but i won't discuss that further. Can we do search in such a space, maybe to find a binary classifier? Of course this is not as good as an SVM or even a Neural Network, but for the heck of it: Why not build a Bounding Volume Hierarchy (Bounding Squares, that is)? Here is how i imagine such an algorithm:
let train(i) be the i'th train data point. Let f(]x,y[) be defined such that for all x' in ]x,y[ f(x') = f(]x,y[) -> we are building some sort of hierarchical structure
1.) set f(]-∞,∞[) = 0
2.) partition(f,-∞,∞,0,n)
partition(f,a,b,i,j):-
3.) let m = (i - j)/2
3.) set f(]a,b[) = label(train(m))
4.) partition(a,train(m),i,m - 1)
5.) partition(train(m),b,m+1,j)
This should run in O(n) or O(n log n) depending on our data structures.
This can be generalized to more than 1 dimension, but it's obvious that this yields a classifier prone to overfitting (and also, i didn't want to invest too much time in something obviously bad).
Subscribe to:
Posts (Atom)