Running Keras directly on TensorFlow

Keras is a high-level library/API for neural network, a.k.a. deep learning. You can write shorter, simpler code using Keras. At the time of writing, Keras can use one of TensorFlow, Theano, and CNTK as a backend of deep learning process.

From TensorFlow 1.4, Keras API became one of core APIs of TensorFlow. Therefore, you don’t need to install both Keras and TensorFlow if you have a plan to use only TensorFlow backend in Keras. In other words, you can run Keras in simple way with full GPU support if you have got nvidia-docker environment which is mentioned in my last blog post, “TensorFlow over docker with GPU support

In this post, I’ll show you how to modify original Keras code to run on TensorFlow directly.

Read More

Writing Spark batches only in SQL

Apache SparkTM is known as popular big data framework which is faster than Hadoop MapReduce, easy-to-use, and fault-tolerant. Most of the Spark tutorials require readers to understand Scala, Java, or Python as base programming language. But, in my opinion, SQL is enough to write a spark batch script.

In this article, I will show that you can write Spark batches only in SQL if your input data is ready as structured dataset. This means that you don’t need to learn Scala or Python, RDD, DataFrame if your job can be expressed in SQL. Moreover, the expression power of SparkSQL may be stronger than you think.

The SQL scripts as follows can be found at https://github.com/sanori/spark-sql-example. You can test them yourself.

Read More

Running Spark on Scala Worksheet

In developing with Spark, you would want to try some queries or instructions and get results immediately to check if your idea is working or not. Sometimes, just trying to run the code would be faster than look through the reference manual.

Scala Worksheet is a REPL(Read-Eval-Print Loop) on text editor in an IDE(integrated development environment) such as Scala IDE (on Eclipse) and IntelliJ IDEA. You can try commands, functions, object definitions, and methods on Scala Worksheet(.sc) file, and you will get the results when you save that file. Since Scala worksheet runs on IDE, you can get help such as code completion.

In this post, a template to run Spark on Scala Worksheet is presented. The template was made to be general as possible.

Read More

Writing Command Line Scripts in Node.js

I was new to node.js 4 month ago and my main programming language was Python and C. I was motivated to try node.js by the regex-dna benchmark that shows JavaScript V8 is about 7 times faster than Python 3, and even faster than C implementation.

Jack Franklin’s article, “Writing Command Line Tools with Node” was very helpful for me. The article shows that npm and package.json play an important role in running environment independent of OS, the importance of first line, basic command line argument processing and the way to invoke other commands.

In this post, I would like to share more tips to write scripts in node.js, JavaScript.

Read More