On Characteristics of Machine Learning

My previous article, Do Neural Networks Dream of Pokémon? I have inferred it is not very effective use of the machine learning technology, and I wanted to do some follow up on that aspect.

First of all, the definition of machine learning is that technology that allows machine to determine outcome without explicitly programming covering all the cases. Generally, when the program is written, in context of normal application programs, programmers have already programmed what to do when certain things happens. For instance, if you write in URL to your web browser, it displays the page under that URL. It is because programmers who have programmed your web browser program to do that.

Therefore, with elements on Pokémon where all the combination of elements are already known, it is more reliable to program all the case for it. (And Pokémon is programmed to do so.)

Unlike the case above, machine learning is effective in the cases like below:

  • Cases where input parameters and their combinations are large, and is not practical to program for all.
  • There are unknowns and ambiguities in expected input.
  • Rate of change and characteristics in input is very subtle. (For it would require a lot more data to determine certain outcome, it is related to the characteristics on input parameters.)

For example, self-driving car is very difficult problem, because it is not possible to explicitly program virtually infinite cases that it has to deal with. (For instance, let’s say the self-driving car has to determine if someone’s standing on the road, it is not realistic to program for all the situations, for example, it can be varying weather, lighting condition, place where the person is standing, and their motion.)

However, there are way such ambiguities can be reduced, for example by the traffic infrastructure, such as traffic signals, and communications between cars, and while current self-driving car technologies focuses on co-existence between current cars and environment, but opposite approach of revising traffic infrastructure should be also taking place.

Before, Google CEO said “It’s a bug that cars were invented before computers” and if he meant that by having computer prior, traffic infrastructure would have been designed that way, I think he was right on.

Back to Pokémon, with Pokémon, it’s 18 elements that each can have up to 2 overlaps, and it is not a large information to process, and can be programmed so without too much of effort. However, if this becomes hundreds, and thousands, with varying overlaps, it becomes very difficult problem to program. (It is however, to program for their patterns, thus, it’s not something that has to be programmed one-by-one.)

Pokémon neural network I’ve experienced other day is a very simple case of neural network, but image recognition and other advanced recognitions are just mere extension of it.

Democratization of machine learning is certainly a big topic in near future, and my intent is to continue experimenting for it.

Do Neural Networks Dream of Pokémon?

One thing I wanted to experiment with TensorFlow (and neural network) is a some simple numerical processing. I have decided to put it into test.

I was looking for some subject, and then I noticed something about Pokémon Sun & Moon. There is a Festival Plaza feature in the game where players can play set of minigame. One of those minigame is where player can attempt to match “most effective” elements given a single or a set of element. For example, one of such example with be Bug and Grass — the answer is Fire gives Super Effective, which earns you point. There are four classes of effectiveness, from none to most effective are, No Effect, Not Very Effective, Normal and Super Effective.

There is a truth table on how this is layouted, but I wanted to see if some learning from mistake approach can predict outcome of this minigame.

Using a dozen of festival tickets, I’ve collected around 80 of log. Next quest is to research how these data can be normalized to test — as I am not yet very familiar with the way TensorFlow works in this regard, with a lot of focus on image recognition, it is surprisingly hard to find information about where numeral data is processed, then I stumbled upon existing effort by mtitg, using TensorFlow to see if TensorFlow can predict survivors of Titanic incident based on multiple parameters.

mtitg’s example uses many parameters, 8 to be exact, but in my case, I will be using three. mtitg’s code is very great starting point as it covers topics about how textual data can be prepared to be converted to numeral value for TensorFlow to process.

I have adopted mtitg’s code to work with my test data.

Long story short, with my limited testing on 80, it turns out to be 50% at most I can get leverage out of. I think the reason as follows:

  • Not enough variety of data; since this is obtained through manual process, there are manual process and considering fairly complexity of Pokémon’s elements, data represented is certainly not a exhaustive set of data.
  • Too many “Normal” outcome. Default for most of outcome that are not affected by certain elements, for example, fire element for bug is normal. Thus data tend to revert to normal, which provided more example where outcome is normal than other three classes.
  • Perhaps neural network is not very good approach for this problem. Perhaps simple logistic regression, and/or Bayesian algorithms would work better.

Conclusion

As I wrote earlier, with existence of actual element pairing data, there is no practical reason of this attempt; it’s really for learning and fun, after all.

With further optimization and research, TensorFlow and machine learning method have a great potential in making sense of data as well as to provide added value from dataset that may be already present. Machine visions and self-driving cars are very cool application for the machine learning technologies, but we shouldn’t forget adopting this technology on our personal computers we already have.

Jupyter the Python Based Notebook System

Jupyter the Python based notebook system

Started using fairly recently, there is a tool called Jupyter. Characteristics are:

  • It is based on Python; it was originally called IPython which provided interactive Python environment.
    • It now supports more than Python, thus is now developed under Project Jupyter. IPython, however, is still in development for providing interactive Python environment, which Jupyter uses for its Python execution.
  • For the format options, it is possible to use Markdown (and LaTeX!) for documentation.
  • Code can be executed within the notebook.

and more. (I really use this with Python only, and I cannot tell much about other part where some other languages are used.) I personally like:

  • It can use many features in Python. For instance, libraries such as Tensorflow can be used. Depending on the purpose, libraries like SciPy, NumPy to perform advanced calculation and plotting, SymPy to use it as a CAS (Computer Algebra System) to do symbolic math, and use Pandas and Python internal libraries to interact with databases.
  • Notes can be saved to share. There is nbviewer that enable people to view notebooks right on the browser. Services like GitHub uses it on Gist which can display the notebook.
  • Codes can be saved as Python, which makes it a development environment that can execute Python expressions interactively. Written notes are exported as a comment.

I have done installation on Linux and Windows, and I found Anaconda to be easy to install. (Anaconda uses it as a based on its commercial platform, and additional features are available for purchase thus making it scalable platform where these modules and supports are needed and have enough budget to do so. It is however, is bit too expensive for personal use.) For Linux, you can just use pip to install Jupyter on pre-existing installation. I will write more some details as I feel like it.

Why 28-backspace Vulnerability is not so Serious?

There have been news being circulated around regarding 28-backspace vulnerability of a Linux bootloader, Grub2.

Why this is not a serious problem? Because relying your security on bootloader is utterly stupid to begin with. If someone has a physical access to your machine, that means, they can easily bypass limitations set by a boot loader. It is a very simple feat to create a thumbdrive with a bootloader without such authentication in place, whether this vulnerability exists or not. Therefore, the existence of this vulnerability does not provide any difference from a security standpoint.

To protect a system with this type of issues, you’ll have to take steps like:

  • Limit physical access to the device.
  • Encrypt root partition

If only thing this protection on this Grub2 feature provides, that’s an illusion of security, maybe we are better off without this feature. (If someone’s so concerned about giving access to rescue shell so easily, in casual operation, then remove a rescue shell from Grub2 installation. If system administrator ever needs one, just boot from external media with rescue shell access.)

T-mobile Roaming in Japan

I was traveling Japan earlier, from March 23rd, to March 30th. This was my first time traveling with my phone set to roam. The last travel before that was precisely 7 years 1 month 24 days before this trip, and I did not roam for two reasons back then; one it was cost prohibitive, and secondly, back around that time, I did not have a phone capable of roaming; back in time, I was using T-mobile MDA, essentially a renamed version of the HTC Wizard, which was an EDGE capable, which basically meant there’s no roaming available in Japan. (Japan is one of the few countries out there never had seen GSM deployment.)

Forwarding the clock for 7 years 1 month, 24 days, now I have a Nexus 5, which supports LTE and UTMS. This meant finally I am capable of trying out roaming in Japan. Coincidentally, as a part of T-mobile’s Un-Carrier initiative, they have made available free roaming (albeit with some limitations) available to simple plan subscribers, which basically gave me a chance to try it out.
The premise is that, I get data and text roaming free of charge (data locked to 128Kbps) and calling at $0.20/minutes. Latter pricing is not actually too bad, as some of their domestic plan can come very close or even exceed that at high margins. (For example, Softbank would charge 20 yen — roughly 17 cents per 30 seconds in their White Plan, and DOCOMO would also charge up to 20 yen, but generally more like 11 to 15 yen, that’s 9 to 12 cents. Although in Japan, receiving the call is free as a caller actually picks up that bill, but in case of roaming, both making and receiving a call incurs charges, just like they would in domestic calls in the US.)

Getting off the plane, I have waited for a while, until the phone receives signal. Actually the phone force restarted, but it probably has nothing to do with the roaming; perhaps it’s something to do with the Android 5.1 issue, but once that’s over, it was a fairly smooth ride. The phone received a signal, showing JP DOCOMO as a carrier. Then I received the following two messages from 156 number:

Free T-Mobile Msg: Welcome to Japan. Unlimited text incl with your global coverage. Talk $0.20/min. More info http://t-mo.co/tc

Free T-Mobile Msg: Unlimited web included as part of your global coverage. To purchase high speed data please visit: http://t-mo.co/4G-Data

After a while, I have also received the following from 889 number:

Free T-mobile Msg: For faster web browsing, you can purchase a high speed data pass at: http://t-mo.co/4G-Data

The data pass, which I did not purchase, comes in three increments: 100MB for $15.00 (expires in a day), 200MB for $25.00 (expires in a week) and 500MB for $50.00 (expires in two weeks) — again, I did not purchase these so I can’t speak of experiences using those add-ons. These are still bargains, considering non-simple choice plan would incur $15.00 per MB. While connected to Japanese network, it was locked to UTMS. I am not sure if it’ll be the case with these optional packages or whether purchasing one of these options would unlock access to LTE network.

Pulling IP address of the device showed that it was T-mobile USA’s IP range, which was not surprising considering the packet would still go through their access point, even though it is piped through Japanese network. At 128Kbps, I was worried that my data experience suck, however, it handled fairly well, especially after I turned off most of background backups of photos. It handled things like Facebook post, and Instagram fairly well.

Messaging applications naturally did not have any issues. One thing I noticed is when I jumped from one carrier to another (the network I could roam was on DOCOMO, as well as Softbank) and occasionally, especially when I was emerging out from no-signal area to coverage area, for some reason, it took a while to phone to realize that I have a data connection. This intermittent connection issue was somewhat annoying, but not critical for most of my applications.

Google Maps operated and helped a lot navigating a massive network of Tokyo train systems. Browsing experience was not too bad either; this probably also have helped by the fact that Google Chrome compresses data for me in the background.

Softbank and DOCOMO mobile cell towers -- my device probably roamed both of those towers at some point!
Softbank and DOCOMO mobile cell towers — my device probably roamed both of those towers at some point!

In any case, having some form of connectibility was way better than having nothing, and the first try with T-mobile free roaming was a very pleasant one. Now I can’t wait to go back again! 🙂

Working Around Extreme Lag of Google Chrome

Update (2016-02-22): Developers have implemented changes to address this issue. While you won’t see the benefit of these changes immediately, it is certainly “coming soon” at this point.

I have been experiencing excessive lag on Google Chrome on Linux for a while, and I have been searching for solutions. The issue itself, has been reported in different incarnation of bug reports, including issue #424082 on Chromium bug reporting system.

Recently, it was tracked by one of the Chromium developers that some font configuration is causing an unnecessary call to fontconfig, giving it bit of a performance penalty.

Perhaps this problem wouldn’t have affected so much about western fonts, because of relatively less load involved in the system to parse western font sets (though I’d think increased CPU load would have been observed, albeit in shorter duration.)

If you are affected by this issue, you’d seen a significant lag in UI interaction, including input to the Omnibox, as well as other actions such as menus.

Unfortunately, a good number of Japanese users may have been encountering this issue, as very common fonts (at least on Linux) such as IPA fonts would have been one of fontsets that can cause this issue.

To work around, in case of KDE, you will have to install kde-config-gtk-style and change GTK styling to use fonts other than ones affected by this issue. (On Gnome, it would be gnome-tweak-tool.)

Note that you will have to restart Chrome everytime you change this setting.

The Rhodanthe CA System

Recently, the hosting company I use made it compatible to use Server Name Indication to support SSL/TLS. This has made it possible for me to encrypt many of sites under HidekiSaitoCom domain. Currently, as written in HidekiSaitoCom PKI Information some of my sites utilize certificates issued by StartSSL. The problem of StartSSL is that its limitation calls for a fee for each revocations issued, and this is mandatory for generating a replacement certificate; the problem that can be very critical for low budget sites such as mine. Certificate costs are not negligible for websites with virtually no income. These problems are perhaps one’s aimed to be fixed by Let’s encrypt project, but its implementation is still far, and considering server side implementation seems to be necessary with their model, it is still unknown when this would be available to me.

One way to solve this problem is to use Self-signed Certificate which basically a certificate that attests itself, however, as a promoter of GnuPG I thought of handling this slightly better. Meet Rhodanthe CA.

Rhodanthe CA Diagram
Rhodanthe CA Diagram

The goal of Rhodanthe CA is not to authenticate the site, however, it is mainly used to offer opportunistic encryption scheme, using root certificate that can be externally verified using an OpenPGP key. Feature for the CA includes root certificate, intermediate certificates, and also offers Certification Revocation List. Considering the upcoming Let’s Encrypt feature seems to aim to provide a light-weight basic level of domain matching authentication, other than seeing scary warning when accessed without importing the root certificate, it should offer just as good security. Perhaps, in the future, actual authentication is more bound to Extended Validation Certificates; it’s very important that we provide functional encryption to the site.

As a side story, major corporation such as Google owns its own Certificate Authority. They have this functionality by having root certificate authority to sign their CA key, which effectively makes Google’s CA Intermediate Certificate Authority to the root CA (in their case GeoTrust) in order to issue certificates for Google’s services. The problem of this is the cost and burden such as Certificate Practices Statement; what is beyond for individuals like myself to apply for.

The Endless Debates: E-mail Signature

The Endless Debate covers topics that seems to come up again and again, which seems to have no winner in the end. The classic example of it is the number of spaces after the period. (This particular topic is not covered by me yet, but I will certainly get to it at some point, stay tuned!) The purpose of this series is to not attach people with the opposite view, rather, it’s an exploration of ideas, with the main focus on history, technology, and practicality.

In this article, I will be covering E-mail signature placement, which also covers reply styles.

What’s an E-mail Signature?

If you are sending E-mail daily basis, you know what is it. As many articles1 claims E-mail usages among young people are feeling, let me explain what it is.

Hi,
My E-mail is my password.
Verify me.

-- 
Werner Brandes
Playtronics Corporation

Bottom of E-mail, with the name and the company name is an E-mail signature block.

A Typical E-mail Structure
A Typical E-mail Structure

What’s the argument?

With a single message (or the first message in the thread), there’s not much room for arguments; you begin by starting your message, and then you sign the message at the bottom. This starts to get a bit complicated when someone replies. I will illustrate two cases:

The first one:

Werner Brandes writes:
> Hi,
> My E-mail is my password.
> Verify me.
> 
> -- 
> Werner Brandes
> Playtronics Corporation

Who are you?

-- 
Cosmo
Playtronics Corporation

and the second one…

Who are you?

-- 
Cosmo
Playtronics Corporation

Werner Brandes writes:
> Hi,
> My E-mail is my password.
> Verify me.
> 
> -- 
> Werner Brandes
> Playtronics Corporation

You see two different approaches? The first example is called interleaved-posting and the second one is called top-posting.

What’s the specification say?

Currently, there aren’t any specification stipulate the way E-mail signature need to be placed. It is, however, the convention is to use “-- ” (two dashes, plus space) followed by a new line to separate E-mail signature from the body.

Many E-mail systems assume that this convention is used, for example Mozilla Thunderbird would dim the portion after the separator, visually separating the section of a message from the body. Gmail also treats it differently, too.

Implementations

Gmail

Gmail has a checkbox that says “Insert this signature before quoted text in replies and remove the “-- ” line that precedes it.” Apparently, it removes “-- ” so to prevent many E-mail software to mistreat quoted text as signature blocks.

Mozilla Thunderbird

Mozilla Thunderbird defaults to interleaved-posting style. Can be configured to top post. Like Gmail, I believe it also removes “-- ” when it is set to do top posting.

Microsoft Outlook

I do not actually know how this works with Microsoft Outlook. Mainly because I don’t even have a license for it. I’m assuming it’s using top posting.

Semantic differences

If the purpose of the signature is denote your ownership of the message, there are several ways you can view it. Perhaps, mainly this comes from the way one perceives quoted text.

Quoted text as transcript

This approach takes quoted text as a transcript of the message – therefore the message is signed at the end of the reply. Quoted text is thought to be a transcript, so the sender is not signing it, because it’s not his/her text.

Quoted text as treated text

This is the consideration that quoted text no longer holds parity to the originally replied message, even when they are identical. This is fair view that once it is quoted by someone else, the message was physically outside of original sender’s control.

Rational is that quoted text may or may not be modified, thus signature is very bottom of the message.

Conclusion

It’s actually really pointless arguments, for sure. Consider this, with E-mail system, we already face enough of a difference.

Many E-mail software (Mozilla Thunderbird, Gmail, and countless others) uses Usenet quoting for replying. Which basically means, something like this:

Werner Brandes writes:
> Hi,
> My E-mail is my password.
> Verify me.
> 
> -- 
> Werner Brandes
> Playtronics Corporation

While some use forward quoting (Microsoft Outlook and some others):

----Original Message-----
From: Werner Brendas
Sent: Wednesday, November 26, 2014 8:20 AM
To: Cosmo
Subject: My password

Hi,
My E-mail is my password.
Verify me.
 
-- 
Werner Brandes
Playtronics Corporation

And mixing those two:

-----Original Message-----
From: C
Sent: Wednesday, November 26, 2014 1:32 AM
To: A
Subject: Foobar

Foo bar bar bar
A writes:
> Foo bar
> 
> B writes:
>> Foo bar bar
>>
>> -----Original Message-----
>> From: C
>> Sent: Wednesday, November 25, 2014, 9:00PM
>> To: B
>>
>> Foo bar
>>
>> A writes:
>>>
>>> Foo bar

You see? We are already forced to live much greater difference when it comes to E-mail. Placement of signature, or even reply style is least of our worries.

I Transitioned Local E-mail Management to Gnus

I have been mostly using E-mail on Gmail interface, as I use Gmail and Google Apps (or, I guess they changed their enterprise offering to Google Apps for Work…) I have been using Mozilla Thunderbird once in a while. In normal circumstance, it would have been OK, but here are some issue of bit slow for the load.

Basically my requirements were:

  1. I literally receive a few hundred of E-mail a day and it needs to be able to handle that. Not that I have to read over every single E-mail with details, but there are a handful of mailing list articles I’d like to triage.
  2. Being able to author and send text E-mail (more on it later)
  3. I use Mac and Linux, and cross platform is a must. (This is one of reasons, in addition to bitter experience in the past that I would never use Microsoft Outlook — in case someone would suggest this — and it’s not great at handling #1 point above.)
  4. Support OpenPGP
  5. It must be able to support multiple account (Home and Work)

So this left me with few choices. Pretty much even 3rd point would disqualify a lot of choices to begin with. Then I just thought, Emacs already has built-in mailer, and considering every platform I ever have to interact would have it already installed, mainly because I use it daily.

So this is how I landed on Gnus.

In the case of myself, the following was an advantage I have found of this set up:

  • It pretty much fulfills my requirements.
  • As far as authoring text E-mail, it’s one of the most powerful softwares you can find out there. After all, it’s a text editor.
  • Gives me full control, won’t try to hide things from me.
  • It’s relatively easy for me to service it myself to modify or extend its parameter and functionality, knowing some Emacs Lisp.
  • Works with Org-mode. (See here.)

Things I purposely didn’t consider are:

  • Search facility — I felt it’s better to leave it up to Gmail interface, considering how fast it can search. Beside some automatic tagging, pretty much my E-mail is managed chronologically, and searching for E-mail more than I can glance over would require some serious deep searching. I have determined that after E-mail gets old enough to past certain point, it would be too old to be useful, and never get touched. Although, I still keep a copy of it, they are pretty much dormant, so I tend to leave the structure flat.
  • Notification — The age of smartphone (and I even have smartwatch) made it quite unnecessary for me to receive notification from my mailer. Although I can have Gnus pull E-mail and notify of new E-mail arrival, I purposely didn’t configure it.
  • Richtext authoring — I do not need fancy HTML/Rich text authoring. If you know me, I don’t purposely send out E-mail with mark ups. I’d rather stick with plain text and occasional use of simplified markdown. (Only time you’d see any formatted E-mail is coming from me is when I send the message out from my phone — because Gmail for Android sends the message out that way. I don’t know the reasoning behind the use of formatted E-mail as opposed to plain text considering you can’t really take advantage of rich formatting on that app.) Occasionally some ill-behaving (and possibly misconfigured) mailer sends me E-mail without alternative MIME part for text. In this case, I’d just read that portion of E-mail on the browser. (K-H command works very well to make this happen.) By the way, if you send mail this way, your E-mail will be ignored and/or will be sent to the very end of my queue.

So if you care about those points, my experience wouldn’t be too useful to begin with, so you can stop reading here.

Considering I have multiple Gmail/Google Apps account, I had to have something that manages multiple SMTP address.
I used using ‘gnus’ to read mail article from the emacs 30 Day Challenge useful to configure this. What I did not do was fully automated the process of choosing SMTP server, as there are fairly complex set of E-mail aliasing I have to take care, so I left some manual control to configuring this information by myself when sending E-mail, specifically by configuring X-Message-SMTP-Method and From fields. The code from the site is still incorporated, to validate that only valid E-mail addresses are ever specified in such configuration. This is primarily done by the code like below:

(defun gnus-set-mail ()
  (interactive)
  (message-goto-from)
  (kill-whole-line)
  (insert "X-Message-SMTP-Method: smtp smtp.googlemail.com 587 example@gmail.com.com\nFrom: Example \n\n")
  (message-goto-body)
  )

Further, I’ve replaced the default key map for toggling thread view (gnus-summary-toggle-threads initially defined as C-M-t to C-c C-t simply because I use C-M-t for opening a console on my Linux machines. (I currently use KDE, but I find this shortcut like Unity useful.) Configuring this is actually easy, by the way:

(define-key gnus-summary-mode-map "\C-c\C-t" 'gnus-summary-toggle-threads)

Gnus contains powerful E-mail authoring feature called MML, which basically allows me to mark up MIME structure. This would allow me, for example, to insert arbitrary MIME parts into E-mail. While I don’t do so much of this, nonetheless, this would allow me to fine tune the way attachments are configured, for example.

Defining MIME parts, each with different character set.
Defining MIME parts, each with different character set.

Smooth sailing so far, but I like to improve few of process to fit my needs, which I will be exploring as they becomes necessary!

Google Camera Depth Map Collection

Some pictures interpreted by Google Camera

You can extract these using the following:

exiftool -X -b $1.jpg | sed -n -e 's/.*<XMP-GDepth:Data>\(.*\)<\/XMP-GDepth:Data>.*/\1/p' | base64 -d > $1_depthmap.png
exiftool -X -b $1.jpg | sed -n -e 's/.*<XMP-GImage:Data>\(.*\)<\/XMP-GImage:Data>.*/\1/p' | base64 -d > $1_preprocessed.jpg

IMG_20140501_223102

IMG_20140428_213657

IMG_20140425_130548

IMG_20140422_105423

IMG_20140421_233153

IMG_20140421_201310

IMG_20140421_191650

IMG_20140421_190502

IMG_20140421_190310

IMG_20140420_180758

IMG_20140420_145350

IMG_20140419_214114

IMG_20140419_201449

IMG_20140418_204300

IMG_20140418_200805

IMG_20140417_100545