Complexity of David

Data Science, Machine Learning, Artificial Intelligence, Visualization, and Complex Systems.

Why Are Ants So Smart?

Modeling tropotaxis in ant colonies: recruitment and trail formation ♣ Ants are marvelous little creatures.

Unifying Isolated and Overlapping Audio Event Detection with Multi-Label Multi-Task Convolutional Recurrent Neural Networks

Topological Approaches to Deep Learning ♣ This has to be a deep read… no pun intended. :-)

Building an Argument for the Use of Science Fiction in HCI Education

Sunday Networks on Arxiv

Nothing to do on a raining Sunday afternoon? I was going through the CS section of arxiv and a couple of submitted abstracts caught my attention.

The former is all about speech synthesis and I’ve seen much interest in this area. There will be game-changing applications and we are now past the time of robotic interaction voices of the sci-fi movies. The latter is about getting new backcloth to convolutional neural networks based on graphs. Hm… always an interesting read.

Machine Learning News

Uber Introduces PyML: Their Secret Weapon for Rapid Machine Learning Development

Facebook, NYU expand available languages for natural language understanding systems

Demystifying Convolutional Neural Networks

Turnilo — let’s change the way people explore Big Data

Significantly faster generation and training for AI-based audio systems

Interesting links in this collection today, namely PyML by Uber. It has become important to understand what they are doing right here as the world is moving fast in ML domains. And they are using Python. The FB links are of particular interest because of their application fields (NLP and audio systems). I’m interested in these two topics right now and was a surprise to come about this research.

Some Interesting Tek Readings

Golden Rules of Typography on the Web

Building AR/VR with Javascript and HTML

Node.js Guide for Frontend Developers

Drawing Images With CSS Gradients — HTML and CSS are so mature now that they are becoming a fun playground. Animations, transitions, drawing images… you name it.

Object detection with 10 lines of code — Interesting approach, but… not really 10 lines of code, just calling library functions doesn’t make it simple.

7 Performance Tips for Jank-free JavaScript Animations

How to Steel 50 Million Bees — An amazing story about an industry that is so invisible 99% of the time.

Are we stuck with cement? How one of the biggest industries in the world is not doing its part in getting a sustainable environment. Read and think about it. You next sustainable project might not be as clean as one thinks.

Why Is the for Loop Faster in This Javascript?

I’ve measured and tested and what not javascript loops and always came to the conclusion that we don’t know how Javascript is going to behave.

In the following example function f1 is substantially faster than function f2. Can’t understand why.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function tic() {
the_time = performance.now()
}

function toc() {
console.log(performance.now() - the_time)
}

function f1(z) {
let len = z;
let buff = []
for (let i = 0; i < len; i++) {
buff[i] = i;
}
return buff;
}

function f2(z) {
let len = z;
let buff = []
while (len--) {
buff[len] = len;
}
return buff
}
tic(); f1(2 << 20); toc();
tic(); f2(2 << 20); toc();

Your Results:

Normally I would say that the reversed while would be faster. It has been in other instances. But in this case we want to create an array with numbers from 0 to z-1. In this case the for loop is much faster (tested in Chrome, Firefox, Opera). What is going on? Is it a caches problem where JS engines expect the “straight” order and not the reverse one?

update

What if we pre-allocate the size of the buffer before iterating over it as in function f2. This would lead to the new function f2_new

1
2
3
4
5
6
7
8
9
function f2_new(z) {
var len = z;
var buff = [];
buff.length=len;
while (len--) {
buff[len] = len;
}
return buff;
}

Notice that I’m creating a buffer with the correct length before looping over it. If you run this version you’ll get the fastest while loop.

This version is now on par with the for loop and in some benchmarks it is substantially faster. So, order restored in the realm of Javascript. Me happy again.

Quick Way to Use Jeromq in Eclipse

  1. Download a jeromq JAR from the maven repository (current version 0.4.3) https://mvnrepository.com/artifact/org.zeromq/jeromq/0.4.3
  2. Place the jar file in a “lib” folder in your project.
  3. Add jeromq.jar to your project libraries in the Project Build Path
  4. Try the simple hwserver/hwclient examples https://github.com/zeromq/jeromq/tree/master/src/test/java/guide
  5. you can run both the server and clients from within eclipse, but if you want to run them from the command line:
  • Assuming that you are using eclipse, and that you placed the jar in a “lib” folder
  • go to your “bin” folder and run
  • java -cp "../lib/*:." HWServer

  • java -cp "../lib/*:." HWClient

  • Notice the codepath setting with -cp "../lib/*:." In windows you’ll have to replace the : with ;.

This will create a little setup that allows you to develop and experiment with jeromq.