Code Monkey home page Code Monkey logo

deep-learning-with-swift-for-tensorflow-book's Introduction

Deep Learning with Swift for TensorFlow ๐Ÿ“–

Official source code repository for "Deep Learning with Swift for TensorFlow" book.

Book cover

๐Ÿ› @ Amazon (Paperback / Kindle) / ๏ฃฟ Books / Apress / SpringerLink

Book Details

About this book

Discover more insight about deep learning algorithms with Swift for TensorFlow. The Swift language was designed by Apple for optimized performance and development whereas TensorFlow library was designed by Google for advanced machine learning research. Swift for TensorFlow is a combination of both with support for modern hardware accelerators and more. This book covers the deep learning concepts from fundamentals to advanced research. It also introduces the Swift language for beginners in programming. This book is well suited for newcomers and experts in programming and deep learning alike. After reading this book you should be able to program various state-of-the-art deep learning algorithms yourself.

The book covers foundational concepts of machine learning. It also introduces the mathematics required to understand deep learning. Swift language is introduced such that it allows beginners and researchers to understand programming and easily transit to Swift for TensorFlow, respectively. You will understand the nuts and bolts of building and training neural networks, and build advanced algorithms.

What Youโ€™ll Learn

  • Understand deep learning concepts
  • Program various deep learning algorithms
  • Run the algorithms in cloud

Who This Book Is For

  • Newcomers to programming and/or deep learning, and experienced developers.
  • Experienced deep learning practitioners and researchers who desire to work in user space instead of library space with a same programming language without compromising the speed.

Table of Contents

About the Author

About the Technical Reviewer

Preface

Chapter 1: Machine Learning Basics

โ€ƒ1.1 Machine Learning

โ€ƒโ€ƒ1.1.1 Experience

โ€ƒโ€ƒ1.1.2 Task

โ€ƒโ€ƒ1.1.3 Performance Measure

โ€ƒ1.2 Machine Learning Paradigms

โ€ƒโ€ƒ1.2.1 Supervised Learning

โ€ƒโ€ƒ1.2.2 Unsupervised Learning

โ€ƒโ€ƒ1.2.3 Semi-supervised Learning

โ€ƒโ€ƒ1.2.4 Reinforcement Learning

โ€ƒ1.3 Maximum Likelihood Estimation

โ€ƒ1.4 Elements of a Machine Learning Algorithm

โ€ƒโ€ƒ1.4.1 Data

โ€ƒโ€ƒ1.4.2 Models

โ€ƒโ€ƒ1.4.3 Loss Function

โ€ƒโ€ƒ1.4.4 Optimizer

โ€ƒโ€ƒ1.4.5 Regularizer

โ€ƒ1.5 Bias and Variance Trade-Off

โ€ƒ1.6 Why Deep Learning?

โ€ƒโ€ƒ1.6.1 Curse of Dimensionality

โ€ƒโ€ƒ1.6.2 Invalid Smoothness Assumption

โ€ƒโ€ƒ1.6.3 Deep Learning Advantages

โ€ƒ1.7 Summary

Chapter 2: Essential Math

โ€ƒ2.1 Linear Algebra

โ€ƒโ€ƒ2.1.1 Matrices and Vectors

โ€ƒโ€ƒ2.1.2 Unary Matrix Operations

โ€ƒโ€ƒ2.1.3 Binary Matrix Operations

โ€ƒโ€ƒ2.1.4 Norms

โ€ƒ2.2 Probability Theory

โ€ƒโ€ƒ2.2.1 Joint Probability

โ€ƒโ€ƒ2.2.2 Conditional Probability

โ€ƒโ€ƒ2.2.3 Elementary Rules

โ€ƒโ€ƒ2.2.4 Chain Rule

โ€ƒโ€ƒ2.2.5 Bayes Rule

โ€ƒ2.3 Differential Calculus

โ€ƒโ€ƒ2.3.1 Function

โ€ƒโ€ƒ2.3.2 Differentiation of Univariate Function

โ€ƒโ€ƒ2.3.3 Differentiation of Multivariate Function

โ€ƒโ€ƒ2.3.4 Differentiation of Vector Function

โ€ƒโ€ƒ2.3.5 Differentiation of Matrix Function

โ€ƒ2.4 Summary

Chapter 3: Differentiable Programming

โ€ƒ3.1 Swift is Everywhere

โ€ƒ3.2 Swift for TensorFlow

โ€ƒ3.3 Algorithmic Differentiation

โ€ƒโ€ƒ3.3.1 Programming Approaches

โ€ƒโ€ƒ3.3.2 Accumulation Modes

โ€ƒโ€ƒ3.3.3 Implementation Approaches

โ€ƒ3.4 Swift Language

โ€ƒโ€ƒ3.4.1 Values

โ€ƒโ€ƒ3.4.2 Collections

โ€ƒโ€ƒ3.4.3 Control Flow

โ€ƒโ€ƒ3.4.4 Closures and Functions

โ€ƒโ€ƒ3.4.5 Custom Types

โ€ƒโ€ƒ3.4.6 Modern Features

โ€ƒโ€ƒ3.4.7 Error Handling

โ€ƒโ€ƒ3.4.8 Advanced Operators

โ€ƒโ€ƒ3.4.9 Differentiation

โ€ƒ3.5 Python Interoperability

โ€ƒ3.6 Summary

Chapter 4: TensorFlow Basics

โ€ƒ4.1 Tensor

โ€ƒ4.2 Dataset Loading

โ€ƒโ€ƒ4.2.1 Epochs and Batches

โ€ƒ4.3 Defining Model

โ€ƒโ€ƒ4.3.1 Neural Network Protocols

โ€ƒโ€ƒ4.3.2 Sequence of Layers

โ€ƒ4.4 Training and Testing

โ€ƒโ€ƒ4.4.1 Checkpointing

โ€ƒโ€ƒ4.4.2 Model Optimization

โ€ƒโ€ƒ4.4.3 TrainingLoop

โ€ƒ4.5 From Scratch for Research

โ€ƒโ€ƒ4.5.1 Layer

โ€ƒโ€ƒ4.5.2 Activation Function

โ€ƒโ€ƒ4.5.3 Loss Function

โ€ƒโ€ƒ4.5.4 Optimizer

โ€ƒ4.6 Summary

Chapter 5: Neural Networks

โ€ƒ5.1 Gradient-Based Optimization

โ€ƒโ€ƒ5.1.1 Maxima, Minima, and Saddle Points

โ€ƒโ€ƒ5.1.2 Input Optimization

โ€ƒโ€ƒ5.1.3 Parameters Optimization

โ€ƒ5.2 Linear Models

โ€ƒโ€ƒ5.2.1 Regression

โ€ƒโ€ƒ5.2.2 Classification

โ€ƒ5.3 Deep Neural Network

โ€ƒโ€ƒ5.3.1 Dense Neural Network

โ€ƒ5.4 Activation Functions

โ€ƒโ€ƒ5.4.1 Sigmoid

โ€ƒโ€ƒ5.4.2 Softmax

โ€ƒโ€ƒ5.4.3 ReLU

โ€ƒโ€ƒ5.4.4 ELU

โ€ƒโ€ƒ5.4.5 Leaky ReLU

โ€ƒโ€ƒ5.4.6 SELU

โ€ƒ5.5 Loss Functions

โ€ƒโ€ƒ5.5.1 Sum of Squares

โ€ƒโ€ƒ5.5.2 Sigmoid Cross-Entropy

โ€ƒโ€ƒ5.5.3 Softmax Cross-Entropy

โ€ƒ5.6 Optimization

โ€ƒโ€ƒ5.6.1 Gradient Descent

โ€ƒโ€ƒ5.6.2 Momentum

โ€ƒ5.7 Regularization

โ€ƒโ€ƒ5.7.1 Dataset

โ€ƒโ€ƒ5.7.2 Architecture

โ€ƒโ€ƒ5.7.3 Loss Function

โ€ƒโ€ƒ5.7.4 Optimization

โ€ƒ5.8 Summary

Chapter 6: Computer Vision

โ€ƒ6.1 Convolutional Neural Network

โ€ƒโ€ƒ6.1.1 Convolution Layer

โ€ƒโ€ƒ6.1.2 Dimensions Calculation

โ€ƒโ€ƒ6.1.3 Pooling Layer

โ€ƒโ€ƒ6.1.4 Upsampling

โ€ƒ6.2 Prominent Features

โ€ƒโ€ƒ6.2.1 Local Connectivity

โ€ƒโ€ƒ6.2.2 Parameter Sharing

โ€ƒโ€ƒ6.2.3 Translation Equivariance

โ€ƒ6.3 Shortcut Connection

โ€ƒ6.4 Image Recognition

โ€ƒ6.5 Conclusion

References

Index


Setup

  • First, you should install the latest Swift for TensorFlow toolchain.
  • But to run only differentiation-specific code (for instance, the source code of Differentiable Programming chapter) not requiring deep learning features, simply install the latest Swift toolchain snapshot from Swift.org under Trunk Development (main) section. (The future differentiation feature updates will be posted on this website and will go through the standard Swift Evolution process.)
  • Then you must select the newly installed toolchain in Xcode from Preferences (Command + ,) > Components > Toolchains > (Swift for TensorFlow or Swift Development Snapshot).

Executable Source Code

This Swift package offers various executable targets listed in Package.swift.

List of all executable targets:

DifferentiableProgramming

  • AdvancedOperators
  • AlgorithmicDifferentiation
  • Arrays
  • Classes
  • Closures
  • ConditionalStatements
  • ControlTransfer
  • Dictionaries
  • Differentiation
  • EarlyExit
  • Enumerations
  • ErrorHandling
  • Extensions
  • Generics
  • GlobalFunctions
  • Loops
  • NestedFunctions
  • Protocols
  • PythonInteroperability
  • Sets
  • Structures
  • Values

TensorFlowBasics

  • EpochAndBatches
  • FromScratchForResearch
  • ModelDefinition
  • TensorExplanation
  • TrainingAndTesting
  • TrainingLoopExample

NeuralNetworks

  • InputOptimization
  • LinearRegression
  • ParametersOptimization
  • PolynomialRegression

ComputerVision

  • ImageRecognition

Running in Xcode

Select the executable target (for instance, AlgorithmicDifferentiation) from the scheme drop-down menu and then click the Run button. And result should be presented in the console.

Running in Terminal

To execute any of them first enter into this package's root directory.

cd deep-learning-with-swift-for-tensorflow-book

Then run the following command in terminal.

swift run AlgorithmicDifferentiation

The following output will be displayed.

expression value: 30.0
expression derivative: 28.0

Just replace AlgorithmicDifferentiation with any executable target you wish to run.


Note: This Swift package was tested on Xcode 12.5 running on macOS version 11.3. It should also work right out of the box on Linux distributions.

Contact

๐Ÿ“ซ [email protected]

deep-learning-with-swift-for-tensorflow-book's People

Contributors

rahulbhalley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.