Practical Java Machine Learning
Practical Java Machine Learning
Introduction
Chapter 1 establishes the foundation for the book.
It describes what the book will achieve, who the book is intended for, why machine
learning (ML) is important, why Java makes sense, and how you can deploy Java ML
solutions.
The chapter includes the following:
• Why this book does not cover deep learning, and why that is a good
thing
1.1 Terminology
As artificial intelligence and machine learning have seen a surge in popularity, there has
arisen a lot of confusion with the associated terminology. It seems that everyone uses the
terms differently and inconsistently.
1
© Mark Wickham 2018
M. Wickham, Practical Java Machine Learning, https://doi.org/10.1007/978-1-4842-3951-3_1
Chapter 1 Introduction
Some quick definitions for some of the abbreviations used in the book:
2
Chapter 1 Introduction
Much of the confusion stems from the various factions or “domains” that use these
terms. In many cases, they created the terms and have been using them for decades
within their domain.
Table 1-1 shows the domains that have historically claimed ownership to each of the
terms. The terms are not new. Artificial intelligence is a general term. AI first appeared
back in the 1970s.
Statistics Quantifies the data. DM, ML, DL all use statistics to Math departments
make decisions.
Artificial The study of how to create intelligent agents. Historical,
intelligence (AI) Anything that pretends to be smart. We program a Marketing, Trending.
computer to behave as an intelligent agent. It does
not have to involve learning or induction.
Data mining (DM) Explains and recognizes meaningful patterns. Business
Unsupervised methods. Discovers the hidden world, business
patterns in your data that can intelligence
be used by people to make decisions.
A complete commercial process flow,
often on large data sets (Big Data).
Machine learning (ML) A large branch within AI in which we build models Academic
to predict outcomes. Uses algorithms and has departments
a well-defined objective. We generalize existing
knowledge to new data. It’s about learning a model
to classify objects.
Deep learning (DL) Applies neural networks for ML. Pattern Trending
recognition is an important task.
3
Chapter 1 Introduction
Do not get hung up on the terminology. Usage of the terms often comes down to domain
perspective of the entity involved. A mathematics major who is doing research on DL
algorithms will describe things differently than a developer who is trying to solve a problem
by writing application software. The following is a key distinction from the definitions:
Data mining is all about humans discovering the hidden patterns in data,
while machine learning automates the process and allows the computer
to perform the work through the use of algorithms.
It is helpful to think about each of these terms in context of “infrastructure” and
“algorithms.” Figure 1-1 shows a graphical representation of these relationships. Notice
that statistics are the underlying foundation, while “artificial intelligence” on the right-
hand side includes everything within each of the additional subfields of DM, ML, and DL.
Machine learning is all about the practice of selecting and applying
algorithms to our data.
I will discuss algorithms in detail in Chapter 3. The algorithms are the secret sauce
that enables the machine to find the hidden patterns in our data.
4
Chapter 1 Introduction
1.2 Historical
The term “artificial intelligence” is hardly new. It has actually been in use since the 1970s.
A quick scan of reference books will provide a variety of definitions that have in fact
changed over the decades. Figure 1-2 shows a representation of 1970s AI, a robot named
Shakey, alongside a representation of what it might look like today.
Most historians agree that there have been a couple of “AI winters.” They represent
periods of time when AI fell out of favor for various reasons, something akin to a
technological “ice age.” They are characterized by a trend that begins with pessimism
in the research community, followed by pessimisms in the media, and finally followed
by severe cutbacks in funding. These periods, along with some historical context, are
summarized in Table 1-2.
5
Chapter 1 Introduction
1974 The UK parliament publishes research that AI algorithms would grind to a halt on “real
world” problems. This setback triggers global funding cuts including at DARPA. The crisis
is blamed on “unrealistic predictions” and “increasing exaggeration” of the technology.
1977 AI WINTER 1
1984-1987 Enthusiasm for AI spirals out of control in the 1980s, leading to another collapse of the
billion-dollar AI industry.
1990 AI WINTER 2 as AI again reaches a low-water mark.
2002 AI researcher Rodney Brooks complains that “there is a stupid myth out there that AI
has failed.”
2005 Ray Kurzweil proclaims, “Many observers still think that the AI winter was the end of
the story ... yet today many thousands of applications are deeply embedded in the
infrastructure of every industry.”
2010 AI becomes widely used and well funded again. Machine learning gains prominence.
6
Chapter 1 Introduction
• Fake data: Data is the fuel for machine learning (more about this in
Chapter 2). Proponents of this argument suggest that ever increasing
entropy will continue to degrade global data integrity to a point where
ML algorithms will become invalid and worthless. This is a relevant
argument in 2018. I will discuss the many types of data in Chapter 2.
It seems that another AI winter is not likely in the near future because ML is so
promising and because of the availability of high-quality data with which we can fuel it.
Much of our existing data today is not high quality, but we can mitigate this risk by
retaining control of the source data our models will rely upon.
Cutbacks in government funding caused the previous AI winters. Today, private
sector funding is enormous. Just look at some of the VC funding being raised by AI
startups. Similar future cutbacks in government support would no longer have a
significant impact. For ML, it seems the horse is out of the barn for good this time around.
• Bitcoin
7
Chapter 1 Introduction
• Block chain
• Connected home
• Virtual assistants
• 3D movies
• 4K television
• Machine learning (ML)
Some technologies become widespread and commonly used, while other simply
fade away. Recall that just a few short years ago 3D movies were expected to totally
overtake traditional films for cinematic release. It did not happen.
It is important for us to continue to monitor the ML and DL technologies closely.
It remains to be seen how things will play out, but ultimately, we can convince ourselves
about the viability of these technologies by experimenting with them, building, and
deploying our own applications.
8
Chapter 1 Introduction
Cost of IT Leverage cloud service providers such as Google GCP, Amazon AWS, Microsoft
infrastructure Azure
Not enough Even if we cannot hire data scientists, ML requires developers to start thinking
experienced staff like data scientists. This does not mean we suddenly require mathematics PhDs.
Organizations can start by adopting a data-first methodology such as ML-Gates
presented later in this chapter.
Cost of data or There are many very expensive data science platforms; however, we can start
analytics platform with classic ML using free open source software and achieve impressive results.
Insufficient data There exists a great deal of low quality data. We can mitigate by relying less on
quality “social” data and instead focusing on data we can create ourselves. We can also
utilize data derived from sensors that should be free of such bias.
Insufficient data Self-generated data or sensor data can be produced at higher scale by
quantity controlling sampling intervals. Integrating data into the project at the early
stages should be part of the ML methodology.
Using the above mitigation strategies, developers can produce some potentially
groundbreaking ML software solutions with a minimal learning curve investment. It is a
great time to be a software developer.
Next, I will take a closer look at ML data science platforms. Such platforms can help
us with the goal of monetizing our machine learning investments. The monetization
strategies can further alleviate some of these challenges and concerns.
• Monetize AI/ML
9
Chapter 1 Introduction
So what does it actually mean to “buy” a data science platform? Let’s consider an
example.
10
Chapter 1 Introduction
You wish to create a recommendation engine for visitors to your website. You
would like to use machine learning to build and train a model using historical product
description data and customer purchase activity on your website. You would then like
to use the model to make real-time recommendations for your site visitors. This is a
common ML use case. You can find offerings from all of the major vendors to help you
implement this solution. Even though you will be “building” your own model using
the chosen vendor’s product, you are actually “buying” the solution from the provider.
Table 1-5 shows how the pricing might break down for this project for several of the
cloud ML providers.
Google Cloud ML Model building fees $0.27 per hour (standard machine)
Engine Batch predictions $0.09 per node hour
Real-time predictions $0.30 per node hour
Amazon Machine Model building fees $0.42 per hour
Learning (AML) Batch predictions $0.10 per 1000 predictions
Real-time predictions $.0001 per prediction
Microsoft Azure Model building fees $10 per month, $1 per hour (standard)
ML Studio Batch predictions $100 per month includes 100,000
Real-time predictions transactions (API)
In this example, you accrue costs because of the compute time required to build your
model. With very large data sets and construction of deep learning models, these costs
become significant.
Another common example of “buying” an ML solution is accessing a prebuilt model
using a published API. You can use this method for image detection or natural language
processing where huge models exist which you can leverage simply by calling the API
with your input details, typically using JSON. You will see how to implement this trivial
case later in the book. In this case, most of the service providers charge by the number of
API calls over a given time period.
11
Chapter 1 Introduction
So what does it mean to “build” a data science platform? Building in this case
refers to acquiring a software package that will provide the building blocks needed to
implement your own AI or ML solution.
The following list shows some of the popular data science platforms:
• SAP: The large database player has a complete big data services and
consulting business.
• IBM: IBM offers Watson Studio and the IBM Data Science Platform
products.
The list includes many of the popular data science platforms, and most of them are
commercial data science platforms. The keyword is commercial. You will take a closer
look at Rapidminer later in the book because it is Java based. The other commercial
solutions are full-featured and have a range of pricing options from license-based to
subscription-based pricing.
The good news is you do not have to make a capital expenditure in order to build a
data science platform because there are some open source alternatives available. You
will take a close look at the Weka package in Chapter 3. Whether you decide to build
or buy, open source alternatives like Weka are a very useful way to get started because
they allow you to build your solution while you are learning, without locking you into an
expensive technology solution.
12
Chapter 1 Introduction
ML Monetization
One of the best reasons to add ML into your projects is increased potential to monetize.
You can monetize ML in two ways: directly and indirectly.
Table 1-6 highlights some of the ways you can monetize ML.
Many of the direct strategies employ DL approaches. In this book, the focus is mainly
on the indirect ML strategies. You will implement several integrated ML apps later in the
book. This strategy is indirect because the ML functionality is not visible to your end user.
Customers are not going to pay more just because you include ML in your
application. However, if you can solve a new problem or provide them capability that
was not previously available, you greatly improve your chances to monetize.
There is not much debate about the rapid growth of AI and ML. Table 1-7 shows
estimates from Bank of America Merrill Lynch and Transparency Market Research. Both
firms show a double-digit cumulative annual growth rate, or CAGR. This impressive
CAGR is consistent with all the hype previously discussed.
13
Chapter 1 Introduction
These CAGRs represent impressive growth. Some of the growth is attributed to DL;
however, you should not discount the possible opportunities available to you with CML,
especially for mobile devices.
14
Chapter 1 Introduction
There is a case for mastering the tools of CML before attempting to create DL
solutions. Table 1-8 highlights some of the key differences between development and
deployment of CML and DL solutions.
Algorithms
Algorithms are mostly commoditized. You do There is a lot of new research behind neural
not need to spend a lot of time choosing network algorithms. A lot of theory is involved
the best algorithm or tweaking algorithms. and a lot of tweaking is required to find the best
Algorithms are easier to interpret and algorithm for your application.
understand.
Data requirements
Modest amounts of data are required. You can Huge amounts of data are required to train DL
generate your own data in certain applications. models. Most entities lack sufficient data to create
their own DL models.
Performance
Sufficient performance for many mobile, web The recent growth in deep learning neural
app, or embedded device environments. network algorithms is largely due to their ability to
outperform CML algorithms.
Language
Many Java tools are available, both open Most DL libraries and tools are Python or
source and commercial. C++ based, with the exception of Java-based
DL4J. There are often Java wrappers available for
some of the popular C++ DL engines.
Model creation
Model size can be modest. Possible to create Model size can be huge. Difficult to embed models
models on desktop environments. Easy to into mobile apps. Large CPU/GPU resources
embed in mobile devices or embedded devices. required to create models.
(continued)
15
Chapter 1 Introduction
Monetization
Indirect ML Model APIsMLaaS
For mobile devices and embedded devices, CML makes a lot of sense. CML
outperforms DL for smaller data sets, as shown on the left side of the chart in Figure 1-7.
It is possible to create CML models with a single modern CPU in a reasonable
amount of time. CML started on the desktop. It does not require huge compute resources
such as multiple CPU/GPU, which is often the case when building DL solutions.
The interesting opportunity arises when you build your models on the desktop and
then deploy them to the mobile device either directly or through API interface.
Figure 1-4 shows a breakdown of funding by AI category according to Venture Scanning.
16
Chapter 1 Introduction
The data show that ML for mobile apps has approximately triple the funding of the
next closest area, NLP. The categories included show that many of the common DL
fields, such as computer vision, NLP, speech, and video recognition, have been included
as a specific category. This allows us to assume that a significant portion of the ML apps
category is classic machine learning.
17
Chapter 1 Introduction
Morpheus described the dilemma we face when pursuing ML in the motion picture
“The Matrix” (see also Figure 1-5):
“You take the blue pill, the story ends; you wake up in your bed and believe
whatever you want to believe. You take the red pill, you stay in Wonderland,
and I show you how deep the rabbit hole goes.”
Deep learning is a sort of Wonderland. It is responsible for all of the hype we have in
the field today. However, it has achieved that hype for a very good reason.
You will often hear it stated the DL operates at scale. What does this mean exactly?
It is a performance argument, and performance is obviously very important. Figure 1-6
shows a relationship between performance and data set size for CML and DL.
18
Chapter 1 Introduction
The chart shows that CML slightly outperforms DL for smaller data set sizes. The
question is, how small is small? When we design ML apps, we need to consider which
side of the point of inflection the data set size resides. There is no easy answer. If there
were, we would place the actual numbers on the x-axis scale. It depends on your specific
situation and you will need to make the decision about which approach to use when you
design the solution.
Fortunately, we have tools that enable us to define the performance of our CML
models. In Chapters 4 and 5, you will look at how to employ the Weka workbench to show
you if increasing your data set size actually leads to increased performance of the model.
Identifying DL Applications
Deep learning has demonstrated superior results versus CML in many specific areas
including speech, natural language processing, computer vision, playing games, self-
driving cars, pattern recognition, sound synthesis, art creation, photo classification,
irregularity (fraud) detection, recommendation engine, behavior analysis, translation,
just to name a few.
As you gain experience with ML, you begin to develop a feel for when a project is a
good candidate for DL.
19
Chapter 1 Introduction
• Simpler CML models are not achieving the accuracy you desire.
If you do decide to pursue a DL solution, you can consider the following deep
network architectures:
• Unsupervised pre-trained network (UPN) including deep belief
networks (DBN) and generative adversarial networks (GAN)
I will talk more about algorithms in Chapter 4. When designing CML solutions,
you can start by identifying the algorithm class of CML you are pursuing, such as
classification or clustering. Then you can easily experiment with algorithms within the
class to find the best solution. In DL, it is not as simple. You need to match your data to
specific network architectures, a topic that is beyond the scope of this book.
While building deep networks is more complicated and resource intensive, as
described in Table 1-8, tuning deep networks is equally challenging. This is because,
regardless of the DL architecture you choose, you define deep learning networks using
neural networks that are comprised of a large number of parameters, layers, and weights.
There are many methods used to tune these networks including the methods in Table 1-9.
20
Chapter 1 Introduction
21
Chapter 1 Introduction
While it is entirely possibly that DL can solve your unique problem, this book
wants to encourage you to think about solving your problem, at least initially, by using
CML. The bottom line before we move onto ML methodology and some of the technical
setup topics is the following:
Deep learning is amazing, but in this book, we resist the temptation and
favor classic machine learning, simply because there are so many equally
amazing things it can accomplish with far less trouble.
In the rest of the book, we will choose the blue pill and stay in the comfortable
simulated reality of the matrix with CML.
22
Chapter 1 Introduction
As developers, we write a lot of code. When we take on new projects, we typically just
start coding until we reach the deliverable product. With this approach, we typically end
up with heavily coded apps.
With ML, we want to flip that methodology on its head. We instead are trying to achieve
data-heavy apps with minimal code. Minimally coded apps are much easier to support.
23
Chapter 1 Introduction
R1: Create a shopping app so You identify the need for an in-store location-based solution
customers inside the physical to make this app useful. You can use a clever CML approach
store will have an enhanced user to achieve this. More about the implementation at the end of
experience. Chapter 6.
R2: Implement a loyalty program for Loyalty programs are all about saving and recalling
shoppers who use the app to help customer data. You can build a ML model using product
increase sales. inventory data and customer purchase history data
to recommend products to customers, resulting in an
enhanced user experience.
In this example, the client wants an in-store shopping app. These are perfectly valid
requirements, but these high-level requirements do not represent well-defined ML
problems. Your client has “expressed” a need to provide an “enhanced user experience.”
What does that really mean? To create an ML solution, you need to think about the
unexpressed or latent needs of the client.
The right column shows how to map the expressed requirements to well-defined ML
solutions. In this case, you are going to build two separate ML models. You are going to
need data for these models, and that leads you to ML-Gate 5.
24
Chapter 1 Introduction
25
Chapter 1 Introduction
ML-Gate 0: Deployment
At MLG0, it is time for deployment of the completed ML solution. You have several
options to deploy your solution because of the cross-platform nature of Java, including
26
Chapter 1 Introduction
Methodology Summary
You now have covered the necessary background on CML, and you have a methodology
you can use for creating CML applications.
You have probably heard that saying “When you are a hammer, everything looks
like a nail.” After becoming proficient in CML and adopting a data-driven methodology,
you soon discover that most problems have an elegant ML solution for at least for some
aspect of the problem.
Next, you will look at the setup required for Java projects in the book, as well as one
final key ingredient for ML success: creative thinking.
Java Market
Java has been around since 1995 when it was first released by Sun Microsystems,
which was later acquired by Oracle. One of the benefits of this longevity is the market
penetration it has achieved. The Java market share (Figure 1-8) is the single biggest
reason to target the Java language for CML applications.
27
Chapter 1 Introduction
Java applications compile to bytecode and can run on any Java virtual machine
(JVM) regardless of computer architecture. It is one of the most popular languages with
many millions of developers, particularly for client-server web applications.
When you install Java, Oracle is quick to point out that three billion devices run Java.
It is an impressive claim. If we drill down deeper into the numbers, they do seem to be
justified. Table 1-12 shows some more granular detail of the device breakdown.
28
Chapter 1 Introduction
The explosion of Android development and the release of Java 8 helped Java to gain
some of its market dominance.
Java’s massive scale is the main reason I prefer it as the language of choice
for CML solutions. Developers only need to master one language to produce
working CML solutions and deploy them to a huge target audience.
For your target environments, the focus will be on the following three areas that
make up the majority of installed Java devices:
Java Versions
Oracle supplies the Java programming language for end users and for developers:
• JRE (Java Runtime Environment) is for end users who wish to install
Java so they can run Java applications.
• JDK (Java SE Developer Kit) Includes the JRE plus additional tools for
developing, debugging, and monitoring Java applications.
29
Chapter 1 Introduction
All of the Java platforms consist of a Java Virtual Machine (JVM) and an application
programming interface (API).
Table 1-13 summarizes the current Java releases.
The most recent versions of Java have addressed some of the areas where the
language was lagging behind some of the newer, more trendy languages. Notably,
Java 8 includes the far-reaching feature known as the lambda expression along with
a new operator (->) and a new syntax element. Lambda expressions add functional
programming features and can help to simplify and reduce the amount of code required
to create certain constructs.
In the book, you will not be using lambda expression, nor will you use any of the
many new features added to the language in Java 10. Nonetheless, it is best to run with
the latest updates on either the long-term support release of Java 8 or the currently
supported rapid release of Java 10.
30
Chapter 1 Introduction
If you are looking for a comprehensive Java book, Java, The Complete Reference
Tenth Edition from Oracle, which weighs in at over 1,300 pages, is an excellent choice. It
covers all things Java. When it comes to Java performance tuning, Java Performance by
Charlie Hunt and John Binu is the 720-page definitive guide for getting the most out of
Java performance.
Installing Java
Before installing Java, you should first uninstall all older versions of Java from your
system. Keeping old versions of Java on your system is a security risk. Uninstalling older
versions ensures that Java applications will run with the latest security and performance
environment.
The main Java page and links for all the platform downloads are available at the
following URLs:
https://java.com/en/
https://java.com/en/download/manual.jsp
Java is available for any platform you require. Once you decide which load you
need, proceed to download and install. For the projects in this book, it is recommended
to install the latest stable release of Java 8 SE. For the Android projects, allow Android
Studio to manage your Java release. Android Studio will typically use the latest stable
release of Java 7 until the Android team adds support for Java 8.
Figure 1-9 shows the main Java download page.
Figure 1-10 shows the Java installation.
Figure 1-11 shows the completion of the installation.
31
Chapter 1 Introduction
32
Chapter 1 Introduction
Java Performance
Steve Jobs once famously said about Java, “It’s this big, heavyweight ball and chain.”
Of course, Apple was never a big fan of the language. One of the results or perhaps the
reason for Java’s longevity is the support and improvements added to the language over
the years. The latest versions of Java offer far more features and performance than the
early versions.
33
Chapter 1 Introduction
One of the reasons developers have been hesitant to choose Java for ML solutions is
the concern over performance.
Asking which language is “faster” or offers better performance is not really a useful
question. It all depends, of course. The performance of a language depends on its
runtime, the OS, and the actual code. When developers ask, “Which language offers the
best performance for machine learning?” we really should be asking, “Which platform
should I use to accomplish the training and building of machine learning models the
most quickly and easily?”
Creating ML models using algorithms is CPU intensive, especially for DL
applications. This book is about Java, but if you research ML, you know that Python
and C++ are also very popular languages for ML. Creating a fair comparison of the
three languages for ML is not easy, but many researchers have tried to do this and you
can learn from their findings. Since ML is algorithm-based, they often try to choose a
standard algorithm and then implement a comparison with other variables being equal,
such as CPU and operating system.
Java performance is the hardest of the languages to measure because of several
factors including unoptimized code, Java’s JIT compilation approach, and the famous
Java garbage collection. Also, keep in mind that Java and Python may rely on wrappers to
C++ libraries for the actual heavy lifting.
Table 1-14 shows a high-level summary of the performance for a mathematical
algorithm implemented in three different languages on the same CPU and operating system.
To learn more about the underlying research used in the summary, refer to these sources:
https://days2011.scala-lang.org/sites/days2011/files/ws3-1-
Hundt.pdf
https://arxiv.org/ftp/arxiv/papers/1504/1504.00693.pdf
https://blog.famzah.net/2016/02/09/cpp-vs-python-vs-perl-
vs-php-performance-benchmark-2016/
34
Chapter 1 Introduction
Table 1-14 is certainly not an exhaustive performance benchmark, but does provide
some insight to relative performance with possible explanation for the differences.
When you create prebuilt models for your ML solutions, it is more important to focus
on the data quality and algorithm selection than programming language. You should
use the programming language that most easily and accurately allows you to express the
problem you are trying to solve.
Java skeptics frequently ask, “Is Java a suitable programming language for
implementing deep learning?” The short answer: absolutely! It has sufficient
performance, and all the required math and statistical libraries are available. Earlier
in the chapter, I listed DL4J as the main Java package written entirely in Java. DL4J is
a fantastic package and its capabilities rival all of the large players in DL. Bottom line:
With multi-node computing available to us in the cloud, we have the option to easily add
more resources to computationally intensive operations. Scalability is one of the great
advantages provided by cloud-based platforms I will discuss in Chapter 2.
35
Chapter 1 Introduction
Android Android-specific development environment from Google. It has become the de facto
Studio IDE for Android. Offers a huge number of useful development and debugging tools.
IntelliJ IDEA Full featured, professional IDE. Annual fee. Many developers love IntelliJ. Android
Studio was based on IntelliJ.
Eclipse Free open source IDE. Eclipse public license. Supports Git. Huge number of plugins
available.
BlueJ Lightweight development environment. Comes packaged with Raspberry Pi.
NetBeans Free open source IDE, alternative to Eclipse. The open source project is moving to
Apache, which should increase its popularity.
The book uses two development environments for the projects depending on the
target platform:
• The Eclipse IDE for Java projects that do not target Android mobile
devices. This includes Java programs that target the desktop, the
browser, or non-Android devices such as the Raspberry Pi.
Android Studio
Google makes it easy to get started with Android Studio. The latest stable release build is
version 3.1.2 available April 2018. The download page is https://developer.android.
com/studio/.
Figure 1-12 shows the available platforms. Note that the files and disk requirements
are large. The download for 64-bit Windows is over 700MB.
36
Chapter 1 Introduction
Android Studio has really been improving the last couple of years. The full featured
development environment for Android includes
• Instant run
• Fast emulator
Figure 1-13 shows the show the Android Studio installation setup.
37
Chapter 1 Introduction
Figure 1-14 shows the shows the Android Studio opening banner including the
current version 3.1.2.
Android Studio uses the SDK Manager to manage SDK packages. SDK packages are
available for download. The SDK packages are required to compile and release your app
for a specific Android version. The most recent SDK release is Android 8.1 (API level 27),
also known as Oreo. Figure 1-15 shows the Android SDK Manager.
38
Chapter 1 Introduction
Always keep an eye out for updates to both Android Studio and the SDK
platforms you use. Google frequently releases updates, and you want your
development environment to stay current.
This is especially important for mobile development when end users are constantly
buying the latest devices.
Eclipse
Android mobile apps are a big part of our CML strategy, but not the only target audience
we have available to us. For non-Android projects, we need a more appropriate
development environment.
Eclipse is the versatile IDE available from the Eclipse foundation. The download
page is https://eclipse.org/downloads. Eclipse is available for all platforms. The
most recent version is Oxygen.3a and the version is 4.7.3a. Similar to Android, Eclipse
uses proceeds through the alphabet and, like Android, is also currently at “O.”
39
Chapter 1 Introduction
Similar to the options available for the Java distributions, developers can choose either
• Eclipse IDE for Java EE Developers (includes extra tools for web
apps), or
The latter is sufficient for the projects in this book. Figure 1-16 shows the Eclipse IDE
for Java Developers installation banner.
Eclipse makes it easy to get started with your Java projects. Once installed, you will
have the option to
The Git checkout feature is very useful, and you can use that option to get started
quickly with the book projects. Figure 1-17 shows the Eclipse IDE for Java Developers
startup page with the various options.
40
Chapter 1 Introduction
One of the big advantages of Eclipse is the huge number of plugins available. There
are plugins for almost every imaginable integration. Machine learning is no exception.
Once you get a feel for the types of ML projects you are producing, you may find the
Eclipse plugins in Table 1-16 to be useful. For the book projects, you will use a basic
Eclipse installation without plugins.
41
Chapter 1 Introduction
AWS Toolkit Helps Java developers integrate to the AWS services to their Java projects.
Google Cloud Tools Google-sponsored open source plugin that supports the Google Cloud
Platform. Cloud Tools for Eclipse enables you to create, import, edit, build,
run, and debug in the Google cloud.
Microsoft Azure Toolkit The Azure Toolkit for Eclipse allows you to create, develop, configure, test,
and deploy lightweight, highly available, and scalable Java web apps.
R for Data Science Eclipse has several plugins to support the R statistical language.
Eclipse IoT 80 plugins available.
Eclipse SmartHome 47 plugins available.
Quant Components Open source framework for financial time series and algorithmic trading.
42
Chapter 1 Introduction
• Creative thinking
• Bridging domains
One of the key success factors when trying to create ML solutions is creativity. You
need to think out of the box. It is a cliché, but it often takes a slightly different perspective
to discover a unique ML solution.
44
Chapter 1 Introduction
Bridging Domains
Everybody has access to the technologies in this book. How can we differentiate
ourselves? Recall from Table 1-1 in the beginning of this chapter, ML terminology
originates from different domains. Figure 1-20 shows a graphical view of the domains.
As developers, we approach the problem from the technology domain. With our toolkits,
we occupy a unique position, allowing us to produce Java ML solutions that lie at the
intersection of the domains.
Businesses have the data, the capital ($) to deploy, and many problems they need to
solve. The scientists have the algorithms. As Java developers, we can position ourselves
at the intersection and produce ML solutions. Developers who can best understand
the business problem, connect the problem to the available data, and apply the most
appropriate algorithm will be in the best position for monetization.
45
Chapter 1 Introduction
Key Findings
1. Adopt a data-driven methodology.
6. DL can operate at scale. The more data you can feed to the model,
the more accurate it becomes.
10. Think across domains. Bridge the gap between the technology,
business, and science domains.
46