MLBD Machine Learning is Fun! Part 3: Deep Learning and Convolutional Neural Networks

Here we follow along with the 3rd part of Adam Geitgey’s excellent introductory series Machine Learning is Fun! “Deep Learning and Convolutional Neural Networks”

For the original article, click here.

The example presented is an object recognition classifier to determine whether or not something is a bird.  To complete this tutorial you will need:

  • TFLearn
  • TensorFlow
  • Python 2.7
  • Birds and not birds data set

 

Original test script

Machine Learning by Doing

Machine learning by doing is a series following the best machine learning tutorials and examples posted around the internet and ensuring they are 100% repeatable.  Clearly defined version numbers for programming languages and packages, links to data sets and explanations of some of the lesser known functions we will encounter.

These examples are some of the best found on the web, but it is incredibly frustrating to find you are missing one small piece to re-create their results.

For the first post we follow along with Adam Geitgey in Part 3 of his “Machine Learning is Fun!” series.

Capitalized Case JavaScript code

 

Code adapted from stackoverflow.com ‘Convert string to title case with javascript‘ users Greg DeanBill the Lizard  licensed under cc by-sa 3.0

Delimiters

A delimiter is a sequence of one or more characters used to specify the boundary between separate, independent regions in plain text or other data streams. An example of a delimiter is the comma character, which acts as a field delimiter in a sequence of comma-separated values.

Common delimiters:

  • Tab
  • Colon
  • Semicolon
  • Comma
  • Space
  • Pipe
  • Hyphen

Delimiters in Excel

Excel uses delimiters in the Text to Columns function.  The options are tab (    ),  semicolon (;), comma (,), space ( ), or other which is an input field for a single custom character.

Intro paragraph from Wikipedia https://en.wikipedia.org/wiki/Delimiter

 

TensorFlow on Windows

TensorFlow is an open source (Apache 2.0) software library for Machine Intelligence created by Google

Windows 7

The two options are:

  • Run in Docker
  • Run in a Linux Virtual Machine (VM)

Windows 10

With the introduction of the Windows Subsystem for Linux (WSL) Windows 10 users have an additional option:

  • Run on Win 10
  • Run in Docker
  • Run in a Linux VM

 

Can you turn advanced custom fields into a standalone plugin?

The short answer is no, not completely standalone.

You can make a plugin from the output of the Advanced Custom Fields’ export to PHP option, but it still requires that the site have the full Advanced Custom Fields plugin installed.

There is a way to hide the ACF plugin’s user interface by defining define( ‘ACF_LITE’, true ); before including the acf.php file.

For simple custom fields, you might be better off defining them through native WordPress code https://codex.wordpress.org/Custom_Fields

Git plugins within WordPress on WP Engine

I am currently 0 for 2 in finding plugins for managing Git that play nicely with WP Engine.

The plugins I tried were:

  • Revisr
  • VersionPress

Goal

A way to commit and push changes from within the WordPress dashboard to a git based repository

Motivation

WP Engine’s approach for using git works well most of the time.  I don’t track the WP core in my repositories, but I do track plugins.  I do this to track custom developed plugins and bug fixes/enhancements to freely available plugins that never get pushed into their original code base.

The benefit of using managed hosting is that they automatically update plugins if necessary for security fixes.  The bad part is that these updates are only made on the production server and don’t end up in the repository.  Also, from time to time, they will ask you to remove a plugin from their disallowed plugins list.  If it isn’t removed within a week, they will remove the plugin and this change doesn’t end up in the repository either.  Additionally, managing plugin updates through the admin panel requires deleting the local copy, downloading the changes via SFTP, committing, and pushing to the remote.  The desired goal is to cut out these additional steps and commit directly from within the WordPress back-end.

Lastly, I also like knowing when plugins were first installed and especially if someone else requested the functionality.

Revisr

20160811-sot-revisr

Site: https://revisr.io/

WordPress.org: https://wordpress.org/plugins/revisr/

GitHub: https://github.com/ExpandedFronts/revisr

“I made Revisr to simplify the development process,” Matt Shaw the developer told WP Tavern. “There are currently no plugins on WordPress.org that allow developers or site admins to use all of the main features of Git through the WordPress dashboard, and I made Revisr to do just that,” he said.

I installed this plugin first, but wasn’t able to get it running without the installation path to git:

20160811-sot-revisr-git-not-detected

WP Engine doesn’t expose git for security reasons.  0 for 1 so far.

 

VersionPress

20160811-sot-versionpress

https://versionpress.net/

I installed VersionPress and got a notice that it required a newer PHP version on the server.

I admittedly installed this without checking the disallowed plugins list.  I got an email the next day informing that VersionPress is disallowed on WP Engine.

VersionPress — In order to function properly, this plugin needs access to server level functions that we disallow for security purposes. – WP Engine Disallowed Plugins

I am 0 for 2.

A final note

One interesting thing I read, but cannot seem to find again, is that one of these plugins has dropping the installed git requirement on its road map.  If I can find that again or becomes a reality, I’ll update here.

Self Driving Cars in the News

Crashes:

Near misses:

Other incidents:

Notable news:

Ethical issues:

Use the Advanced Custom Fields plugin for stashing code

Anyone working with code in the WordPress TinyMCE WYSIWYG editor will have had their code blown away when switching between “Text” (HTML) and Visual editing modes.

One of the many uses of Advanced Custom Fields plugin is to create a text area to stash code associated with a page or post that the editor can’t touch.

Using: https://www.advancedcustomfields.com/

It’s a similar idea to using the plugin to add custom JavaScript or CSS to a page/post, except the field isn’t exposed in the theme.

This serves to only store the code alongside the post/page in the database.

This will not prevent the editor from modifying the code again in the future if it is pasted back into the editor, but it is a convenient place to copy the code from again.

If you want a more permanent solution you could disable the visual editor, remove the filtering, or other options.

20160811-sot-acf-code-stash