100% found this document useful (5 votes)
27 views

PDF Python deeper insights into machine learning leverage benefits of machine learning techniques using Python a course in three modules Hearty download

into

Uploaded by

ploweliben3m
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (5 votes)
27 views

PDF Python deeper insights into machine learning leverage benefits of machine learning techniques using Python a course in three modules Hearty download

into

Uploaded by

ploweliben3m
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Download the Full Version of textbook for Fast Typing at textbookfull.

com

Python deeper insights into machine learning


leverage benefits of machine learning techniques
using Python a course in three modules Hearty

https://textbookfull.com/product/python-deeper-insights-
into-machine-learning-leverage-benefits-of-machine-learning-
techniques-using-python-a-course-in-three-modules-hearty/

OR CLICK BUTTON

DOWNLOAD NOW

Download More textbook Instantly Today - Get Yours Now at textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Python Real World Machine Learning: Real World Machine


Learning: Take your Python Machine learning skills to the
next level 1st Edition Joshi
https://textbookfull.com/product/python-real-world-machine-learning-
real-world-machine-learning-take-your-python-machine-learning-skills-
to-the-next-level-1st-edition-joshi/
textboxfull.com

Advanced Data Analytics Using Python: With Machine


Learning, Deep Learning and NLP Examples Mukhopadhyay

https://textbookfull.com/product/advanced-data-analytics-using-python-
with-machine-learning-deep-learning-and-nlp-examples-mukhopadhyay/

textboxfull.com

Practical Machine Learning for Data Analysis Using Python


1st Edition Abdulhamit Subasi

https://textbookfull.com/product/practical-machine-learning-for-data-
analysis-using-python-1st-edition-abdulhamit-subasi/

textboxfull.com

Data Science and Machine Learning Interview Questions


Using Python Second Edition Vishwanathan Narayanan

https://textbookfull.com/product/data-science-and-machine-learning-
interview-questions-using-python-second-edition-vishwanathan-
narayanan/
textboxfull.com
Python for Probability Statistics and Machine Learning
José Unpingco

https://textbookfull.com/product/python-for-probability-statistics-
and-machine-learning-jose-unpingco/

textboxfull.com

Mastering Machine Learning with Python in Six Steps: A


Practical Implementation Guide to Predictive Data
Analytics Using Python 1st Edition Manohar Swamynathan
(Auth.)
https://textbookfull.com/product/mastering-machine-learning-with-
python-in-six-steps-a-practical-implementation-guide-to-predictive-
data-analytics-using-python-1st-edition-manohar-swamynathan-auth/
textboxfull.com

Thoughtful machine learning with Python a test driven


approach First Edition Kirk

https://textbookfull.com/product/thoughtful-machine-learning-with-
python-a-test-driven-approach-first-edition-kirk/

textboxfull.com

Machine Learning Concepts with Python and the Jupyter


Notebook Environment: Using Tensorflow 2.0 Nikita
Silaparasetty
https://textbookfull.com/product/machine-learning-concepts-with-
python-and-the-jupyter-notebook-environment-using-
tensorflow-2-0-nikita-silaparasetty/
textboxfull.com

Statistical Methods for Machine Learning: Discover How to


Transform Data into Knowledge with Python Jason Brownlee

https://textbookfull.com/product/statistical-methods-for-machine-
learning-discover-how-to-transform-data-into-knowledge-with-python-
jason-brownlee/
textboxfull.com
Python: Deeper Insights
into Machine Learning
Leverage benefits of machine learning techniques
using Python

</>

LEARNING PATH
Python: Deeper Insights into
Machine Learning

Leverage benefits of machine learning


techniques using Python

A course in three modules

BIRMINGHAM - MUMBAI
Python: Deeper Insights into Machine Learning

Copyright © 2016 Packt Publishing

All rights reserved. No part of this course 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 course to ensure the accuracy
of the information presented. However, the information contained in this course
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 course.

Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this course by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.

Published on: August 2016

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham B3 2PB, UK.

ISBN 978-1-78712-857-6

www.packtpub.com
Credits

Authors Content Development Editor


Sebastian Raschka Amrita Noronha
David Julian
John Hearty Production Coordinator
Arvindkumar Gupta

Reviewers
Richard Dutton
Dave Julian
Vahid Mirjalili
Hamidreza Sattari
Dmytro Taranovsky
Dr. Vahid Mirjalili
Jared Huffman
Ashwin Pajankar
Preface
Machine learning and predictive analytics are becoming one of the key strategies for
unlocking growth in a challenging contemporary marketplace .It is one of the fastest
growing trends in modern computing and everyone wants to get into the field of
machine learning. In order to obtain sufficient recognition in this field, one must be
able to understand and design a machine learning system that serves the needs of a
project. The idea is to prepare a Learning Path that will help you to tackle the real-
world complexities of modern machine learning with innovative and cutting-edge
techniques. Also, it will give you a solid foundation in the machine learning design
process, and enable you to build customized machine learning models to solve
unique problems

What this learning path covers


Module 1, Python Machine Learning, discusses the essential machine algorithms for
classification and provides practical examples using scikit-learn. It teaches you to
prepare variables of different types and also speaks about polynomial regression
and tree-based approaches. This module focuses on open source Python library that
allows us to utilize multiple cores of modern GPUs.

Module 2, Designing Machine Learning Systems with Python, acquaints you with large
library of packages for machine learning tasks. It introduces broad topics such
as big data, data properties, data sources, and data processing .You will further
explore models that form the foundation of many advanced nonlinear techniques.
This module will help you in understanding model selection and parameter tuning
techniques that could help in various case studies.

[i]
Preface

Module 3, Advanced Machine Learning with Python, helps you to build your skill
with deep architectures by using stacked denoising autoencoders. This module is a
blend of semi-supervised learning techniques, RBM and DBN algorithms .Further
this focuses on tools and techniques which will help in making consistent working
process.

What you need for this learning path


Module 1, Python Machine Learning will require an installation of Python 3.4.3 or
newer on Mac OS X, Linux or Microsoft Windows. Use of Python essential libraries
like SciPy, NumPy, scikit-Learn, matplotlib, and pandas. is essential.

Before you start, Please refer:

• The direct link to the Iris dataset would be: https://raw.


githubusercontent.com/rasbt/python-machine-learning-book/
master/code/datasets/iris/iris.data
• We've added some additional notes to the code notebooks mentioning the
offline datasets in case there are server errors. https://www.dropbox.com/
sh/tq2qdh0oqfgsktq/AADIt7esnbiWLOQODn5q_7Dta?dl=0
• Module 2, Designing Machine Learning Systems with Python, will need an
inclination to learn machine learning and the Python V3 software, which you
can download from https://www.python.org/downloads/.
• Module 3, Advanced Machine Learning with Python, leverages openly
available data and code, including open source Python libraries and
frameworks.

Who this learning path is for


This title is for Data scientist and researchers who are already into the field of
Data Science and want to see Machine learning in action and explore its real-world
application. Prior knowledge of Python programming and mathematics is must with
basic knowledge of machine learning concepts.

Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this course—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.

[ ii ]
Preface

To send us general feedback, simply e-mail [email protected], and mention


the course's title in the subject of your message.

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 course, we have a number of things to
help you to get the most from your purchase.

Downloading the example code


You can download the example code files for this course from your account at
http://www.packtpub.com. If you purchased this course elsewhere, you can visit
http://www.packtpub.com/support and register to have the files e-mailed directly
to you.

You can download the code files by following these steps:

1. Log in or register to our website using your e-mail address and password.
2. Hover the mouse pointer on the SUPPORT tab at the top.
3. Click on Code Downloads & Errata.
4. Enter the name of the course in the Search box.
5. Select the course for which you're looking to download the code files.
6. Choose from the drop-down menu where you purchased this course from.
7. Click on Code Download.

You can also download the code files by clicking on the Code Files button on the
course's webpage at the Packt Publishing website. This page can be accessed by
entering the course's name in the Search box. Please note that you need to be logged
in to your Packt account.

Once the file is downloaded, please make sure that you unzip or extract the folder
using the latest version of:

• WinRAR / 7-Zip for Windows


• Zipeg / iZip / UnRarX for Mac
• 7-Zip / PeaZip for Linux

[ iii ]
Preface

The code bundle for the course is also hosted on GitHub at https://github.com/
PacktPublishing/Python-Deeper-Insights-into-Machine-Learning.

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 courses—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 course. If you find any errata, please report them by visiting http://www.
packtpub.com/submit-errata, selecting your course, 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.

To view the previously submitted errata, go to https://www.packtpub.com/books/


content/support and enter the name of the course in the search field. The required
information will appear under the Errata section.

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.

Please contact us at [email protected] with a link to the suspected


pirated material.

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 course, you can contact us at
[email protected], and we will do our best to address the problem.

[ iv ]
Course Module 1: Python Machine Learning

Chapter 1: Giving Computers the Ability to Learn from Data 3


Building intelligent machines to transform data into knowledge 4
The three different types of machine learning 4
An introduction to the basic terminology and notations 10
A roadmap for building machine learning systems 12
Using Python for machine learning 15
Summary 17
Chapter 2: Training Machine Learning Algorithms
for Classification 19
Artificial neurons – a brief glimpse into the early history of
machine learning 20
Implementing a perceptron learning algorithm in Python 26
Adaptive linear neurons and the convergence of learning 35
Summary 49
Chapter 3: A Tour of Machine Learning Classifiers
Using Scikit-learn 51
Choosing a classification algorithm 51
First steps with scikit-learn 52
Modeling class probabilities via logistic regression 58
Maximum margin classification with support vector machines 71
Solving nonlinear problems using a kernel SVM 77
Decision tree learning 82

[i]
Table of Contents

K-nearest neighbors – a lazy learning algorithm 94


Summary 98
Chapter 4: Building Good Training Sets – Data Preprocessing 101
Dealing with missing data 101
Handling categorical data 106
Partitioning a dataset in training and test sets 110
Bringing features onto the same scale 112
Selecting meaningful features 114
Assessing feature importance with random forests 126
Summary 128
Chapter 5: Compressing Data via Dimensionality Reduction 129
Unsupervised dimensionality reduction via principal
component analysis 130
Supervised data compression via linear discriminant analysis 140
Using kernel principal component analysis for nonlinear mappings 150
Summary 169
Chapter 6: Learning Best Practices for Model Evaluation
and Hyperparameter Tuning 171
Streamlining workflows with pipelines 171
Using k-fold cross-validation to assess model performance 175
Debugging algorithms with learning and validation curves 181
Fine-tuning machine learning models via grid search 187
Looking at different performance evaluation metrics 191
Summary 200
Chapter 7: Combining Different Models for Ensemble Learning 201
Learning with ensembles 201
Implementing a simple majority vote classifier 205
Evaluating and tuning the ensemble classifier 215
Bagging – building an ensemble of classifiers from
bootstrap samples 221
Leveraging weak learners via adaptive boosting 226
Summary 234
Chapter 8: Applying Machine Learning to Sentiment Analysis 235
Obtaining the IMDb movie review dataset 235
Introducing the bag-of-words model 238
Training a logistic regression model for document classification 246
Working with bigger data – online algorithms and out-of-core learning 248
Summary 252

[ ii ]
Table of Contents

Chapter 9: Embedding a Machine Learning Model into a


Web Application 253
Serializing fitted scikit-learn estimators 254
Setting up a SQLite database for data storage 257
Developing a web application with Flask 259
Turning the movie classifier into a web application 266
Deploying the web application to a public server 274
Summary 278
Chapter 10: Predicting Continuous Target Variables with
Regression Analysis 279
Introducing a simple linear regression model 280
Exploring the Housing Dataset 281
Implementing an ordinary least squares linear regression model 287
Fitting a robust regression model using RANSAC 293
Evaluating the performance of linear regression models 296
Using regularized methods for regression 299
Turning a linear regression model into a curve – polynomial
regression 300
Summary 311
Chapter 11: Working with Unlabeled Data – Clustering Analysis 313
Grouping objects by similarity using k-means 314
Organizing clusters as a hierarchical tree 328
Locating regions of high density via DBSCAN 336
Summary 342
Chapter 12: Training Artificial Neural Networks for
Image Recognition 343
Modeling complex functions with artificial neural networks 344
Classifying handwritten digits 352
Training an artificial neural network 367
Developing your intuition for backpropagation 374
Debugging neural networks with gradient checking 375
Convergence in neural networks 381
Other neural network architectures 383
A few last words about neural network implementation 386
Summary 387

[ iii ]
Table of Contents

Chapter 13: Parallelizing Neural Network Training with Theano 389


Building, compiling, and running expressions with Theano 390
Choosing activation functions for feedforward neural networks 403
Training neural networks efficiently using Keras 410
Summary 416

Course Module 2: Designing Machine Learning


Systems with Python

Chapter 1: Thinking in Machine Learning 421


The human interface 422
Design principles 425
Summary 453
Chapter 2: Tools and Techniques 455
Python for machine learning 456
IPython console 456
Installing the SciPy stack 457
NumPY 458
Matplotlib 464
Pandas 468
SciPy 471
Scikit-learn 474
Summary 481
Chapter 3: Turning Data into Information 483
What is data? 484
Big data 484
Signals 500
Cleaning data 502
Visualizing data 504
Summary 507
Chapter 4: Models – Learning from Information 509
Logical models 509
Tree models 517
Rule models 521
Summary 528

[ iv ]
Table of Contents

Chapter 5: Linear Models 529


Introducing least squares 530
Logistic regression 538
Multiclass classification 544
Regularization 545
Summary 548
Chapter 6: Neural Networks 549
Getting started with neural networks 549
Logistic units 551
Cost function 556
Implementing a neural network 559
Gradient checking 565
Other neural net architectures 566
Summary 567
Chapter 7: Features – How Algorithms See the World 569
Feature types 570
Operations and statistics 571
Structured features 574
Transforming features 574
Principle component analysis 583
Summary 585
Chapter 8: Learning with Ensembles 587
Ensemble types 587
Bagging 588
Boosting 594
Ensemble strategies 601
Summary 604
Chapter 9: Design Strategies and Case Studies 605
Evaluating model performance 605
Model selection 610
Learning curves 613
Real-world case studies 615
Machine learning at a glance 626
Summary 627

[v]
Table of Contents

Course Module 3: Advanced Machine


Learning with Python

Chapter 1: Unsupervised Machine Learning 631


Principal component analysis 632
Introducing k-means clustering 637
Self-organizing maps 648
Further reading 654
Summary 655
Chapter 2: Deep Belief Networks 657
Neural networks – a primer 658
Restricted Boltzmann Machine 663
Deep belief networks 679
Further reading 685
Summary 686
Chapter 3: Stacked Denoising Autoencoders 687
Autoencoders 687
Stacked Denoising Autoencoders 696
Further reading 705
Summary 705
Chapter 4: Convolutional Neural Networks 707
Introducing the CNN 707
Further Reading 729
Summary 730
Chapter 5: Semi-Supervised Learning 731
Introduction 731
Understanding semi-supervised learning 732
Semi-supervised algorithms in action 733
Further reading 756
Summary 757
Chapter 6: Text Feature Engineering 759
Introduction 759
Text feature engineering 760
Further reading 783
Summary 784
Chapter 7: Feature Engineering Part II 785
Introduction 785
Creating a feature set 786

[ vi ]
Table of Contents

Feature engineering in practice 805


Further reading 829
Summary 830
Chapter 8: Ensemble Methods 831
Introducing ensembles 832
Using models in dynamic applications 851
Further reading 863
Summary 864
Chapter 9: Additional Python Machine Learning Tools 865
Alternative development tools 866
Further reading 875
Summary 875
Chapter 10: Chapter Code Requirements 879
Biblography 881

[ vii ]
Module 1

Python Machine Learning

Leverage benefits of machine learning techniques using Python


Giving Computers the Ability
to Learn from Data
In my opinion, machine learning, the application and science of algorithms that makes
sense of data, is the most exciting field of all the computer sciences! We are living in
an age where data comes in abundance; using the self-learning algorithms from the
field of machine learning, we can turn this data into knowledge. Thanks to the many
powerful open source libraries that have been developed in recent years, there has
probably never been a better time to break into the machine learning field and learn
how to utilize powerful algorithms to spot patterns in data and make predictions
about future events.

In this chapter, we will learn about the main concepts and different types of machine
learning. Together with a basic introduction to the relevant terminology, we will lay
the groundwork for successfully using machine learning techniques for practical
problem solving.

In this chapter, we will cover the following topics:

• The general concepts of machine learning


• The three types of learning and basic terminology
• The building blocks for successfully designing machine learning systems
• Installing and setting up Python for data analysis and machine learning

[3]
Giving Computers the Ability to Learn from Data

Building intelligent machines to


transform data into knowledge
In this age of modern technology, there is one resource that we have in abundance: a
large amount of structured and unstructured data. In the second half of the twentieth
century, machine learning evolved as a subfield of artificial intelligence that involved
the development of self-learning algorithms to gain knowledge from that data in
order to make predictions. Instead of requiring humans to manually derive rules
and build models from analyzing large amounts of data, machine learning offers a
more efficient alternative for capturing the knowledge in data to gradually improve
the performance of predictive models, and make data-driven decisions. Not only is
machine learning becoming increasingly important in computer science research but
it also plays an ever greater role in our everyday life. Thanks to machine learning,
we enjoy robust e-mail spam filters, convenient text and voice recognition software,
reliable Web search engines, challenging chess players, and, hopefully soon, safe and
efficient self-driving cars.

The three different types of


machine learning
In this section, we will take a look at the three types of machine learning: supervised
learning, unsupervised learning, and reinforcement learning. We will learn about the
fundamental differences between the three different learning types and, using
conceptual examples, we will develop an intuition for the practical problem
domains where these can be applied:

[4]
Chapter 1

Making predictions about the future with


supervised learning
The main goal in supervised learning is to learn a model from labeled training data
that allows us to make predictions about unseen or future data. Here, the term
supervised refers to a set of samples where the desired output signals (labels) are
already known.

Considering the example of e-mail spam filtering, we can train a model using a
supervised machine learning algorithm on a corpus of labeled e-mail, e-mail that are
correctly marked as spam or not-spam, to predict whether a new e-mail belongs to
either of the two categories. A supervised learning task with discrete class labels, such
as in the previous e-mail spam-filtering example, is also called a classification task.
Another subcategory of supervised learning is regression, where the outcome signal is
a continuous value:

Classification for predicting class labels


Classification is a subcategory of supervised learning where the goal is to
predict the categorical class labels of new instances based on past observations.
Those class labels are discrete, unordered values that can be understood as the
group memberships of the instances. The previously mentioned example of
e-mail-spam detection represents a typical example of a binary classification
task, where the machine learning algorithm learns a set of rules in order to
distinguish between two possible classes: spam and non-spam e-mail.

[5]
Giving Computers the Ability to Learn from Data

However, the set of class labels does not have to be of a binary nature. The predictive
model learned by a supervised learning algorithm can assign any class label that was
presented in the training dataset to a new, unlabeled instance. A typical example of
a multi-class classification task is handwritten character recognition. Here, we could
collect a training dataset that consists of multiple handwritten examples of each letter
in the alphabet. Now, if a user provides a new handwritten character via an input
device, our predictive model will be able to predict the correct letter in the alphabet
with certain accuracy. However, our machine learning system would be unable to
correctly recognize any of the digits zero to nine, for example, if they were not part
of our training dataset.

The following figure illustrates the concept of a binary classification task given 30
training samples: 15 training samples are labeled as negative class (circles) and 15
training samples are labeled as positive class (plus signs). In this scenario, our dataset
is two-dimensional, which means that each sample has two values associated with
it: x1 and x2 . Now, we can use a supervised machine learning algorithm to learn a
rule—the decision boundary represented as a black dashed line—that can separate
those two classes and classify new data into each of those two categories given its x1
and x2 values:

Regression for predicting continuous outcomes


We learned in the previous section that the task of classification is to assign
categorical, unordered labels to instances. A second type of supervised learning is
the prediction of continuous outcomes, which is also called regression analysis. In
regression analysis, we are given a number of predictor (explanatory) variables and a
continuous response variable (outcome), and we try to find a relationship between
those variables that allows us to predict an outcome.

[6]
Chapter 1

For example, let's assume that we are interested in predicting the Math SAT
scores of our students. If there is a relationship between the time spent studying
for the test and the final scores, we could use it as training data to learn a model
that uses the study time to predict the test scores of future students who are
planning to take this test.

The term regression was devised by Francis Galton in his article


Regression Towards Mediocrity in Hereditary Stature in 1886. Galton
described the biological phenomenon that the variance of height
in a population does not increase over time. He observed that
the height of parents is not passed on to their children but the
children's height is regressing towards the population mean.

The following figure illustrates the concept of linear regression. Given a predictor
variable x and a response variable y, we fit a straight line to this data that minimizes
the distance—most commonly the average squared distance—between the sample
points and the fitted line. We can now use the intercept and slope learned from this
data to predict the outcome variable of new data:

[7]
Giving Computers the Ability to Learn from Data

Solving interactive problems with


reinforcement learning
Another type of machine learning is reinforcement learning. In reinforcement
learning, the goal is to develop a system (agent) that improves its performance
based on interactions with the environment. Since the information about the current
state of the environment typically also includes a so-called reward signal, we can
think of reinforcement learning as a field related to supervised learning. However, in
reinforcement learning this feedback is not the correct ground truth label or value,
but a measure of how well the action was measured by a reward function. Through
the interaction with the environment, an agent can then use reinforcement learning
to learn a series of actions that maximizes this reward via an exploratory
trial-and-error approach or deliberative planning.

A popular example of reinforcement learning is a chess engine. Here, the agent decides
upon a series of moves depending on the state of the board (the environment), and the
reward can be defined as win or lose at the end of the game:

Discovering hidden structures with


unsupervised learning
In supervised learning, we know the right answer beforehand when we train
our model, and in reinforcement learning, we define a measure of reward for
particular actions by the agent. In unsupervised learning, however, we are dealing
with unlabeled data or data of unknown structure. Using unsupervised learning
techniques, we are able to explore the structure of our data to extract meaningful
information without the guidance of a known outcome variable or reward function.

[8]
Chapter 1

Finding subgroups with clustering


Clustering is an exploratory data analysis technique that allows us to organize a
pile of information into meaningful subgroups (clusters) without having any prior
knowledge of their group memberships. Each cluster that may arise during the
analysis defines a group of objects that share a certain degree of similarity but are
more dissimilar to objects in other clusters, which is why clustering is also sometimes
called "unsupervised classification." Clustering is a great technique for structuring
information and deriving meaningful relationships among data, For example, it
allows marketers to discover customer groups based on their interests in order to
develop distinct marketing programs.

The figure below illustrates how clustering can be applied to organizing unlabeled
data into three distinct groups based on the similarity of their features x1 and x2 :

Dimensionality reduction for data compression


Another subfield of unsupervised learning is dimensionality reduction. Often we are
working with data of high dimensionality—each observation comes with a high
number of measurements—that can present a challenge for limited storage space
and the computational performance of machine learning algorithms. Unsupervised
dimensionality reduction is a commonly used approach in feature preprocessing
to remove noise from data, which can also degrade the predictive performance of
certain algorithms, and compress the data onto a smaller dimensional subspace
while retaining most of the relevant information.

[9]
Giving Computers the Ability to Learn from Data

Sometimes, dimensionality reduction can also be useful for visualizing data—for


example, a high-dimensional feature set can be projected onto one-, two-, or
three-dimensional feature spaces in order to visualize it via 3D- or 2D-scatterplots
or histograms. The figure below shows an example where non-linear dimensionality
reduction was applied to compress a 3D Swiss Roll onto a
new 2D feature subspace:

An introduction to the basic terminology


and notations
Now that we have discussed the three broad categories of machine
learning—supervised, unsupervised, and reinforcement learning—let us have
a look at the basic terminology that we will be using in the next chapters. The
following table depicts an excerpt of the Iris dataset, which is a classic example in
the field of machine learning. The Iris dataset contains the measurements of 150 iris
flowers from three different species: Setosa, Versicolor, and Virginica. Please check if
this is replaced. Here, each flower sample represents one row in our data set, and the
flower measurements in centimeters are stored as columns, which we also call the
features of the dataset:

[ 10 ]
Chapter 1

To keep the notation and implementation simple yet efficient, we will make use of
some of the basics of linear algebra. In the following chapters, we will use a matrix
and vector notation to refer to our data. We will follow the common convention to
represent each sample as separate row in a feature matrix X , where each feature is
stored as a separate column.

The Iris dataset, consisting of 150 samples and 4 features, can then be written as a
150 × 4 matrix X ∈ 150×4 :

[ 11 ]
Giving Computers the Ability to Learn from Data

For the rest of this book, we will use the superscript (i) to refer to the ith
training sample, and the subscript j to refer to the jth dimension of the
training dataset.
We use lower-case, bold-face letters to refer to vectors ( x ∈ R ) and
n×1

upper-case, bold-face letters to refer to matrices, respectively ( X ∈  n×m ) .


To refer to single elements in a vector or matrix, we write the letters in
(n) (n)
italics ( x or x( m ) , respectively).
For example, x1150 refers to the first dimension of flower sample 150, the
sepal length. Thus, each row in this feature matrix represents one flower
(i ) 1×4
instance and can be written as four-dimensional row vector x ∈  ,
(i ) (i ) (i ) (i ) (i )
x =  x1 x2 x3 x4  .
Each feature dimension is a 150-dimensional column vector x j ∈ 150×1 ,
for example:

 x j (1) 
 ( 2) 
 x 
xj =  j 
  
 x (150) 
 j .
Similarly, we store the target variables (here: class labels) as a
 y (1) 
 
150-dimensional column vector y =  …  ( y ∈ {Setosa, Versicolor, Virginica} ) .
 y (150) 
 

A roadmap for building machine learning


systems
In the previous sections, we discussed the basic concepts of machine learning and the
three different types of learning. In this section, we will discuss other important parts
of a machine learning system accompanying the learning algorithm. The diagram
below shows a typical workflow diagram for using machine learning in predictive
modeling, which we will discuss in the following subsections:

[ 12 ]
Another Random Scribd Document
with Unrelated Content
The author is not named in the book; according to the tradition it is
Ezra. As the genealogical tables [127]give six generations after
Zerubbabel (I., iii. 19–24), we may assume that the author wrote
about fifty years after Zerubbabel; that is, the last years of Ezra and
Nehemiah.

The sources from which the author derived his information were,
besides the Biblical books, the following:—The book of the kings of
Judah; the book of the kings of Israel, registers probably kept in the
Temple archives; the histories of Samuel the Seer, Nathan the
prophet, and Gad the Seer; the prophecy of Ahijah of Shilo; the
visions of Jedo; the Midrash of the prophet Iddo; the history of Jehu,
son of Hanani; the history of Isaiah, son of Amoz, and the history of
Hozai.

This is the last book of the series of Holy Writings. Books that were
written later, whatever their intrinsic value may be, were not
considered holy, and were not received into this collection. There are
a number of books known as Apocrypha (‫‏גנוזים‬‎), lit. “Hidden things”
or “put aside,” that is, kept separate from the Holy Scriptures. They
were not considered as genuine, as they consisted of a mixture of
fact and fiction, truth and error. They were, however, not suppressed
or forbidden; in the Talmud several quotations from these books are
met with. The following are the principal books belonging to the
Apocrypha:—

(1.) The Book of Wisdom, or the Wisdom of Solomon. Wisdom


based on the fear of God, and guided by it, is the source of man’s
true happiness, and if wisdom and virtue are not rewarded by
success in mundane affairs, the reward is sure to come in the future
world. This is the quintessence of the lessons taught in this book.
[128]The kings and potentates of the earth are frequently exhorted to
be just and kind towards their people, and to remember that they are
but human beings, weak and mortal, like the rest of mankind;
wisdom alone can raise them to higher perfection and happiness.

“For the very true beginning of her is the desire of discipline, and the care
of discipline is love. And love is the keeping of her laws; and the giving
heed unto her laws is the assurance of incorruption. And incorruption
maketh us near God. Therefore the desire of wisdom bringeth to a
kingdom. If your delight be then in thrones and sceptres, O ye kings of the
people, honour wisdom, that ye may reign for evermore” (vi. 17–21).

“For regarding not wisdom, they got not only this hurt, that they knew not
the things which were good, but also left behind them to the world a
memorial of their foolishness, so that in the things wherein they offended
they could not so much as be hid. But wisdom delivered from pain those
that attended upon her. When the righteous fled from his brother’s wrath,
she guided him into right paths, shewed him the kingdom of God, and
gave him knowledge of holy things that made him rich in his travels, and
multiplied the fruit of his labours” (x. 8–10).

(2.) The Wisdom of Jesus, son of Sirach.—Proverbs, maxims, and


moral lessons collected by Joshua (Jesus), son of Sirach of
Jerusalem. After having studied the Law, the Prophets, and the other
Holy Writings, he thought it advisable to write a book on knowledge
and wisdom for those who seek instruction, in order to lead them to
greater obedience to the Law. Joshua’s grandson migrated from
Palestine to Egypt, and translated [129]the work of his grandfather
into Greek for those who could not read the Hebrew original. The
translation was made in the thirty-eighth year of King Euergetes II. of
Egypt (3888 a.m.).

The contents of the book are similar to those of the Proverbs of


Solomon: the author recommends the acquisition of wisdom,
patience, faith in God, meekness, obedience of children to parents,
charity, cautiousness in the use of the tongue, temperance, honesty,
and the like. As models of piety and wisdom the principal heroes in
the Bible, from Adam to Joshua, son of Jehozadak, are named, and
in addition to these Simon the high priest.

“My son, if thou come to serve the Lord, prepare thy soul for temptation.
Set thy heart aright, and constantly endure, and make not haste in time of
trouble. Cleave unto him, and depart not away, that thou mayest be
increased at thy last end. Whatsoever is brought upon thee take
cheerfully, and be patient when thou art changed to a low estate. For gold
is tried in the fire, and acceptable men in the furnace of adversity. Believe
in him, and he will help thee: order thy way aright, and trust in him” (ii. 1–
6).

“But he that giveth his mind to the law of the Most High, and is occupied in
the meditation thereof, will seek out the wisdom of the most ancient, and
be occupied in prophecies. He will keep the sayings of most renowned
men, and where subtle parables are, He will be there also. He will seek
out the secrets of grave sentences, and be conversant in dark parables”
(xxxix. 1–3).

(3.) Baruch.—The book may be divided into two [130]parts. In the first
part Baruch, son of Nerijah, the amanuensis of the prophet
Jeremiah, addresses, in Babylon, Jehoiachin, the captive king of
Judah, and the other captive Jews; they send money to Jerusalem
for sacrifices, with a letter exhorting their brethren to return to God,
and comforting them with the prospect of a glorious future. The
second part contains a letter of Jeremiah to his brethren in
Jerusalem denouncing idolatry.

The letters are probably not genuine, not being in harmony with the
facts related in the books of Jeremiah and Kings.

(4.) The Book of Tobit.—Tobit, of the tribe of Naphtali, a good and


pious man, was one of those who were carried away into the
Assyrian captivity. One of the charitable acts to which he devoted
himself with special zeal was the burying of the dead. Twice was
misfortune brought upon him for practising this deed of piety. Once
he had to flee, and to remain away from his family in misery and
want, and a second time something fell into his eyes, and he
became blind. In both cases he was saved out of his trouble, and
was greatly rewarded for his patience, his faith in God, and his
perseverance in the performance of the Divine commandments. The
author of the book is not known.

(5.) Judith.—An incident of Jewish history during the Persian rule.


Judith is set forth as an ideal of piety, beauty, courage, and chastity.
Holofernes, a general in the service of Nebuchadnezzar, king of
Assyria, conquers many lands, but meets with vigorous resistance in
Judea; he besieges Bethulia and endeavours to suppress the Jewish
religion. He falls by the [131]hands of Judith. Thus the stratagem and
the courage of the Jewish heroine, combined with the plans of Divine
justice, frustrated the wicked plans of the heathen conqueror, and
delivered the besieged city.

(6.) Additions to the Books of Daniel and Ezra, containing—

(a.) The song of the three men in the furnace (Dan. iii.).

(b.) The false charges brought against Susanna, and her deliverance
through Daniel.

(c.) Bel and the Dragon. Cyrus, the Persian, worshipped these idols,
but was convinced by Daniel that they had no claim whatever to
man’s worship.

(d.) The apocryphal Book of Esdras, containing portions of the Books


of Chronicles, Ezra, and Nehemiah; only chaps. iii. and iv. being
original. In these it is related how Zerubbabel distinguished himself
before King Darius in describing Woman and Truth as the mightiest
rulers of mankind, and thus obtained permission to return to
Palestine and rebuild the Temple. A second apocryphal Book of
Esdras is named, in which Ezra is represented as a prophet
addressing his brethren in the name of God, and telling them the
visions he had.

(7.) The Books of the Maccabees.—Three books containing the


history of the Maccabees, and various episodes of the wars against
the Syrian oppressors, both legendary and historical.

Sixth Principle.—“I firmly believe that all the words of the Prophets
are true.”

By “the Prophets” the prophets thus designated in [132]the Bible are


to be understood who have proved themselves to be the true
messengers of God, and were accepted as such by the people. They
either counselled the people what to do under various
circumstances, in times of peace and in times of war, in times of
security and in times of danger, or they announced the coming
catastrophe as a punishment sent by the Almighty for disobedience,
and foretold future happiness and prosperity in case of improvement
and return to God. Those prophecies that referred to the proximate
future have been verified by subsequent events, and so also will
those prophecies that refer to the remote future and have not yet
been fulfilled.

“A prophet out of thy midst, of thy brethren, like unto me, will the
Lord thy God raise up unto thee; unto him ye shall hearken” (Deut.
xviii. 15). “The former things, behold, they are come to pass, and
new things do I declare; before they will spring forth, I shall let you
hear” (Isa. xlii. 9). “I have also spoken unto the prophets, and I have
multiplied visions, and by the ministry of the prophets have I used
similitudes” (Hosea xii. 11). “And by a prophet the Lord brought Israel
out of Egypt, and by a prophet was he preserved” (Ibid. 14).
In the sixth article we declare our belief in the fact that the Almighty
has communicated His Will to human beings, although we are
incapable of forming a clear and definite idea of the manner in which
such communication took place. The selection of the individual for
the office of a prophet, as well as of the time, the place, and the
object of the Divine communication, is dependent solely on the Will
of God, whose Wisdom [133]and Plan no mortals are able to fathom.
We know only the fact that Malachi closed the series of Prophets,
but are ignorant of the reason why since Malachi no human being
has “found a vision from the Lord.” Mankind is, however, not
altogether deprived of the benefit of prophecy; the holy book need
only be opened, and the message of the prophets is heard once
more.

Seventh Principle.—“I firmly believe that the prophecy of Moses was


a direct prophecy, and that Moses was the chief of the prophets,
both of those who preceded him and of those who followed him.”

All that has been said with regard to the sixth article applies to the
prophecy of Moses. There is, however, this distinction between the
words of Moses and the words of other prophets:—whilst other
prophets chiefly addressed their own generation, blaming their
brethren for disobedience to the Divine Law, threatening with
punishments and comforting with blessings of which experience was
to be made in the remote future, Moses addresses all times and
generations, communicating to them laws “for all generations,”
“everlasting statutes,” “the things which have been revealed for us
and our children for ever.” He is therefore proclaimed by the Almighty
as the greatest prophet. When Miriam and Aaron had spoken
against Moses, God rebuked them, saying, “If there be among you a
prophet of the Lord, I will make myself known unto him in a vision, I
will speak with him in a dream. My servant Moses is not so; he is
faithful in all my house; with him will I speak mouth to mouth, even
manifestly, and not in dark speeches; and the form of the Lord shall
he behold” (Num. xii. 6–8). The [134]Torah concludes with the praise
of Moses, as follows: “And there hath not arisen a prophet since in
Israel like unto Moses, whom the Lord knew face to face: in all the
signs and the wonders, which the Lord sent him to do in the land of
Egypt, to Pharaoh, and to all his servants, and to all his land; and in
all the mighty hand, and in all the great terror, which Moses wrought
in the sight of all Israel” (Deut. xxxiv. 10–12).

The phrase “knew God face to face,” or “I will speak with him mouth
to mouth,” and the like, denotes figuratively “the clearest, most
direct, and most simple communication,” the figure being taken from
the way in which men communicate to each other things when they
desire to be clearly understood, and to leave no doubt as to the truth
and the meaning of the communication.

Eighth Principle.—“I firmly believe that the Law which we possess


now is the same which has been given to Moses on Sinai.”

The whole Torah, including both history and precepts, is of Divine


origin; nothing is contained in the Torah that was not revealed to
Moses by the Almighty, although we do not know in what manner
Moses received the information. The history of preceding
generations was probably handed down to his time by tradition; in
part it may have been contained in documents then extant, as is
likely to have been the case with the various genealogies mentioned
in the Pentateuch. But it was by Divine inspiration that Moses knew
to distinguish between truth and error, between fiction and reality.
The events recorded in the Pentateuch are to demonstrate and to
keep constantly [135]before our eyes the fact that there is a higher
Power that ordains the fate of men and nations according to their
deeds. Everything is described in a simple and objective manner.
Although the whole Torah is the work of Moses, the great prophet
speaks of himself everywhere in the third person, except in the Book
of Deuteronomy, in which he records his addresses to the people in
the last year of his life.

The last few verses, which describe the death of Moses, the
mourning of the Israelites for the death of their teacher, and his
exaltation above all other prophets, have been added to the Torah by
Joshua the son of Nun, the leader of the Israelites after the death of
Moses. Thus, from that day until the present the Torah, in its
integrity, has been in the hands of the children of Israel. It was
guarded as the most valuable national treasure, and although there
have been not a few generations which were corrupt and idolatrous,
Israel has never been entirely bereaved of pious and faithful
worshippers of the true God; and when in one generation or period
the study and the practice of the Torah were neglected, they were
resumed with greater vigour and zeal in the next.

There is a tradition recorded in the Talmud that after the Babylonian


exile Ezra, the Scribe, replaced the ancient Hebrew characters in
which the Torah had originally been written by the square characters
still in use. Nothing, however, was omitted from or added to the
contents of the Torah, when the present forms of the letters were
introduced by Ezra. In the scrolls of the Law the letters were not
provided with vowel-points and accents; the manner in which the
words, [136]phrases, and sentences were to be read was a subject of
oral teaching. Also many explanations and details of the laws were
supplemented by oral teaching; they were handed down by word of
mouth from generation to generation, and only after the destruction
of the second Temple were they committed to writing. The latter are,
nevertheless, called Oral Law (‫‏תורה שבעל פה‬‎), as distinguished from
the Torah or Written Law (‫‏תורה שבכתב‬‎), which from the first was
committed to writing. Those oral laws which were revealed to Moses
on Mount Sinai are called ‫‏הלכה למשה מסיני‬‎“Laws given to Moses on
Mount Sinai.” There are several passages in the Bible from which it
appears that a certain unwritten law must have supplemented the
written Law; e.g., when a man was found in the wilderness gathering
sticks on the Sabbath-day, the persons who discovered him brought
him to Moses. They must have been taught before, that the
gathering of sticks constituted a ‫‏מלאכה‬‎, labour prohibited on the
Sabbath-day, although this had not been distinctly stated in the
written Sabbath-laws. Had this not been the case the Sabbath-
breaker could not have been put to death, since he would have
committed the sin in ignorance. The same can be said of the man
who cursed the name of God; he must have known that cursing the
name of God was a capital crime; for he would not have been put to
death if the Israelites had not yet been taught that death would be
inflicted for such an act. The question which the prophet Haggai (ii.
11) addressed to the priests, and the answers which the priests
gave, lead to the conclusion that the details of the laws on
uncleanness and cleanness (‫‏טומאה וטהרה‬‎) must have been known to
[137]the priests and the prophets to a greater extent than has been
explained in the written Law. Besides, there were many precepts that
came at once into force. These must have been fully explained to the
people, who were anxious to obey the word of God.

All these explanations and the detailed rules with regard to the
written Divine precepts of the Pentateuch, together with laws and
institutions established in the course of time by the highest
authorities of the nation in obedience to the dictates of the
Pentateuch, form the contents of the Oral Law.

The Oral Law or the Tradition has been handed down in two different
forms: (a) in the form of a running Commentary on the Pentateuch;
such Commentaries were called Midrashim; (b) arranged according
to the different subjects, and treated independently of the text of the
Torah. This is done in the Talmud (“lesson,” “tradition”).
The principal Midrashim are: Mechilta (lit. “measure”) on Exodus;
Sifra (“book”) on Leviticus; Sifre (“books”) on Numbers and
Deuteronomy. Rabboth on the Pentateuch and the five Megilloth.
Yalkut (“collection”) on all the books of the Bible.

The Talmud—which exists in two different recensions, viz., the


Jerusalem Talmud and the Babylonian Talmud—consists of two
elements, which have to each other the relation of text and
commentary, and are called Mishnah (‫‏משנה‬‎“learnt by heart”), and
Gemara (‫‏גמרא‬‎lit. “completion,” “a thing settled”); the former contains
the traditional laws mostly without argumentation; in the latter these
laws are further discussed, examined, and finally settled. Following
the example [138]of the Pentateuch, the Talmud includes two
elements: laws and narratives, or Halachah (‫‏הלכה‬‎) and Agada
(‫‏אגדה‬‎); the latter, the Agada, contains history, fables, allegory,
meditations, prayers, reflections, philosophical and religious
discussions, and a large number of moral sayings. The Midrashim
likewise include these two elements.

The Mishnah is divided into the following six orders or sections


(‫‏סדרים‬‎): 13—

1. ‫ם‬‎ ‫‏זרעי‬‎“Seeds.” Laws referring to agriculture; preceded by laws


on Divine Worship.
2. ‫ד‬‎ ‫‏מוע‬‎“Seasons.” On Sabbath and Festivals.
3. ‫ם‬‎ ‫‏נשי‬‎“Women.” Marriage Laws.
4. ‫ן‬‎‫‏נזיקי‬‎“Damages.” Civil and criminal legislation; the
Government.
5. ‫ם‬‎ ‫‏קדשי‬‎“Holy things.” On Sacrifices.
6. ‫ת‬‎ ‫‏טהרו‬‎“Purity.” On the distinction between clean and unclean.

The laws taught in the Talmud are: (i) those which are directly or
indirectly derived from the text of the Pentateuch; they are called
“laws derived from the Torah” (‫‏מן התורה‬‎or ‫‏מדאורייתא‬‎); (2) those which
trace their origin to the time of Moses, or, in general, to the remote
past; they are called ‫‏הלכה למשה מסיני‬‎“Law given to Moses on Sinai;”
(3) those laws which originated between the period of the
Pentateuch and the close of the Bible; they are called ‫‏דברי קבלה‬‎
(“words of tradition”); (4) those which have been introduced in post-
Biblical times; they are laws ‫‏מדרבנן‬‎“laws introduced by our
teachers.” These are either preventives against breaking any of the
[139]Divine precepts, and are then called ‫‏‬‎or ‫‏סיג‬‎“a fence,” or tekanoth
(‫‏תקנות‬‎“institutions” or “regulations”) made in order to ensure
obedience to the Law and improvement of conduct, to remove
abuses and prevent error and misunderstanding; (5) Minhag,
“Custom” (‫‏מנהג‬‎); religious practices which have not been introduced
by any authority or based on a particular Biblical text, but in
consequence of long usage have become as sacred as a law
established by the proper authority.

These laws, as finally settled, were again codified, in various works,


the most important of which are the following two: (1) Mishneh-torah
(‫‏משנה תורה‬‎or ‫‏יד החזקה‬‎14 lit. “Copy of the Law,” or “Strong Hand”), by
Moses Maimonides (twelfth century) in fourteen books; (2) Shulchan-
aruch (‫‏שלחן ערוך‬‎, lit. “Table-arranged”), by Rabbi Joseph Caro
(sixteenth century).

Ninth Principle.—“I firmly believe that this Law will not be changed,
and that there will not be any other Law given by the Creator,
blessed be His Name.”

In this article we pronounce our belief in the immutability of the Law.


Over and over again the phrase “an everlasting statute” (‫‏חקת עולם‬‎)
occurs in the Pentateuch. It is true that the Hebrew term ‫‏עולם‬‎is used
in the Bible in the sense of “a very long time,” but in the phrase ‫‏חקת‬
‫עולם‬‎the word cannot have that meaning. Some indication would
have been necessary to inform the people when the laws would
cease to be in force. On the contrary, the test of a prophet
addressing his brethren in the name of God, as a [140]Divine
messenger, consists in the harmony of his words with the precepts of
the Pentateuch. A prophet who, speaking in the name of God,
abrogates any of the laws of the Pentateuch is a false prophet. “If
there arise in the midst of thee a prophet or a dreamer of dreams,
and he give thee a sign or a wonder, and the sign or wonder come to
pass whereof he spake unto thee, saying, Let us go after other gods
which thou hast not known, and let us serve them: thou shalt not
hearken unto the words of that prophet or unto that dreamer of
dreams.… Ye shall walk after the Lord your God, and fear him, and
keep his commandments, and obey his voice, and ye shall serve
him, and cleave unto him. And that prophet or that dreamer of
dreams shall be put to death; because he hath spoken rebellion
against the Lord your God, which brought you out of the land of
Egypt, … to draw thee aside out of the way which the Lord thy God
commanded thee to walk in” (Deut. xiii. 2–6). Moses distinctly says,
“The things that are revealed belong unto us and to our children for
ever, that we may do all the words of this law” (Ibid. xxix. 28).

There is also an express commandment given: “Ye shall not add


unto the word which I command you, neither shall you diminish from
it, that ye may keep the commandments of the Lord your God which
I command you” (Ibid. iv. 2). In two ways this law may appear to
have been disregarded: there are certain sections of the Law which
are at present not in force; and, on the other hand, there are many
apparently new precepts at present in force which have been
introduced in the course of time by the religious authorities [141]of the
nation. But these are only apparent exceptions; in reality they are
entirely in harmony with the Pentateuch.

As to the first class, there are many of the Divine commandments


the fulfilment of which depends on certain conditions; e.g., the
existence of the Tabernacle or of the Temple and its service, the
possession of Palestine by the Israelites, the independence of the
Jewish State. In the absence of these conditions such laws cannot
be fulfilled. The laws of sacrifices belong to this class. We are, in
reference to these laws, in the same condition as a person who is
physically prevented from doing what he is commanded to do, and
what he is actually longing to do. The Law is not altered; our
circumstances demand a temporary suspense of such laws and not
their abrogation.

The second class contains all those precepts which are known as
‫‏מצות דרבנן‬‎“Rabbinical precepts,” ‫‏תקנות‬‎and ‫‏מנהגים‬‎“Institutions” and
“Customs.” But these imply no addition to the Torah; they are merely
byelaws and regulations as regards the method of carrying out the
laws of the Pentateuch, and are designed to facilitate or ensure their
fulfilment, and to prevent ourselves from forgetting or disregarding
them. Our teachers, the Rabbis, made it a matter of conscience to
describe their own regulations as ‫‏דרבנן‬‎non-Pentateuchical, and
throughout the Oral Law and the entire Talmudic literature the
distinction between ‫‏דרבנן‬‎and ‫‏מן התורה‬‎is noted and scrupulously
upheld.

It is useless to investigate whether it would be in harmony with the


immutability of the Divine Being to change the laws or any of them,
or to grant a new [142]revelation. Certainly the words “I, the Lord,
have not changed” (Mal. iii. 6) have great weight; so also, “For God
is not a son of man that he should change his mind” (Num. xxiii. 19).
But the fact that the laws were given by God as “an everlasting
statute for all generations” makes all philosophical speculation on
that point superfluous. Persons who address us in the name of God
as His messengers, and bid us turn away from any of the laws
commanded in the Pentateuch, are in our eyes impostors, who,
knowingly or unknowingly, give forth their own opinions as Divine
inspirations.
[Contents]

3. Reward and Punishment, ‫‏שכר ועונש‬‎.

“Behold I have set before thee this day life and good, and death and
evil: in that I command thee this day to love the Lord thy God, to
walk in his ways, and to keep his commandments and his statutes
and his judgments, that thou mayest live and multiply, and that the
Lord thy God may bless thee in the land whither thou passest over
Jordan to go in to possess it” (Deut. xxx. 15). “I call heaven and
earth to witness against you this day, that I have set before thee life
and death, the blessing and the curse: therefore choose life, that
thou mayest live, thou and thy seed: to love the Lord thy God, to
obey his voice, and to cleave unto him: for that is thy life and the
length of thy days” (Ibid. xxx. 19, 20).

The doctrine taught in this passage is the alpha and the omega of
the sacred literature. The whole history related in the Bible from the
Creation to the [143]Babylonian captivity and the restoration of the
Jews to their land is but one continuous series of illustrations of this
doctrine. Obedience to God’s word is followed by His blessings,
while disobedience is the cause of ruin and misery. Thus, in
Lamentations the poet exclaims in the name of his nation, “Just is
the Lord, for I rebelled against his commandment” (Lam. i. 18).
Moses, in his last song exhorting the people to obedience to the
Almighty, begins his address with a praise of God’s justice, saying,
“The Rock, his work is perfect, for all his ways are judgment: a God
of faithfulness, and without wrong, just and right is he” (Deut. xxxii.
4). Even those who doubted the Divine justice, in respect to the fate
of individual persons or nations, admitted, “Surely I know that it shall
be well with them that fear God, which fear before him: but it shall
not be well with the wicked, neither shall he prolong his days, which
are as a shadow: because he feareth not before God” (Eccles. viii.
12, 13). Job, wondering why he should be subjected to the greatest
trials, cannot help confessing, “Even he will be to me an help, for
there shall not come before him an hypocrite” (Job xiii. 16). God is
therefore called “God of judgment,” ‫‏אלהי המשפט‬‎(Mal. ii. 17); ‫‏דין‬‎
“Judge” (1 Sam. xxiv. 15); ‫‏צדיק‬‎“just,” ‫‏שופט צדיק‬‎“just Judge” (Ps. vii.
12); ‫‏אל קנא‬‎“a jealous God” (Exod. xx. 5); ‫‏אל נקמות‬‎“God of
vengeance” (Ps. xciv. 1); ‫‏אלהים‬‎“God” in the sense of “Judge.” The
rejection of this belief by the wicked is expressed by the phrase ‫‏אין‬
‫אלהים‬‎“There is no God.” Thus David exclaims, “The fool hath said in
his heart, There is no God; they are corrupt; they [144]have done
abominable things; there is none that doeth good” (Ps. xiv. 1). In
post-Biblical literature we find this unbelief, which is characterised as
the source of all corruption and wickedness, expressed by the
phrase, ‫‏לית דין ולית דינא‬‎“There is no judgment, and there is no judge”
(Targ. Ps. Jonathan, Gen. iv. 8).

There are two different sources from which such unbelief springs
forth—limitation of God’s powers and limitation of man’s capacities.
The one of these sources leads to a denial of God’s Omniscience,
whilst the other deprives man of his freewill. There are some who
argue that God is too high to notice the ways and the acts of
individual men, and that these must be utterly insignificant in
comparison with God’s greatness. “They crush thy people, O Lord,
and afflict thine heritage. They slay the widow and the stranger, and
murder the fatherless. And they say, The Lord shall not see, neither
shall the God of Jacob consider” (Ps. xciv. 5–7). “And thou sayest,
What doth God know? Can he judge through the thick darkness?
Thick clouds are a covering to him, that he seeth not; and he walketh
in the sphere of heaven” (Job xxii. 13, 14). The very words which the
Psalmist addresses to God with a heart full of gratitude, “What is
man that thou art mindful of him, and the son of man that thou
visitest him?” (Ps. viii. 5), are uttered in a rebellious spirit by the
unbeliever, who thus “sets limits to the Holy One of Israel” (Ps. lxxviii.
41). But the power of God is not limited, nor is His wisdom or His
goodness; He is not only “the God of heaven,” but also “the God of
the earth.” He who has created everything has certainly a knowledge
[145]of everything. “Lift up your eyes on high and see who hath
created these things. He who bringeth forth by number their host,
calleth all of them by name; not one of them escapeth the knowledge
of him who is great in might and strong in power” (Isa. xl. 26). The
Psalmist thus replies to those who deny God’s Omniscience:
“Consider, ye brutish among the people; and ye fools, when will ye
be wise? He that planted the ear, shall he not hear; he that formed
the eye, shall he not see? He that chastiseth the nations, shall he not
correct, even he that teacheth man knowledge? The Lord knoweth
the thoughts of man, however vain they be” (Ps. xciv. 8–11). It would
indeed be absurd to imagine that the Creator of all things should not
take notice of everything that His hands have made. What difference
can it make to the Almighty whether He provides for the whole
human race or for one individual man? It would be attributing to the
Divine Being human weakness and false pride if we assumed that
He is too great to take notice of any single creature of His! Rabbi
Jochanan said wherever in the Bible we find a description of the
greatness of God, there we find His meekness. Thus, e.g., it is said
in the Torah: “For the Lord, your God, he is the God of gods and the
Lord of lords, the mighty, the great, the strong, and the terrible, who
regardeth not persons, nor taketh reward. He doth execute the
judgment of the fatherless and widow, and loveth the stranger in
giving him food and raiment” (Deut. x. 17, 18).
That man is not insignificant in the eyes of God is clearly expressed
in the account of the Creation, [146]where we are taught that man
was made by God ruler “over the fish of the sea and over the fowl of
the air, and over the cattle, and over all the earth, and over every
creeping thing that creepeth upon the earth” (Gen. i. 26). “Man is
loved by the Almighty,” say our Sages, “because he is created in the
image of God; but it was by a love still greater that it was made
known to him that he was created in the image of God” (Mishnah
Aboth, iii. 18).

One of the chief blessings man received at the hands of his Creator
is freewill. Within certain limits man can determine his own actions.
When he is about to do a thing, he can reflect on it, examine its
nature, investigate into its consequences, and accordingly either do
it or refrain from doing it. God said to the Israelites, “I call heaven
and earth to witness against you this day, that I have set before thee
life and death, the blessing and the curse; and thou shalt choose life”
(Deut. xxx. 19). Our freedom, however, is not unlimited. There are
various causes that prevent us from remaining firm to our will. If we
resolve to do what is beyond our physical condition, we cannot carry
it out. Again, if a man chooses to do what would interfere with the will
of his fellow-men, he will frequently be compelled to abandon or
change his own determination; especially as he is in most cases
ignorant of the thoughts and plans of his fellow-men. In a still higher
degree this is the case with regard to the designs of the Supreme
Being. Hence the great difference between our will and our actual
deeds. We have, however, the conviction that ‫‏בא לטהר מסייעין לו מן‬
‫השמים בא לטמא פותחין לו‬‎“He who wishes to purify [147]himself is
helped by Heaven towards his aim, while he who desires to defile
himself will find the means thereto” (Babyl. Tal. Shabbath, p. 104).

We admit that there are influences over which man has no control,
and which, on the contrary, help to shape his will. No man is so
isolated as to be entirely inaccessible to outward influences. Man
inherits certain ideas and habits from his parents; others are forced
upon him by his surroundings, especially in his earliest youth; society
and the State compel him to conform to certain notions and laws;
climate and temperature also have no small share in the formation of
man’s will. But in spite of all these influences man’s will is free, and it
is by reason of his free-will that he chooses to conform to the rules of
society and the laws of the State. Hence it happens that individuals,
subject to almost the same influences, still vary greatly in their
resolutions. What the one praises is an abhorrence to the other;
what repels the one attracts the other; what is recommended by the
one is denounced by the other.

Although there may be many who profess to believe in


predestination or fate, as a matter of fact all nations, ancient and
modern, have based their constitutions on the belief in man’s
responsibility for his actions. Every State has its laws, its system of
reward and punishment. A principle so general and so essential for
the safety and welfare of society, as well as of each individual,
cannot be a mere illusion; its good effect has been tested and is
generally recognised.

In case of criminals and sinners, we make allowance for the possible


outward influences under which the offender may have fallen; we
assume the broad principle, [148]‫‏אין אדם חוטא אלא אם כן נכנס בו רוח‬
‫שטות‬‎“No one sinneth unless the spirit of folly has entered into him”
(Babyl. Talm. Sotah, 3a); but no one would go so far as to acquit the
sinner altogether from blame. We pity him and try to teach him how
to return to the right path, and how to overcome outward evil
influences. When David had become aware of the greatness of his
sin and sincerely repented, he prayed, “Create in me a clean heart,
O God; and renew a right spirit within me. Cast me not away from
thy presence; and take not thy holy spirit from me. Restore unto me
the joy of thy salvation; and uphold me with a willing spirit. Then will I
teach transgressors thy ways; and sinners shall return unto thee”
(Ps. li. 10–13). Both elements are here harmoniously united. God’s
interference is asked for; He helps man to carry out his good
resolution; but man has free-will, and the author of the psalm, in
seeking the assistance of God, feels nevertheless the weight of his
own responsibility.

Tenth Principle.—“I firmly believe that the Creator, blessed be His


name, knoweth all the actions of men and all their thoughts, as it is
said, ‘He that fashioneth the hearts of them all, He that considereth
all their works’ (Ps. xxxiii. 15).”

In the rhymed form of the Creed (‫‏יגדל‬‎) this article is expressed thus:
“He watcheth and knoweth our secret thoughts; He beholdeth the
end of a thing in its beginning.” Here the author proclaims not only
the Omniscience of God, but also His foresight; His knowledge is not
limited, like the knowledge of mortal beings, by space and time. The
entire past and future lies unrolled before His eyes, and nothing is
hidden from [149]Him. Although we may form a faint idea of the
knowledge of God by considering that faculty of man that enables
him, within a limited space of time, to look backward and forward,
and to unroll before him the past and the future, as if the events that
have happened and those that will come to pass were going on in
the present moment, yet the true nature of God’s knowledge no man
can conceive. “God considereth all the deeds of man,” without
depriving him of his free-will; he may in this respect be compared to
a person who observes and notices the actions and the conduct of
his fellow-men, without interfering with them. It is the Will of God that
man should have free-will and should be responsible for his actions;
and His foresight does not necessarily include predetermination. In
some cases the fate of nations or of individual men is predetermined;
we may even say that the ultimate fate or development of mankind is
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like