Neural Network Programming with Java Create and unleash the power of neural networks by implementing professional Java code 1st Edition Souza download
Neural Network Programming with Java Create and unleash the power of neural networks by implementing professional Java code 1st Edition Souza download
https://textbookfull.com/product/artificial-neural-networks-with-
java-tools-for-building-neural-network-applications-1st-edition-
igor-livshin/
https://textbookfull.com/product/learning-network-programming-
with-java-1st-edition-reese-richard-m/
https://textbookfull.com/product/java-network-programming-fourth-
edition-harold-elliotte/
https://textbookfull.com/product/learning-java-beginning-
programming-with-java-for-dummies-first-edition-john-bach/
Learning Java An Introduction to Real World Programming
with Java Marc Loy
https://textbookfull.com/product/learning-java-an-introduction-
to-real-world-programming-with-java-marc-loy/
https://textbookfull.com/product/a-functional-approach-to-java-
augmenting-object-oriented-java-code-with-functional-
principles-1st-edition-ben-weidig/
https://textbookfull.com/product/learning-java-an-introduction-
to-real-world-programming-with-java-5th-edition-marc-loy/
https://textbookfull.com/product/motivation-effort-and-the-
neural-network-model-theodore-wasserman/
https://textbookfull.com/product/deep-learning-with-javascript-
neural-networks-in-tensorflow-js-1st-edition-shanqing-cai/
Neural Network Programming
with Java
Fábio M. Soares
Alan M.F. Souza
BIRMINGHAM - MUMBAI
Neural Network Programming with Java
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the authors, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78588-090-2
www.packtpub.com
Credits
Copy Editor
Tani Kothari
About the Authors
Fábio M. Soares holds a master's degree in applied computing from UFPA and
is currently a PhD candidate at the same university. He has been designing neural
network solutions since 2004 and has developed applications with this technique in
several fields, ranging from telecommunications to chemistry process modeling, and
his research topics cover supervised learning for data-driven modeling.
He is also self-employed, offering services such as IT infrastructure management as
well as database administration to a number of small- and medium-sized companies
in northern Brazil. In the past, he has worked for big companies such as Albras, one
of the most important aluminium smelters in the world, and Eletronorte, a great
power supplier in Brazil. He also has experience as a lecturer, having worked at the
Federal Rural University of Amazon and as a Faculty of Castanhal, both in the state
of Pará, teaching subjects involving programming and artificial intelligence.
He has published a number of works, many of them available in English, all
including the topics of artificial intelligence applied to some problem. His
publications include conference proceedings, such as the TMS (The Minerals Metals
and Materials Society), Light Metals and the Intelligent Data Engineering and
Automated Learning. He has also has published two book chapters for Intech.
Since I was a kid, I thought about writing a book. So, this book is a
dream come true and the result of hard work. I'd like to thank God
for giving me this opportunity. I'd also like to thank my father, Célio,
my mother, Socorro, my sister, Alyne, and my amazing wife, Tayná,
for understanding my absences and worries at various moments. I
am grateful to all the members of my family and friends for always
supporting me in difficult times and wishing for my success. I'd like
to thank all the professors who passed through my life, especially
Prof. Roberto Limão for introducing me the very first neural network
concept. I must register my gratitude to Fábio Soares for this great
partnership and friendship. Finally, I must appreciate the tireless
team at Packt Publishing for the invitation and for helping us in the
production process as a whole.
About the Reviewer
Saeed Afzal, also known as Smac Afzal, is a professional software engineer and
technology enthusiast based in Pakistan. He specializes in solution architecture and
the implementation of scalable high-performance applications.
He has also worked on the book Cloud Bees Development by Packt Publishing.
You can found out more about his skills and experience at http://sirsmac.com.
He can be contacted at sirsmac@gmail.com.
Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.
TM
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
[i]
Table of Contents
[ ii ]
Table of Contents
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[v]
Preface
The life of a programmer can be described as a continual never-ending learning
pathway. A programmer always faces challenges regarding new technology or new
approaches. Generally, during our lives, although we become used to repeated
things, we are always subjected to learn something new. The process of learning is
one of the most interesting topics in science, and there are a number of attempts to
describe or reproduce the human learning process.
The writing of this book was guided by the challenge of facing new content and
then mastering it. While the name neural networks may appear strange or even give
an idea that this book is about neurology, we strived to simplify these nuances by
focusing on your reasons for deciding to purchase this book. We intended to build
a framework that shows you that neural networks are actually simple and easy to
understand, and absolutely no prior knowledge on this topic is required to fully
understand the concepts we present here.
So, we encourage you to explore the content of this book to the fullest, beholding
the power of neural networks when confronting big problems but always with the
point of view of a beginner. Every concept addressed in this book is explained in easy
language, and also with a technical background. Our mission in this book is to give
you an insight into intelligent applications that can be written using a simple language.
Finally, we would like to thank all those who directly or indirectly have contributed
to this book and supported us from the very beginning, right from the Federal
University of Pará, which is the university that we graduated from, to the data and
component providers INMET (Brazilian Institute of Meteorology), Proben1, and
JFreeCharts. We want to give special thanks to our advisor Prof. Roberto Limão, who
introduced us to the subject of neural networks and coauthored many papers with
us in this field. We also acknowledge the work performed by several authors cited
in the references, which gave us a broader vision on neural networks and insights on
how to adapt them to the Java language in a didactic way.
[ vii ]
Preface
We welcome you to have a very pleasurable reading experience and you are
encouraged to download the source code and follow the examples presented
in this book.
Chapter 2, How Neural Networks Learn, covers the learning process of neural networks
and shows how data is used to that end. The complete structure and design of a
learning algorithm is presented here.
Chapter 3, Handling Perceptrons, covers the use of perceptrons, which are one of the
most commonly used neural network architectures. We present a neural network
structure containing layers of neurons and show how they can learn by data in
basic problems.
Chapter 6, Classifying Disease Diagnostics, covers another useful task neural networks
are very good at—classification. In this chapter, you will be presented with a very
didactic but interesting application for disease diagnosis.
Chapter 7, Clustering Customer Profiles, talks about how neural networks are able to
find patterns in data, and a common application is to group customers that share the
same properties of buying.
Chapter 8, Pattern Recognition (OCR Case), talks about a very interesting and amazing
capability of recognizing patterns, including optical character recognition, and this
chapter explores how this can be done with neural networks in the Java language.
[ viii ]
Preface
Conventions
In this book, you will find a number of text styles that distinguish between different
kinds of information. Here are some examples of these styles and an explanation of
their meaning.
Code words in text, database table names, folder names, filenames, file
extensions, pathnames, dummy URLs, user input, and Twitter handles are shown
as follows: "In Java projects, the calculation of these values is done through the
Classification class."
[ ix ]
Preface
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or disliked. Reader feedback is important for us as it helps
us develop titles that you will really get the most out of.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you could report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our website or added
to any list of existing errata under the Errata section of that title.
[x]
Preface
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very seriously.
If you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
We appreciate your help in protecting our authors and our ability to bring you
valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at
questions@packtpub.com, and we will do our best to address the problem.
[ xi ]
Getting Started with
Neural Networks
In this chapter, we will introduce neural networks and what they are designed for.
This chapter serves as a foundation layer for the subsequent chapters, while
it presents the basic concepts for neural networks. In this chapter, we will cover
the following:
• Artificial Neurons
• Weights and Biases
• Activation Functions
• Layers of Neurons
• Neural Network Implementation in Java
[1]
Getting Started with Neural Networks
[2]
Chapter 1
On the basis of this fact, McCulloch and Pits designed a simple model for a
single neuron, initially to simulate the human vision. The available calculators or
computers at that time were very rare but capable of dealing with mathematical
operations quite well; on the other hand, even today tasks such as vision and sound
recognition are not easily programmed without the use of special frameworks, as
opposed to the mathematical operations and functions. Nevertheless, the human
brain can perform these latter tasks more efficiently than the first ones, and this fact
really instigates scientists and researchers.
[3]
Getting Started with Neural Networks
So, the artificial neuron has a similar structure. It contains a nucleus (processing
unit), several dendrites (analogous to inputs), and one axon (analogous to output), as
shown in the following figure:
The links between neurons form the so-called neural network, analogous to the
synapses in the natural structure.
[4]
Chapter 1
• Sigmoid
• Hyperbolic tangent
• Hard limiting threshold
• Purely linear
[5]
Getting Started with Neural Networks
The equations and charts associated with these functions are shown in the
following table:
Sigmoid
Hyperbolic
tangent
Hard
limiting
threshold
Linear
[6]
Chapter 1
Just like the inputs, biases also have an associated weight. This feature helps in the
neural network knowledge representation as a more purely nonlinear system.
Neural networks can be composed of several linked layers, forming the so-called
multilayer networks. The neural layers can be basically divided into three classes:
• Input layer
• Hidden layer
• Output layer
[7]
Getting Started with Neural Networks
• Neuron connections
°° Monolayer networks
°° Multilayer networks
• Signal flow
°° Feedforward networks
°° Feedback networks
Monolayer networks
In this architecture, all neurons are laid out in the same level, forming one single
layer, as shown in the following figure:
[8]
Random documents with unrelated
content Scribd suggests to you:
96 The recital of the first chapter of the Koran.
Printed by The Superintendent, Government Press, Madras.
Colophon
Availability
This eBook is for the use of anyone anywhere at no cost and with
almost no restrictions whatsoever. You may copy it, give it away or
re-use it under the terms of the Project Gutenberg License included
with this eBook or online at www.gutenberg.org .
Scans of this book are available from the Internet Archive (copy 1 ,
2 ).
Encoding
Revision History
2011-11-12 Started.
External References
Corrections
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com