O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Neural Network Programming with Java

Book Description

Create and unleash the power of neural networks by implementing professional Java code

About This Book

  • Learn to build amazing projects using neural networks including forecasting the weather and pattern recognition
  • Explore the Java multi-platform feature to run your personal neural networks everywhere
  • This step-by-step guide will help you solve real-world problems and links neural network theory to their application

Who This Book Is For

This book is for Java developers with basic Java programming knowledge. No previous knowledge of neural networks is required as this book covers the concepts from scratch.

What You Will Learn

  • Get to grips with the basics of neural networks and what they are used for
  • Develop neural networks using hands-on examples
  • Explore and code the most widely-used learning algorithms to make your neural network learn from most types of data
  • Discover the power of neural network’s unsupervised learning process to extract the intrinsic knowledge hidden behind the data
  • Apply the code generated in practical examples, including weather forecasting and pattern recognition
  • Understand how to make the best choice of learning parameters to ensure you have a more effective application
  • Select and split data sets into training, test, and validation, and explore validation strategies
  • Discover how to improve and optimize your neural network

In Detail

Vast quantities of data are produced every second. In this context, neural networks become a powerful technique to extract useful knowledge from large amounts of raw, seemingly unrelated data. One of the most preferred languages for neural network programming is Java as it is easier to write code using it, and most of the most popular neural network packages around already exist for Java. This makes it a versatile programming language for neural networks.

This book gives you a complete walkthrough of the process of developing basic to advanced practical examples based on neural networks with Java.

You will first learn the basics of neural networks and their process of learning. We then focus on what Perceptrons are and their features. Next, you will implement self-organizing maps using the concepts you’ve learned. Furthermore, you will learn about some of the applications that are presented in this book such as weather forecasting, disease diagnosis, customer profiling, and characters recognition (OCR). Finally, you will learn methods to optimize and adapt neural networks in real time.

All the examples generated in the book are provided in the form of illustrative source code, which merges object-oriented programming (OOP) concepts and neural network features to enhance your learning experience.

Style and approach

This book adopts a step-by-step approach to neural network development and provides many hands-on examples using Java programming. Each neural network concept is explored through real-world problems and is delivered in an easy-to-comprehend manner.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Neural Network Programming with Java
    1. Table of Contents
    2. Neural Network Programming with Java
    3. Credits
    4. About the Authors
    5. About the Reviewer
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Getting Started with Neural Networks
      1. Discovering neural networks
      2. Why artificial neural network?
      3. How neural networks are arranged
        1. The very basic element – artificial neuron
        2. Giving life to neurons – activation function
        3. The fundamental values – weights
        4. An important parameter – bias
        5. The parts forming the whole – layers
      4. Learning about neural network architectures
        1. Monolayer networks
        2. Multilayer networks
        3. Feedforward networks
        4. Feedback networks
      5. From ignorance to knowledge – learning process
      6. Let the implementations begin! Neural networks in practice
      7. Summary
    9. 2. How Neural Networks Learn
      1. Learning ability in neural networks
        1. How learning helps to solve problems
      2. Learning paradigms
        1. Supervised learning
        2. Unsupervised learning
      3. Systematic structuring – learning algorithm
        1. Two stages of learning – training and testing
        2. The details – learning parameters
        3. Error measurement and cost function
      4. Examples of learning algorithms
        1. Perceptron
        2. Delta rule
      5. Coding of the neural network learning
        1. Learning parameter implementation
        2. Learning procedure
        3. Class definitions
      6. Two practical examples
        1. Perceptron (warning system)
        2. ADALINE (traffic forecast)
      7. Summary
    10. 3. Handling Perceptrons
      1. Studying the perceptron neural network
        1. Applications and limitations of perceptrons
        2. Linear separation
        3. Classical XOR case
      2. Popular multilayer perceptrons (MLPs)
        1. MLP properties
        2. MLP weights
        3. Recurrent MLP
        4. MLP structure in an OOP paradigm
      3. Interesting MLP applications
        1. Classification in MLPs
        2. Regression in MLPs
      4. Learning process in MLPs
        1. Simple and very powerful learning algorithm – Backpropagation
        2. Elaborate and potent learning algorithm – Levenberg–Marquardt
      5. Hands-on MLP implementation!
        1. Backpropagation in action
        2. Exploring the code
      6. Levenberg–Marquardt implementation
      7. Practical application – types of university enrolments
      8. Summary
    11. 4. Self-Organizing Maps
      1. Neural networks' unsupervised way of learning
      2. Some unsupervised learning algorithms
        1. Competitive learning or winner takes all
      3. Kohonen self-organizing maps (SOMs)
        1. One-Dimensional SOM
        2. Two-Dimensional SOM
        3. Step-by-step of SOM learning
        4. How to use SOMs
      4. Coding of the Kohonen algorithm
        1. Exploring the Kohonen class
        2. Kohonen implementation (clustering animals)
      5. Summary
    12. 5. Forecasting Weather
      1. Neural networks for prediction problems
      2. No data, no neural net – selecting data
        1. Knowing the problem – weather variables
        2. Choosing input and output variables
        3. Removing insignificant behaviors – Data filtering
      3. Adjusting values – data preprocessing
        1. Equalizing data – normalization
      4. Java implementation for weather prediction
        1. Plotting charts
        2. Handling data files
        3. Building a neural network for weather prediction
      5. Empirical design of neural networks
        1. Choosing training and test datasets
        2. Designing experiments
        3. Results and simulations
      6. Summary
    13. 6. Classifying Disease Diagnosis
      1. What are classification problems, and how can neural networks be applied to them?
      2. A special type of activation function – Logistic regression
        1. Multiple classes versus binary classes
        2. Comparing the expected versus produced results – the confusion matrix
        3. Classification measures – sensitivity and specificity
      3. Applying neural networks for classification
      4. Disease diagnosis with neural networks
        1. Using ANN to diagnose breast cancer
        2. Applying NN for an early diagnosis of diabetes
      5. Summary
    14. 7. Clustering Customer Profiles
      1. Clustering task
        1. Cluster analysis
        2. Cluster evaluation and validation
        3. External validation
      2. Applied unsupervised learning
        1. Neural network of radial basis functions
        2. Kohonen neural network
        3. Types of data
      3. Customer profiling
        1. Preprocessing data
      4. Implementation in Java
        1. Card credit analysis for customer profiling
      5. Summary
    15. 8. Pattern Recognition (OCR Case)
      1. What is pattern recognition all about?
        1. Definition of classes among tons of data
        2. What if the undefined classes are undefined?
        3. External validation
      2. How to apply neural networks in pattern recognition
        1. Preprocessing the data
      3. The OCR problem
        1. Simplifying the task – digit recognition
        2. Approach to digit representation
      4. Let the coding begin!
        1. Generating data
        2. Building the neural network
        3. Testing and redesigning – trial and error
        4. Results
      5. Summary
    16. 9. Neural Network Optimization and Adaptation
      1. Common issues in neural network implementations
      2. Input selection
        1. Data correlation
        2. Dimensionality reduction
        3. Data filtering
      3. Structure selection
      4. Online retraining
        1. Stochastic online learning
        2. Implementation
        3. Application
      5. Adaptive neural networks
        1. Adaptive resonance theory
        2. Implementation
      6. Summary
    17. A. Setting up the NetBeans Environment
      1. Download and install NetBeans
      2. Setting up the NetBeans environment
      3. Importing a project
      4. Programming and running code with NetBeans
      5. Debugging with NetBeans
    18. B. Setting Up the Eclipse Environment
      1. Download and install Eclipse
      2. Setting up the Eclipse environment
      3. Importing a project
      4. Programming and running code with the Eclipse IDE
      5. Debugging with the Eclipse IDE
    19. C. References
      1. Chapter 1 - Getting Started with Neural Networks
      2. Chapter 2 - How Neural Networks Learn
      3. Chapter 3 - Working with Perceptrons
      4. Chapter 4 - Self-Organizing Maps
      5. Chapter 5 - Forecasting Weather
      6. Chapter 6 - Disease Diagnosis
      7. Chapter 7 - Clustering Customer Profiles
      8. Chapter 8 - Pattern Recognition (the OCR Case)
      9. Chapter 9 - Neural Network Optimization and Adaptation
    20. Index