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

Deep Learning: Practical Neural Networks with Java

Book Description

Build and run intelligent applications by leveraging key Java machine learning libraries

About This Book

  • Develop a sound strategy to solve predictive modelling problems using the most popular machine learning Java libraries.
  • Explore a broad variety of data processing, machine learning, and natural language processing through diagrams, source code, and real-world applications
  • 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 course is intended for data scientists and Java developers who want to dive into the exciting world of deep learning. It will get you up and running quickly and provide you with the skills you need to successfully create, customize, and deploy machine learning applications in real life.

What You Will Learn

  • Get a practical deep dive into machine learning and deep learning algorithms
  • Explore neural networks using some of the most popular Deep Learning frameworks
  • Dive into Deep Belief Nets and Stacked Denoising Autoencoders algorithms
  • Apply machine learning to fraud, anomaly, and outlier detection
  • Experiment with deep learning concepts, algorithms, and the toolbox for deep learning
  • Select and split data sets into training, test, and validation, and explore validation strategies
  • Apply the code generated in practical examples, including weather forecasting and pattern recognition

In Detail

Machine learning applications are everywhere, from self-driving cars, spam detection, document search, and trading strategies, to speech recognitionStarting with an introduction to basic machine learning algorithms, this course takes you further into this vital world of stunning predictive insights and remarkable machine intelligence. This course helps you solve challenging problems in image processing, speech recognition, language modeling. You will discover how to detect anomalies and fraud, and ways to perform activity recognition, image recognition, and text. You will also work with examples such as weather forecasting, disease diagnosis, customer profiling, generalization, extreme machine learning and more. By the end of this course, you will have all the knowledge you need to perform deep learning on your system with varying complexity levels, to apply them to your daily work.

The course provides you with highly practical content explaining deep learning with Java, from the following Packt books:

  1. Java Deep Learning Essentials
  2. Machine Learning in Java
  3. Neural Network Programming with Java, Second Edition

Style and approach

This course aims to create a smooth learning path that will teach you how to effectively use deep learning with Java with other de facto components to get the most out of it. Through this comprehensive course, you'll learn the basics of predictive modelling and progress to solve real-world problems and links neural network theory to their application

Table of Contents

  1. Deep Learning: Practical Neural Networks with Java
    1. Table of Contents
    2. Deep Learning: Practical Neural Networks with Java
    3. Deep Learning: Practical Neural Networks with Java
    4. Credits
    5. Preface
      1. What this learning path covers
      2. What you need for this learning path
      3. Who this learning path is for
      4. Reader feedback
      5. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    6. 1. Java Deep Learning Essentials
      1. 1. Deep Learning Overview
        1. Transition of AI
          1. Definition of AI
          2. AI booms in the past
          3. Machine learning evolves
          4. What even machine learning cannot do
        2. Things dividing a machine and human
        3. AI and deep learning
        4. Summary
      2. 2. Algorithms for Machine Learning – Preparing for Deep Learning
        1. Getting started
        2. The need for training in machine learning
        3. Supervised and unsupervised learning
          1. Support Vector Machine (SVM)
          2. Hidden Markov Model (HMM)
          3. Neural networks
          4. Logistic regression
          5. Reinforcement learning
        4. Machine learning application flow
        5. Theories and algorithms of neural networks
          1. Perceptrons (single-layer neural networks)
          2. Logistic regression
          3. Multi-class logistic regression
          4. Multi-layer perceptrons (multi-layer neural networks)
        6. Summary
      3. 3. Deep Belief Nets and Stacked Denoising Autoencoders
        1. Neural networks fall
        2. Neural networks' revenge
          1. Deep learning's evolution – what was the breakthrough?
          2. Deep learning with pre-training
        3. Deep learning algorithms
          1. Restricted Boltzmann machines
          2. Deep Belief Nets (DBNs)
          3. Denoising Autoencoders
          4. Stacked Denoising Autoencoders (SDA)
        4. Summary
      4. 4. Dropout and Convolutional Neural Networks
        1. Deep learning algorithms without pre-training
        2. Dropout
        3. Convolutional neural networks
          1. Convolution
          2. Pooling
          3. Equations and implementations
        4. Summary
      5. 5. Exploring Java Deep Learning Libraries – DL4J, ND4J, and More
        1. Implementing from scratch versus a library/framework
        2. Introducing DL4J and ND4J
        3. Implementations with ND4J
        4. Implementations with DL4J
          1. Setup
          2. Build
            1. DBNIrisExample.java
            2. CSVExample.java
          3. CNNMnistExample.java/LenetMnistExample.java
          4. Learning rate optimization
        5. Summary
      6. 6. Approaches to Practical Applications – Recurrent Neural Networks and More
        1. Fields where deep learning is active
          1. Image recognition
          2. Natural language processing
            1. Feed-forward neural networks for NLP
            2. Deep learning for NLP
              1. Recurrent neural networks
              2. Long short term memory networks
        2. The difficulties of deep learning
        3. The approaches to maximizing deep learning possibilities and abilities
          1. Field-oriented approach
            1. Medicine
            2. Automobiles
            3. Advert technologies
            4. Profession or practice
            5. Sports
          2. Breakdown-oriented approach
          3. Output-oriented approach
        4. Summary
      7. 7. Other Important Deep Learning Libraries
        1. Theano
        2. TensorFlow
        3. Caffe
        4. Summary
      8. 8. What's Next?
        1. Breaking news about deep learning
        2. Expected next actions
        3. Useful news sources for deep learning
        4. Summary
    7. 2. Machine Learning in Java
      1. 1. Applied Machine Learning Quick Start
        1. Machine learning and data science
          1. What kind of problems can machine learning solve?
          2. Applied machine learning workflow
        2. Data and problem definition
          1. Measurement scales
        3. Data collection
          1. Find or observe data
          2. Generate data
          3. Sampling traps
        4. Data pre-processing
          1. Data cleaning
          2. Fill missing values
          3. Remove outliers
          4. Data transformation
          5. Data reduction
        5. Unsupervised learning
          1. Find similar items
            1. Euclidean distances
            2. Non-Euclidean distances
            3. The curse of dimensionality
          2. Clustering
        6. Supervised learning
          1. Classification
            1. Decision tree learning
            2. Probabilistic classifiers
            3. Kernel methods
            4. Artificial neural networks
            5. Ensemble learning
            6. Evaluating classification
              1. Precision and recall
              2. Roc curves
          2. Regression
            1. Linear regression
            2. Evaluating regression
              1. Mean squared error
              2. Mean absolute error
              3. Correlation coefficient
        7. Generalization and evaluation
          1. Underfitting and overfitting
            1. Train and test sets
            2. Cross-validation
            3. Leave-one-out validation
            4. Stratification
        8. Summary
      2. 2. Java Libraries and Platforms for Machine Learning
        1. The need for Java
        2. Machine learning libraries
          1. Weka
          2. Java machine learning
          3. Apache Mahout
          4. Apache Spark
          5. Deeplearning4j
          6. MALLET
          7. Comparing libraries
        3. Building a machine learning application
          1. Traditional machine learning architecture
          2. Dealing with big data
            1. Big data application architecture
        4. Summary
      3. 3. Basic Algorithms – Classification, Regression, and Clustering
        1. Before you start
        2. Classification
          1. Data
          2. Loading data
          3. Feature selection
          4. Learning algorithms
          5. Classify new data
          6. Evaluation and prediction error metrics
          7. Confusion matrix
          8. Choosing a classification algorithm
        3. Regression
          1. Loading the data
          2. Analyzing attributes
          3. Building and evaluating regression model
            1. Linear regression
            2. Regression trees
          4. Tips to avoid common regression problems
        4. Clustering
          1. Clustering algorithms
          2. Evaluation
        5. Summary
      4. 4. Customer Relationship Prediction with Ensembles
        1. Customer relationship database
          1. Challenge
          2. Dataset
          3. Evaluation
        2. Basic naive Bayes classifier baseline
          1. Getting the data
          2. Loading the data
        3. Basic modeling
          1. Evaluating models
          2. Implementing naive Bayes baseline
        4. Advanced modeling with ensembles
          1. Before we start
          2. Data pre-processing
          3. Attribute selection
          4. Model selection
          5. Performance evaluation
        5. Summary
      5. 5. Affinity Analysis
        1. Market basket analysis
          1. Affinity analysis
        2. Association rule learning
          1. Basic concepts
            1. Database of transactions
            2. Itemset and rule
            3. Support
            4. Confidence
          2. Apriori algorithm
          3. FP-growth algorithm
        3. The supermarket dataset
        4. Discover patterns
          1. Apriori
          2. FP-growth
        5. Other applications in various areas
          1. Medical diagnosis
          2. Protein sequences
          3. Census data
          4. Customer relationship management
          5. IT Operations Analytics
        6. Summary
      6. 6. Recommendation Engine with Apache Mahout
        1. Basic concepts
          1. Key concepts
          2. User-based and item-based analysis
          3. Approaches to calculate similarity
            1. Collaborative filtering
            2. Content-based filtering
            3. Hybrid approach
          4. Exploitation versus exploration
        2. Getting Apache Mahout
          1. Configuring Mahout in Eclipse with the Maven plugin
        3. Building a recommendation engine
          1. Book ratings dataset
          2. Loading the data
            1. Loading data from file
            2. Loading data from database
            3. In-memory database
          3. Collaborative filtering
            1. User-based filtering
            2. Item-based filtering
            3. Adding custom rules to recommendations
            4. Evaluation
            5. Online learning engine
        4. Content-based filtering
        5. Summary
      7. 7. Fraud and Anomaly Detection
        1. Suspicious and anomalous behavior detection
          1. Unknown-unknowns
        2. Suspicious pattern detection
        3. Anomalous pattern detection
          1. Analysis types
            1. Pattern analysis
          2. Transaction analysis
          3. Plan recognition
        4. Fraud detection of insurance claims
          1. Dataset
          2. Modeling suspicious patterns
            1. Vanilla approach
            2. Dataset rebalancing
        5. Anomaly detection in website traffic
          1. Dataset
          2. Anomaly detection in time series data
            1. Histogram-based anomaly detection
            2. Loading the data
            3. Creating histograms
            4. Density based k-nearest neighbors
        6. Summary
      8. 8. Image Recognition with Deeplearning4j
        1. Introducing image recognition
          1. Neural networks
            1. Perceptron
            2. Feedforward neural networks
            3. Autoencoder
            4. Restricted Boltzmann machine
            5. Deep convolutional networks
        2. Image classification
          1. Deeplearning4j
            1. Getting DL4J
          2. MNIST dataset
          3. Loading the data
          4. Building models
            1. Building a single-layer regression model
            2. Building a deep belief network
            3. Build a Multilayer Convolutional Network
        3. Summary
      9. 9. Activity Recognition with Mobile Phone Sensors
        1. Introducing activity recognition
          1. Mobile phone sensors
          2. Activity recognition pipeline
          3. The plan
        2. Collecting data from a mobile phone
          1. Installing Android Studio
          2. Loading the data collector
            1. Feature extraction
          3. Collecting training data
        3. Building a classifier
          1. Reducing spurious transitions
          2. Plugging the classifier into a mobile app
        4. Summary
      10. 10. Text Mining with Mallet – Topic Modeling and Spam Detection
        1. Introducing text mining
          1. Topic modeling
          2. Text classification
        2. Installing Mallet
        3. Working with text data
          1. Importing data
            1. Importing from directory
            2. Importing from file
          2. Pre-processing text data
        4. Topic modeling for BBC news
          1. BBC dataset
          2. Modeling
          3. Evaluating a model
          4. Reusing a model
            1. Saving a model
            2. Restoring a model
        5. E-mail spam detection
          1. E-mail spam dataset
          2. Feature generation
          3. Training and testing
            1. Model performance
        6. Summary
      11. 11. What is Next?
        1. Machine learning in real life
          1. Noisy data
          2. Class unbalance
          3. Feature selection is hard
          4. Model chaining
          5. Importance of evaluation
          6. Getting models into production
          7. Model maintenance
        2. Standards and markup languages
          1. CRISP-DM
          2. SEMMA methodology
          3. Predictive Model Markup Language
        3. Machine learning in the cloud
          1. Machine learning as a service
        4. Web resources and competitions
          1. Datasets
          2. Online courses
          3. Competitions
          4. Websites and blogs
          5. Venues and conferences
        5. Summary
      12. A. References
    8. 3. Neural Network Programming with Java, Second Edition
      1. 1. Getting Started with Neural Networks
        1. Discovering neural networks
        2. Why artificial neural networks?
          1. How neural networks are arranged
          2. The very basic element – artificial neuron
          3. Giving life to neurons – activation function
          4. The flexible values – weights
          5. An extra parameter – bias
          6. The parts forming the whole – layers
          7. Learning about neural network architectures
          8. Monolayer networks
          9. Multilayer networks
          10. Feedforward networks
          11. Feedback networks
        3. From ignorance to knowledge – learning process
        4. Let the coding begin! Neural networks in practice
        5. The neuron class
        6. The NeuralLayer class
        7. The ActivationFunction interface
        8. The neural network class
        9. Time to play!
        10. Summary
      2. 2. Getting Neural Networks to Learn
        1. Learning ability in neural networks
          1. How learning helps solving problems
        2. Learning paradigms
          1. Supervised learning
          2. Unsupervised learning
        3. The learning process
          1. The cost function finding the way down to the optimum
          2. Learning in progress - weight update
          3. Calculating the cost function
          4. General error and overall error
          5. Can the neural network learn forever? When is it good to stop?
        4. Examples of learning algorithms
          1. The delta rule
          2. The learning rate
          3. Implementing the delta rule
          4. The core of the delta rule learning - train and calcNewWeight methods
          5. Another learning algorithm - Hebbian learning
          6. Adaline
        5. Time to see the learning in practice!
          1. Teaching the neural network – the training dataset
        6. Amazing, it learned! Or, did it really? A further step – testing
          1. Overfitting and overtraining
        7. Summary
      3. 3. Perceptrons and Supervised Learning
        1. Supervised learning – teaching the neural net
          1. Classification – finding the appropriate class
          2. Regression – mapping real inputs to outputs
        2. A basic neural architecture – perceptrons
          1. Applications and limitations
          2. Linear separation
          3. The XOR case
        3. Multi-layer perceptrons
          1. MLP properties
          2. MLP weights
          3. Recurrent MLP
          4. Coding an MLP
        4. Learning in MLPs
          1. Backpropagation algorithm
          2. The momentum
          3. Coding the backpropagation
          4. Levenberg-Marquardt algorithm
          5. Coding the Levenberg-Marquardt with matrix algebra
          6. Extreme learning machines
        5. Practical example 1 – the XOR case with delta rule and backpropagation
        6. Practical example 2 – predicting enrolment status
        7. Summary
      4. 4. Self-Organizing Maps
        1. Neural networks unsupervised learning
        2. Unsupervised learning algorithms
          1. Competitive learning
          2. Competitive layer
        3. Kohonen self-organizing maps
          1. Extending the neural network code to Kohonen
          2. Zero-dimensional SOM
          3. One-dimensional SOM
          4. Two-dimensional SOM
          5. 2D competitive layer
          6. SOM learning algorithm
          7. Effect of neighboring neurons – the neighborhood function
          8. The learning rate
          9. A new class for competitive learning
          10. Visualizing the SOMs
          11. Plotting 2D training datasets and neuron weights
          12. Testing Kohonen learning
        4. Summary
      5. 5. Forecasting Weather
        1. Neural networks for regression problems
        2. Loading/selecting data
          1. Building auxiliary classes
          2. Getting a dataset from a CSV file
          3. Building time series
          4. Dropping NaNs
          5. Getting weather data
          6. Weather variables
        3. Choosing input and output variables
        4. Preprocessing
          1. Normalization
          2. Adapting NeuralDataSet to handle normalization
          3. Adapting the learning algorithm to normalization
          4. Java implementation of weather forecasting
          5. Collecting weather data
          6. Delaying variables
          7. Loading the data and beginning to play!
          8. Let's perform a correlation analysis
          9. Creating neural networks
          10. Training and test
            1. Training the neural network
            2. Plotting the error
          11. Viewing the neural network output
        5. Empirical design of neural networks
          1. Designing experiments
          2. Results and simulations
        6. Summary
      6. 6. Classifying Disease Diagnosis
        1. Foundations of classification problems
          1. Categorical data
          2. Working with categorical data
        2. Logistic regression
          1. Multiple classes versus binary classes
          2. Confusion matrix
          3. Sensitivity and specificity
          4. Implementing a confusion matrix
        3. Neural networks for classification
        4. Disease diagnosis with neural networks
          1. Breast cancer
          2. Diabetes
        5. Summary
      7. 7. Clustering Customer Profiles
        1. Clustering tasks
          1. Cluster analysis
          2. Cluster evaluation and validation
          3. Implementation
          4. External validation
        2. Applied unsupervised learning
          1. Kohonen neural network
        3. Profiling
          1. Pre-processing
          2. Implementation in Java
          3. Card – credit analysis for customer profiling
          4. Product profiling
          5. How many clusters?
        4. Summary
      8. 8. Text Recognition
        1. Pattern recognition
          1. Defined classes
          2. Undefined classes
        2. Neural networks in pattern recognition
          1. Data pre-processing
          2. Text recognition (optical character recognition)
          3. Digit recognition
          4. Digit representation
          5. Implementation in Java
          6. Generating data
          7. Neural architecture
          8. Experiments
          9. Results
        3. Summary
      9. 9. Optimizing and Adapting Neural Networks
        1. Common issues in neural network implementations
        2. Input selection
          1. Data correlation
          2. Transforming data
          3. Dimensionality reduction
          4. Data filtering
          5. Cross-validation
          6. Structure selection
        3. Online retraining
          1. Stochastic online learning
          2. Implementation
          3. Application
        4. Adaptive neural networks
          1. Adaptive resonance theory
          2. Implementation
        5. Summary
      10. 10. Current Trends in Neural Networks
        1. Deep learning
        2. Deep architectures
          1. How to implement deep learning in Java
            1. Hybrid systems
          2. Neuro-fuzzy
          3. Neuro-genetic
        3. Implementing a hybrid neural network
        4. Summary
      11. A. References
        1. Chapter 1: Getting Started with Neural Networks
        2. Chapter 2: Getting Neural Networks to Learn
        3. Chapter 3: Perceptrons and Supervised Learning
        4. Chapter 4: Self-Organizing Maps
        5. Chapter 5: Forecasting Weather
        6. Chapter 6: Classifying Disease Diagnosis
        7. Chapter 7: Clustering Customer Profiles
        8. Chapter 8: Text Recognition
        9. Chapter 9: Optimizing and Adapting Neural Networks
        10. Chapter 10: Current Trends in Neural Networks
      12. Bibliography
    9. Index