Recognizing Arabic Letter Utterance using Convolutional Neural Network

Arabic letters have unique characteristics because of similarity of sound produced when reciting few letters. This paper present one of application Convolutional Neural Network (CNN) in speech recognition Arabic letters. CNN has shown very good performance for image and speech recognition int the last few years. This study examined the several types of CNN models as well as compare with some Deep Neural Network (DNN) models to speech datasets used. As a result, CNN with a convolution layer and one layer fully-connected managed to obtain an accuracy of up to 83.00%, far better than the traditional DNN that only able to reach 79.25%.

Download here: http://ieeexplore.ieee.org/document/8022720/

This is my first published paper,  not really good, or advance 🙁
but I hope it useful! 🙂

Belajar dari Stackoverflow

Salah satu yang berat menurut saya untuk belajar Artificial Intelligence/Machine Learning/Data Mining adalah untuk belajar saja, kadang kita perlu menuliskan sintaks kode yang lumayan panjang dan kompleks. Kadang hal ini yang bikin jadi down dulu sebelum memulai belajar.

Nah, salah satu solusi belajar yang saya temui cukup membantu saya adalah dengan aktif di Stackoverflow. Ya, bagi kita para programmer situs itu bukanlah situs yang asing. Kadang ketika kita menemukan eror atau kesulitan, lalu mulai googling untuk mencari solusi, maka Stackoverflow lah yang sering memberi jawaban.

Ketika saya menyarankan untuk ‘aktif’, di sini maksudnya bukan sekadar mencari jawaban orang lain tapi aktiflah untuk mencari pertanyaan dan memberi jawaban.

1. Mencari Pertanyaan

Ya, cobalah mencari pertanyaan yang setopik dengan materi yang ingin kalian perlajari. Telusuri satu persatu pertanyaan yang sudah pernah ditanyakan, siapa tahu kalian menemukan pertanyaan atau jawaban yang menarik yang sebenarnya cukup penting untuk ditanyakan tapi kita tidak pernah terpikirkan.

Dengan melihat jawaban orang lain kita juga jadi bisa menambah wawasan dengan menemukan solusi solusi menarik bagaimana orang menyelesaikan masalahnya.

2. Memberi Jawaban

Dengan mencoba menjawab beberapa pertanyaan, kita akan belajar untuk memahami lebih dalam materi yang kita pelajari. Kalau ada orang bilang, dengan mengajar ilmu kita bertambah, maka benar saja, dengan mencoba menjawab pertanyaan-pertanyaan di sana kita akan semakin bertambah wawasannya. Kita akan belajar bagaimana menjelaskan dan memberi contoh yang menjawab pertanyaan pengguna lain.

MVCE

Tips lain ketika ingin aktif di Stackoverflow adalah dengan membaca terlebih dahulu aturan di sana, seperti bagaimana cara bertanya dan menjawab yang baik. Di sini kalian akan mengenal istilah MVCE (Minimum Veriviable Complete Example), atau bagaimana memberikan contoh program kita yang eror secara minimalis. Kita akan belajar bagaimana menjelaskan eror pada program kita secara baik kepada orang lain.

Belajar AI

Dan salah satu manfaat yang saya dapat adalah dengan mencoba melihat dan menjawab pertanyaan-pertanyaan di Stackoverflow seputar AI/ML/DM kita akan mendapat wawasan sekaligus berlatih dengan jumlah baris kode yang ditulis tidak terlalu banyak 😉 Semoga Bermanfaat!

Latex : Insert Arabic Text in MIPA SKRIPSI TEMPLATE

Few days I was learning Latex for my Thesis. I use MIPA UGM SKRIPSI TEMPLATE for my work. It was created by Drs. Pekik Nurwantoro, Ph.D. then modified by my friend Yusuf Syaifudin. I was using pdflatex as command to compile latex file in my ubuntu machine, until I got stuck to insert arabic text in my document.

The real problem is because I use Template from MIPA UGM it is difficult to insert arabic font without broke anything. I was tried using babel or polyglossia but it always ended up compile error 🙁

I decided to using xelatex compiler because some people said it is difficult put arabic letter using pdf latex which doesn’t support unicode. Then after try many solutions I’ve found the best one:

1. Install XeTeX. sudo apt-get install texlive-xetex
2. Download arabic font. e.g. Scheherazade
3. Add this arabic font in your document:

 usepackage{fontspec}
 \newfontfamily\arabicfont[Script=Arabic]{Scheherazade}

4. use \arabicfont before your arabic text:

This is english document {\arabicfont وَهَذِهِ فِقرَةٌ بِالعَرَبِيَة مَعَ كَلِمَة اِنكلِيزِيَة } and this is the other english text.

When you compile using command xelatex yourdoc.tex, may be you will say “It works!” but actually don’t. When you see the result carefully it’s not RTL (right to left). So how to make it RTL?

5. Download bidi.tex from texdoc.net/texmf-dist/tex/xelatex/bidi/bidi.tex don’t use \usepackage{bidi} I don’t know it will make your document error. bidi.tex is a minimize version of bidi.

6. And input it after you define arabic font:

\usepackage{fontspec}
\newfontfamily\arabicfont[Script=Arabic]{Scheherazade}
\input{bidi.tex}

7. And now it really works! try to use \RL and \arabic font:

This is english document \RL{\arabicfont وَهَذِهِ فِقرَةٌ بِالعَرَبِيَة مَعَ كَلِمَة اِنكلِيزِيَة } and this is the other english text.
the result

Now you can use arabic font in MIPA SKRIPSI TEMPLATE 🙂 you can put the codes at point 6 in ADDITIONAL_PACKAGE.tex if you are using MIPA UGM SKRIPSI TEMPLATE. Hope it help! let me know if you have another solution 🙂

Refferences:

  • https://tex.stackexchange.com/questions/141867/minimal-bidi-for-typesetting-rl-text

Create Asynchronous Flask App Using Gunicorn-Gevent

The problem I’ve faced when trying to move machine learning to production is machine learning system usually takes time to compute or give a result. If you create an API (machine learning API) in super computer server or your API will be accessed by a very few people, you can ignore this problem but unfortunately I need this.

Asynchronous API

The first solution in my mind is to create an asynchronous API. What is it? The simplest explanation about asynchronous is from stackoverflow: You are cooking in a restaurant. An order comes in for eggs and toast.

  • Synchronous: you cook the eggs, then you cook the toast.
  • Asynchronous, single threaded: you start the eggs cooking and set a timer. You start the toast cooking, and set a timer. While they are both cooking, you clean the kitchen. When the timers go off you take the eggs off the heat and the toast out of the toaster and serve them.
  • Asynchronous, multithreaded: you hire two more cooks, one to cook eggs and one to cook toast. Now you have the problem of coordinating the cooks so that they do not conflict with each other in the kitchen when sharing resources. And you have to pay them.

So, I need to make my API able to run many request at the same time. (Another explanation : from codewala)

How to implement it?

There’s plenty way to implement it. But I think I’ve found the simplest solution, especially if you’ve created an API using Flask: Using Gunicorn and Gevent. First, you should install Gunicorn and Gevent, you can install it via pip:

pip install gunicorn
pip install gevent

To run your API using gunicorn the only difference you should make is the command when you need to run the app. Usually if you have a Flask app you run it with a command below:

python myapp.py

if you are using gunicorn then you should run it with a command below:

gunicorn myapp:app

`myapp` is your file name, and `app` is your flask app variable. After the app is running you can access it on http://localhost:8000 (notice the default port is changing, if you’re using Flask, you run your app in port 5000 but if using gunicorn you run it in port 8000).

It’s not finish yet, when you run using the command above, you just run it synchronously. Using Gunicorn, you can run it asynchronously without change any line of your code! just run it with the command below:

gunicorn -k gevent -w 5 myapp:app

-k option makes gunicorn run the program asynchronously using gevent service (there are more services which provide async like eventlet). -w option makes gunicorn create workers with specified number (in this example 5) (other reference: Workers).

And Congratulation, you just run your flask app asynchronously! if you want to test your API you can use apache benchmark. it can access your app many times simultanously. The example command is below:

ab -n 200 -c 100 http://localhost:8000/myapp

If you see the result, you will see the difference in number of request per second between you run it sync and async.

Thank you 🙂 I hope this note is helpful for me or anybody.

Reinforcement Learning Implementation

This is one of the results from my “Holiday Sprint” last month, get in touch with Reinforcement Learning!. The last two months I’m trying to implement algorithms from Sutton’s Book Reinforcement Learning: an introduction. It still in progress (I hope it will finish this semester), if you want to check the source codes you can see in my github repo : reinforcement-learning  and I’m glad to hear your suggestions 🙂

My learning path to learn reinforcement learning

So far, this is my learning path to learn the basic of reinforcement learning

  1. Read the Sutton’s and Barto’s Book, Reinforcement Learning: an Introduction. I read a few chapter, then I got confused a lot with many mathematical term 😐 so..
  2. I started to watch a lot of videos from Udacity Reinforcement Learning Course. It’s really fun watch the course there 🙂 they successfully simplified a lot of topics
  3. Reinforcement Lecture from David Silver on Youtube. These videos help me to understand difficult term from Sutton’s book.