[Ebooks PDF] download Mastering Machine Learning with scikit learn 2nd edition Gavin Hackeling full chapters
[Ebooks PDF] download Mastering Machine Learning with scikit learn 2nd edition Gavin Hackeling full chapters
https://ebookultra.com
https://ebookultra.com/download/mastering-machine-
learning-with-scikit-learn-2nd-edition-gavin-
hackeling/
https://ebookultra.com/download/machine-learning-with-r-cookbook-2nd-
edition-bhatia/
ebookultra.com
https://ebookultra.com/download/machine-learning-for-time-series-
forecasting-with-python-1st-edition-francesca-lazzeri/
ebookultra.com
https://ebookultra.com/download/learning-styles-and-inclusion-1st-
edition-gavin-reid-2/
ebookultra.com
Learning Styles and Inclusion 1st Edition Gavin Reid
https://ebookultra.com/download/learning-styles-and-inclusion-1st-
edition-gavin-reid/
ebookultra.com
https://ebookultra.com/download/python-machine-learning-by-example-
the-easiest-way-to-get-into-machine-learning-1st-edition-yuxi-hayden-
liu/
ebookultra.com
https://ebookultra.com/download/bayesian-reasoning-and-machine-
learning-barber-d/
ebookultra.com
https://ebookultra.com/download/data-mining-practical-machine-
learning-tools-and-techniques-2nd-edition-ian-h-witten/
ebookultra.com
Mastering Machine Learning with scikit learn 2nd edition
Gavin Hackeling Digital Instant Download
Author(s): Gavin Hackeling
ISBN(s): 9781788299879, 1788299876
File Details: PDF, 6.30 MB
Language: english
Mastering Machine Learning
with scikit-learn
Second Edition
-FBSOUPJNQMFNFOUBOEFWBMVBUFNBDIJOFMFBSOJOHTPMVUJPOT
XJUITDJLJUMFBSO
Gavin Hackeling
BIRMINGHAM - MUMBAI
Mastering Machine Learning with scikit-learn
Second Edition
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the
publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the author, nor Packt Publishing, and its
dealers and distributors will be held liable for any damages caused or alleged to be caused
directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
1VCMJTIFECZ1BDLU1VCMJTIJOH-UE
-JWFSZ1MBDF
-JWFSZ4USFFU
#JSNJOHIBN
#1#6,
ISBN 978-1-78829-987-9
XXXQBDLUQVCDPN
Credits
He is interested in all aspects of distributed machine learning and the Internet of Things.
Oleg currently lives and works in Hamburg, Germany.
I would like to express my deepest gratitude to my parents for everything that they have
done for me.
www.PacktPub.com
For support files and downloads related to your book, please visitXXX1BDLU1VCDPN.
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at XXX1BDLU1VCDPNand as a
print book customer, you are entitled to a discount on the eBook copy. Get in touch with us
at TFSWJDF!QBDLUQVCDPN for more details.
At XXX1BDLU1VCDPN, you can also read a collection of free technical articles, sign up for a
range of free newsletters and receive exclusive discounts and offers on Packt books and
eBooks.
IUUQTXXXQBDLUQVCDPNNBQU
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt
books and video courses, as well as industry-leading tools to help you plan your personal
development and advance your career.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial
process. To help us improve, please leave us an honest review on this book's Amazon page
at IUUQTXXXBNB[PODPNEQ.
If you'd like to join our team of regular reviewers, you can e-mail us at
DVTUPNFSSFWJFXT!QBDLUQVCDPN. We award our regular reviewers with free eBooks and
videos in exchange for their valuable feedback. Help us be relentless in improving our
products!
Table of Contents
Preface 1
Chapter 1: The Fundamentals of Machine Learning 6
Defining machine learning 6
Learning from experience 8
Machine learning tasks 9
Training data, testing data, and validation data 10
Bias and variance 13
An introduction to scikit-learn 15
Installing scikit-learn 16
Installing using pip 17
Installing on Windows 17
Installing on Ubuntu 16.04 17
Installing on Mac OS 17
Installing Anaconda 18
Verifying the installation 18
Installing pandas, Pillow, NLTK, and matplotlib 18
Summary 19
Chapter 2: Simple Linear Regression 20
Simple linear regression 20
Evaluating the fitness of the model with a cost function 25
Solving OLS for simple linear regression 27
Evaluating the model 29
Summary 31
Chapter 3: Classification and Regression with k-Nearest Neighbors 32
K-Nearest Neighbors 32
Lazy learning and non-parametric models 33
Classification with KNN 34
Regression with KNN 42
Scaling features 44
Summary 47
Chapter 4: Feature Extraction 48
Extracting features from categorical variables 48
Standardizing features 49
Extracting features from text 50
The bag-of-words model 50
Stop word filtering 53
Stemming and lemmatization 54
Extending bag-of-words with tf-idf weights 57
Space-efficient feature vectorizing with the hashing trick 59
Word embeddings 61
Extracting features from images 64
Extracting features from pixel intensities 65
Using convolutional neural network activations as features 66
Summary 68
Chapter 5: From Simple Linear Regression to Multiple Linear
Regression 70
Multiple linear regression 70
Polynomial regression 74
Regularization 79
Applying linear regression 80
Exploring the data 81
Fitting and evaluating the model 84
Gradient descent 86
Summary 90
Chapter 6: From Linear Regression to Logistic Regression 91
Binary classification with logistic regression 92
Spam filtering 94
Binary classification performance metrics 95
Accuracy 97
Precision and recall 98
Calculating the F1 measure 99
ROC AUC 100
Tuning models with grid search 102
Multi-class classification 104
Multi-class classification performance metrics 107
Multi-label classification and problem transformation 108
Multi-label classification performance metrics 113
Summary 114
Chapter 7: Naive Bayes 115
Bayes' theorem 115
Generative and discriminative models 117
[ ii ]
Naive Bayes 118
Assumptions of Naive Bayes 119
Naive Bayes with scikit-learn 120
Summary 124
Chapter 8: Nonlinear Classification and Regression with Decision
Trees 125
Decision trees 125
Training decision trees 127
Selecting the questions 128
Information gain 131
Gini impurity 136
Decision trees with scikit-learn 137
Advantages and disadvantages of decision trees 139
Summary 140
Chapter 9: From Decision Trees to Random Forests and Other
Ensemble Methods 141
Bagging 141
Boosting 144
Stacking 146
Summary 148
Chapter 10: The Perceptron 149
The perceptron 149
Activation functions 150
The perceptron learning algorithm 152
Binary classification with the perceptron 153
Document classification with the perceptron 161
Limitations of the perceptron 162
Summary 163
Chapter 11: From the Perceptron to Support Vector Machines 164
Kernels and the kernel trick 165
Maximum margin classification and support vectors 169
Classifying characters in scikit-learn 172
Classifying handwritten digits 172
Classifying characters in natural images 175
Summary 177
Chapter 12: From the Perceptron to Artificial Neural Networks 178
Nonlinear decision boundaries 179
[ iii ]
Feed-forward and feedback ANNs 180
Multi-layer perceptrons 181
Training multi-layer perceptrons 183
Backpropagation 184
Training a multi-layer perceptron to approximate XOR 189
Training a multi-layer perceptron to classify handwritten digits 192
Summary 193
Chapter 13: K-means 194
Clustering 194
K-means 197
Local optima 203
Selecting K with the elbow method 204
Evaluating clusters 207
Image quantization 209
Clustering to learn features 211
Summary 214
Chapter 14: Dimensionality Reduction with Principal Component
Analysis 215
Principal component analysis 215
Variance, covariance, and covariance matrices 220
Eigenvectors and eigenvalues 222
Performing PCA 224
Visualizing high-dimensional data with PCA 227
Face recognition with PCA 228
Summary 231
Index 233
[ iv ]
Preface
In recent years, popular imagination has become fascinated by machine learning. The
discipline has found a variety of applications. Some of these applications, such as spam
filtering, are ubiquitous and have been rendered mundane by their successes. Many other
applications have only recently been conceived, and hint at machine learning's potential.
In this book, we will examine several machine learning models and learning algorithms. We
will discuss tasks that machine learning is commonly applied to, and we will learn to
measure the performance of machine learning systems. We will work with a popular library
for the Python programming language called scikit-learn, which has assembled state-of-the-
art implementations of many machine learning algorithms under an intuitive and versatile
API.
$IBQUFS, Simple Linear Regression, discusses a model that relates a single feature to a
continuous response variable. We will learn about cost functions and use the normal
equation to optimize the model.
$IBQUFS, Feature Extraction, describes methods for representing text, images, and
categorical variables as features that can be used in machine learning models.
$IBQUFS, From Linear Regression to Logistic Regression, further generalizes multiple linear
regression and introduces a model for binary classification tasks.
Preface
$IBQUFS, Naive Bayes, discusses Bayes’ theorem and the Naive Bayes family of classifiers,
and compares generative and discriminative models.
$IBQUFS, Nonlinear Classification and Regression with Decision Trees, introduces the decision
tree, a simple, nonlinear model for classification and regression tasks.
$IBQUFS, From Decision Trees to Random Forests and other Ensemble Methods, discusses three
methods for combining models called bagging, boosting, and stacking.
$IBQUFS, The Perceptron, introduces a simple online model for binary classification.
$IBQUFS, From the Perceptron to Artificial Neural Networks, introduces powerful nonlinear
models for classification and regression built from graphs of artificial neurons.
[2]
Preface
Conventions
In this book, you will find a number of text styles that distinguish between different kinds
of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The
package is named TLMFBSO because scikit-learn is not a valid Python package name."
*O<>
JNQPSUTLMFBSO
TLMFBSO@@WFSTJPO@@
0VU<>
Reader feedback
Feedback from our readers is always welcome. Let us know what you thought about this
book-what you liked or disliked. Reader feedback is important for us as it helps us to
develop titles that you will really get the most out of. To send us general feedback, simply
email GFFECBDL!QBDLUQVCDPN, and mention the book'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 XXXQBDLUQVCDPNBVUIPST.
[3]
Preface
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you
to get the most from your purchase.
BDLUQVCDPN. If you purchased this book elsewhere, you can visit IUUQXXXQBDLUQVCD
PNTVQQPSUand register to have the files e-mailed directly to you. You can download the
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 book in the Search box.
5. Select the book for which you're looking to download the code files.
6. Choose from the drop-down menu where you purchased this book from.
7. Click on Code Download.
Once the file is downloaded, please make sure that you unzip or extract the folder using the
latest version of:
The code bundle for the book is also hosted on GitHub at IUUQTHJUIVCDPN1BDLU1VCM
JTIJOH.BTUFSJOH.BDIJOF-FBSOJOHXJUITDJLJUMFBSO4FDPOE&EJUJPO. We also
have other code bundles from our rich catalog of books and videos available at IUUQTHJ
[4]
Preface
Errata
Although we have taken care to ensure the accuracy of our content, mistakes do happen. If
you find a mistake in one of our books-maybe a mistake in the text or the code-we would be
grateful if you could report this to us. By doing so, you can save other readers from
frustration and help us to improve subsequent versions of this book. If you find any errata,
please report them by visiting IUUQXXXQBDLUQVCDPNTVCNJUFSSBUB, selecting your
book, clicking on the Errata Submission Form link, and entering the details of your errata.
Once your errata are verified, your submission will be accepted and the errata will be
uploaded to our website or added to any list of existing errata under the Errata section of
that title. To view the previously submitted errata, go to IUUQTXXXQBDLUQVCDPNCPPL
TDPOUFOUTVQQPSUand enter the name of the book in the search field. The required
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. Please contact us at
DPQZSJHIU!QBDLUQVCDPN 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 aspects of this book, you can contact us at
RVFTUJPOT!QBDLUQVCDPN, and we will do our best to address it.
[5]
The Fundamentals of Machine
1
Learning
In this chapter, we will review fundamental concepts in machine learning. We will compare
supervised and unsupervised learning; discuss the uses of training, testing, and validation
data; and describe applications of machine learning. Finally, we will introduce scikit-learn,
and install the tools required in subsequent chapters.
Machine learning is the design and study of software artifacts that use past experience to
inform future decisions; machine learning is the study of programs that learn from data.
The fundamental goal of machine learning is to generalize, or to induce an unknown rule
from examples of the rule's application. The canonical example of machine learning is spam
filtering. By observing thousands of emails that have been previously labeled as either spam
or ham, spam filters learn to classify new messages. Arthur Samuel, a computer scientist
who pioneered the study of artificial intelligence, said that machine learning is the "study
that gives computers the ability to learn without being explicitly programmed". Throughout
the 1950s and 1960s, Samuel developed programs that played checkers. While the rules of
checkers are simple, complex strategies are required to defeat skilled opponents. Samuel
never explicitly programmed these strategies, but through the experience of playing
thousands of games, the program learned complex behaviors that allowed it to beat many
human opponents.
A popular quote from computer scientist Tom Mitchell defines machine learning more
formally: "A program can be said to learn from experience 'E' with respect to some class of
tasks 'T' and performance measure 'P', if its performance at tasks in 'T', as measured by 'P',
improves with experience 'E'." For example, assume that you have a collection of pictures.
Each picture depicts either a dog or a cat. A task could be sorting the pictures into separate
collections of dog and cat photos. A program could learn to perform this task by observing
pictures that have already been sorted, and it could evaluate its performance by calculating
the percentage of correctly classified pictures.
We will use Mitchell's definition of machine learning to organize this chapter. First, we will
discuss types of experience, including supervised learning and unsupervised learning.
Next, we will discuss common tasks that can be performed by machine learning systems.
Finally, we will discuss performance measures that can be used to assess machine learning
systems.
[7]
The Fundamentals of Machine Learning
A supervised learning program learns from labeled examples of the outputs that should be
produced for an input. There are many names for the output of a machine learning
program. Several disciplines converge in machine learning, and many of those disciplines
use their own terminology. In this book, we will refer to the output as the response
variable. Other names for response variables include "dependent variables", "regressands",
"criterion variables", "measured variables", "responding variables", "explained variables",
"outcome variables", "experimental variables", "labels", and "output variables". Similarly, the
input variables have several names. In this book, we will refer to inputs as features, and the
phenomena they represent as explanatory variables. Other names for explanatory variables
include "predictors", "regressors", "controlled variables", and "exposure variables". Response
variables and explanatory variables may take real or discrete values.
[8]
The Fundamentals of Machine Learning
The collection of examples that comprise supervised experience is called a training set. A
collection of examples that is used to assess the performance of a program is called a test
set. The response variable can be thought of as the answer to the question posed by the
explanatory variables; supervised learning problems learn from a collection of answers to
different questions. That is, supervised learning programs are provided with the correct
answers and must learn to respond correctly to unseen, but similar, questions.
[9]
The Fundamentals of Machine Learning
[ 10 ]
The Fundamentals of Machine Learning
In addition to the training and test data, a third set of observations, called a validation or
hold-out set, is sometimes required. The validation set is used to tune variables called
hyperparameters that control how the algorithm learns from the training data. The
program is still evaluated on the test set to provide an estimate of its performance in the real
world. The validation set should not be used to estimate real-world performance because
the program has been tuned to learn from the training data in a way that optimizes its score
on the validation data; the program will not have this advantage in the real world.
Some training sets may contain only a few hundred observations; others may include
millions. Inexpensive storage, increased network connectivity, and the ubiquity of sensor-
packed smartphones have contributed to the contemporary state of big data, or training sets
with millions or billions of examples. While this book will not work with datasets that
require parallel processing on tens or hundreds of computers, the predictive power of many
machine learning algorithms improves as the amount of training data increases. However,
machine learning algorithms also follow the maxim "garbage in, garbage out". A student
who studies for a test by reading a large, confusing textbook that contains many errors
likely will not score better than a student who reads a short but well-written textbook.
Similarly, an algorithm trained on a large collection of noisy, irrelevant, or incorrectly-
labeled data will not perform better than an algorithm trained on a smaller set of data that is
more representative of the problem in the real-world.
[ 11 ]
The Fundamentals of Machine Learning
The original dataset is partitioned into five subsets of equal size labeled A through E.
Initially the model is trained on partitions B through E, and tested on partition A. In the
next iteration, the model is trained on partitions A, C, D, and E, and tested on partition B.
The partitions are rotated until models have been trained and tested on all of the partitions.
Cross-validation provides a more accurate estimate of the model's performance than testing
a single partition of the data.
[ 12 ]
The Fundamentals of Machine Learning
[ 13 ]
The Fundamentals of Machine Learning
Ideally, a model will have both low bias and variance, but efforts to decrease one will
frequently increase the other. This is known as the bias-variance trade-off. We will discuss
the biases and variances of many of the models introduced in this book.
Most performance measures can only be calculated for a specific type of task, like
classification or regression. Machine learning systems should be evaluated using
performance measures that represent the costs associated with making errors in the real
world. While this may seem obvious, the following example describes this using a
performance measure that is appropriate for the task in general but not for its specific
application.
Consider a classification task in which a machine learning system observes tumors and
must predict whether they are malignant or benign. Accuracy, or the fraction of instances
that were classified correctly, is an intuitive measure of the program's performance. While
accuracy does measure the program's performance, it does not differentiate between
malignant tumors that were classified as being benign, and benign tumors that were
classified as being malignant. In some applications, the costs associated with all types of
errors may be the same. In this problem, however, failing to identify malignant tumors is
likely a more severe error than mistakenly classifying benign tumors as being malignant.
We can measure each of the possible prediction outcomes to create different views of the
classifier's performance. When the system correctly classifies a tumor as being malignant,
the prediction is called a true positive. When the system incorrectly classifies a benign
tumor as being malignant, the prediction is a false positive. Similarly, a false negative is an
incorrect prediction that the tumor is benign, and a true negative is a correct prediction that
a tumor is benign. Note that positive and negative are used only as binary labels, and are
not meant to judge the phenomena they signify. In this example, it does not matter whether
malignant tumors are coded as positive or negative, so long as they are coded consistently.
True and false positives and negatives can be used to calculate several common measures of
classification performance, including accuracy, precision and recall.
Accuracy is calculated with the following formula, where TP is the number of true
positives, TN is the number of true negatives, FP is the number of false positives, and FN is
the number of false negatives:
[ 14 ]
The Fundamentals of Machine Learning
Precision is the fraction of the tumors that were predicted to be malignant that are actually
malignant. Precision is calculated with the following formula:
Recall is the fraction of malignant tumors that the system identified. Recall is calculated
with the following formula:
In this example, precision measures the fraction of tumors that were predicted to be
malignant that are actually malignant. Recall measures the fraction of truly malignant
tumors that were detected.
The precision and recall measures could reveal that a classifier with impressive accuracy
actually fails to detect most of the malignant tumors. If most tumors in the testing set are
benign, even a classifier that never predicts malignancy could have high accuracy. A
different classifier with lower accuracy and higher recall might be better suited to the task,
since it will detect more of the malignant tumors.
Many other performance measures for classification can be used. We will discuss more
metrics, including metrics for multi-label classification problems, in later chapters. In the
next chapter we will discuss some common performance measures for regression tasks.
Performance on unsupervised tasks can also be assessed; we will discuss some performance
measures for cluster analysis later in the book.
An introduction to scikit-learn
Since its release in 2007, scikit-learn has become one of the most popular machine learning
libraries. scikit-learn provides algorithms for machine learning tasks including
classification, regression, dimensionality reduction, and clustering. It also provides modules
for pre-processing data, extracting features, optimizing hyperparameters, and evaluating
models.
scikit-learn is built on the popular Python libraries NumPy and SciPy. NumPy extends
Python to support efficient operations on large arrays and multi-dimensional matrices.
SciPy provides modules for scientific computing. The visualization library matplotlib is
often used in conjunction with scikit-learn.
[ 15 ]
The Fundamentals of Machine Learning
scikit-learn is popular for academic research because its API is well-documented, easy-to-
use, and versatile. Developers can use scikit-learn to experiment with different algorithms
by changing only a few lines of code. scikit-learn wraps some popular implementations of
machine learning algorithms, such as LIBSVM and LIBLINEAR. Other Python libraries,
including NLTK, include wrappers for scikit-learn. scikit-learn also includes a variety of
datasets, allowing developers to focus on algorithms rather than obtaining and cleaning
data.
Licensed under the permissive BSD license, scikit-learn can be used in commercial
applications without restrictions. Many of scikit-learn's algorithms are fast and scalable to
all but massive datasets. Finally, scikit-learn is noted for its reliability; much of the library is
covered by automated tests.
Installing scikit-learn
This book was written for version 0.18.1 of scikit-learn; use this version to ensure that the
examples run correctly. If you have previously installed scikit-learn, you can retrieve the
version number by executing the following in a notebook or Python interpreter:
*O<>
JNQPSUTLMFBSO
TLMFBSO@@WFSTJPO@@
0VU<>
If you have not previously installed scikit-learn, you may install it from a package manager
or build it from source. We will review the installation processes for Ubuntu 16.04, Max OS,
and Windows 10 in the following sections, but refer to IUUQTDJLJUMFBSOPSHTUBCMF
JOTUBMMIUNMfor the latest instructions. The following instructions assume only that you
have installed Python >= 2.6 or Python >= 3.3. See IUUQXXXQZUIPOPSHEPXOMPBE for
[ 16 ]
The Fundamentals of Machine Learning
If pip is not available on your system, consult the following sections for installation
instructions for various platforms.
Installing on Windows
scikit-learn requires setuptools, a third-party package that supports packaging and
installing software for Python. Setuptools can be installed on Windows by running the
bootstrap script at IUUQTCJUCVDLFUPSHQZQBTFUVQUPPMTSBXCPPUTUSBQF[@TFUVQ
QZ.
Windows binaries for the 32-bit and 64-bit versions of scikit-learn are also available. If you
cannot determine which version you need, install the 32-bit version. Both versions depend
on NumPy 1.3 or newer. The 32-bit version of NumPy can be downloaded from IUUQTPV
from IUUQXXXMGEVDJFEV_HPIMLFQZUIPOMJCTTDJLJUMFBSO.
A Windows installer for the 32-bit version of scikit-learn can be downloaded from IUUQT
JLJUMFBSO.
Installing on Mac OS
scikit-learn can be installed on OS X using Macports.
$ sudo port install py27-sklearn
[ 17 ]
The Fundamentals of Machine Learning
Installing Anaconda
Anaconda is a free collection of more than 720 open source data science packages for
Python including scikit-learn, NumPy, SciPy, pandas, and matplotlib. Anaconda is
platform-agnostic and simple to install. See IUUQTEPDTDPOUJOVVNJPBOBDPOEBJOTUB
0VU<>
To run scikit-learn's unit tests, first install the nose Python library. Then execute the
following in a terminal emulator:
$ nosetest sklearn -exe
[ 18 ]
The Fundamentals of Machine Learning
Matplotlib is a library for easily creating plots, histograms, and other charts with Python.
We will use it to visualize training data and models. Matplotlib has several dependencies.
Like pandas, matplotlib depends on NumPy, which should already be installed. On Ubuntu
16.04, matplotlib and its dependencies can be installed with:
$ sudo apt install python-matplotlib
PXOMPBETIUNM.
Summary
In this chapter, we defined machine learning as the design of programs that can improve
their performance at a task by learning from experience. We discussed the spectrum of
supervision in experience. At one end is supervised learning, in which a program learns
from inputs that are labeled with their corresponding outputs. Unsupervised learning, in
which the program must discover structure in only unlabeled inputs, is at the opposite end
of the spectrum. Semi-supervised approaches make use of both labeled and unlabeled
training data.
Next we discussed common types of machine learning tasks and reviewed examples of
each. In classification tasks the program predict the value of a discrete response variable
from the observed explanatory variables. In regression tasks the program must predict the
value of a continuous response variable from the explanatory variables. Unsupervised
learning tasks include clustering, in which observations are organized into groups
according to some similarity measure, and dimensionality reduction, which reduces a set of
explanatory variables to a smaller set of synthetic features that retain as much information
as possible. We also reviewed the bias-variance trade-off and discussed common
performance measures for different machine learning tasks.
In this chapter we discussed the history, goals, and advantages of scikit-learn. Finally, we
prepared our development environment by installing scikit-learn and other libraries that
are commonly used in conjunction with it. In the next chapter we will discuss a simple
model for regression tasks, and build our first machine learning model with scikit-learn.
[ 19 ]
Simple Linear Regression
2
In this chapter, we will introduce our first model, simple linear regression. Simple linear
regression models the relationship between one response variable and one feature of an
explanatory variable. We will discuss how to fit our model, and we will work through a toy
problem. While simple linear regression is rarely applicable to real-world problems,
understanding it is essential to understanding many other models. In subsequent chapters,
we will learn about generalizations of simple linear regression and apply them to real-
world datasets.
Suppose you wish to know the price of a pizza. You might simply look at a menu. This,
however, is a machine learning book, so instead we will use simple linear regression to
predict the price of a pizza based on an attribute of the pizza that we can observe, or an
explanatory variable. Let's model the relationship between the size of a pizza and its price.
First, we will write a program with scikit-learn that can predict the price of a pizza given its
size. Then we will discuss how simple linear regression works and how it can be
generalized to work with other types of problems.
Simple Linear Regression
Let's assume that you have recorded the diameters and prices of pizzas that you have
previously eaten in your pizza journal. These observations comprise our training data:
9SFQSFTFOUTUIFGFBUVSFTPGPVSUSBJOJOHEBUBUIFEJBNFUFSTPGUIF
QJ[[BT
"TDJLJUMFBSODPOWFOUJPOJTUPOBNFUIFNBUSJYPGGFBUVSFWFDUPST9
6QQFSDBTFMFUUFSTJOEJDBUFNBUSJDFTBOEMPXFSDBTFMFUUFSTJOEJDBUF
WFDUPST
9OQBSSBZ <<><><><><>> SFTIBQF
Z<>ZJTBWFDUPSSFQSFTFOUJOHUIFQSJDFTPG
UIFQJ[[BT
QMUGJHVSF
QMUUJUMF 1J[[BQSJDFQMPUUFEBHBJOTUEJBNFUFS
QMUYMBCFM %JBNFUFSJOJODIFT
QMUZMBCFM 1SJDFJOEPMMBST
QMUQMPU 9Z L
QMUBYJT <>
QMUHSJE 5SVF
QMUTIPX
[ 21 ]
Simple Linear Regression
The comments in the script state that 9 represents a matrix of pizza diameters, and Z
represents a vector of pizza prices. The reasons for this decision will become clear in the
next chapter. This script produces the following plot. The diameters of the pizzas are
plotted on the x axis, and the prices are plotted on the y axis:
We can see from the plot of the training data that there is a positive relationship between
the diameter of a pizza and its price, which should be corroborated by our own pizza-eating
experience. As the diameter of a pizza increases, its price generally increases. The following
pizza price predictor program models this relationship using simple linear regression. Let's
review the program and discuss how simple linear regression works:
*O<>
GSPNTLMFBSOMJOFBS@NPEFMJNQPSU-JOFBS3FHSFTTJPO
NPEFM-JOFBS3FHSFTTJPO $SFBUFBOJOTUBODFPGUIFFTUJNBUPS
NPEFMGJU 9Z 'JUUIFNPEFMPOUIFUSBJOJOHEBUB
1SFEJDUUIFQSJDFPGBQJ[[BXJUIBEJBNFUFSUIBUIBTOFWFSCFFOTFFO
CFGPSF
UFTU@QJ[[BOQBSSBZ <<>>
QSFEJDUFE@QSJDFNPEFMQSFEJDU UFTU@QJ[[B <>
QSJOU "QJ[[BTIPVMEDPTUG QSFEJDUFE@QSJDF
[ 22 ]
Simple Linear Regression
0VU<>
"QJ[[BTIPVMEDPTU
Simple linear regression assumes that a linear relationship exists between the response
variable and the explanatory variable; it models this relationship with a linear surface called
a hyperplane. A hyperplane is a subspace that has one dimension less than the ambient
space that contains it. In simple linear regression, there is one dimension for the response
variable and another dimension for the explanatory variable, for a total of two dimensions.
The regression hyperplane thus has one dimension; a hyperplane with one dimension is a
line.
In the preceding formula, y is the predicted value of the response variable; in this example,
it is the predicted price of the pizza. x is the explanatory variable. The intercept term α and
the coefficient β are parameters of the model that are learned by the learning algorithm. The
hyperplane plotted in the following figure models the relationship between the size of a
pizza and its price. Using this model, we would expect the price of an 8" pizza to be about
$7.33 and the price of a 20" pizza to be $18.75.
[ 23 ]
Simple Linear Regression
Using training data to learn the values of the parameters for simple linear regression that
produce the best fitting model is called ordinary least squares (OLS) or linear least
squares. In this chapter, we will discuss a method for analytically solving the values of the
model's parameters. In subsequent chapters, we will learn approaches for approximating
the values of parameters that are suitable for larger datasets. First, however, we must define
what it means for a model to fit the training data.
[ 24 ]
Simple Linear Regression
[ 25 ]
Simple Linear Regression
A cost function, also called a loss function, is used to define and measure the error of a
model. The differences between the prices predicted by the model and the observed prices
of the pizzas in the training set are called residuals, or training errors. Later, we will
evaluate the model on a separate set of test data. The differences between the predicted and
observed values in the test data are called prediction errors, or test errors. The residuals for
our model are indicated by vertical lines between the points for the training instances and
the regression hyperplane in the following plot:
We can produce the best pizza-price predictor by minimizing the sum of the residuals. That
is, our model fits if the values it predicts for the response variable are close to the observed
values for all of the training examples. This measure of the model's fitness is called the
residual sum of squares (RSS) cost function. Formally, this function assesses the fitness of a
model by summing the squared residuals for all of our training examples. The RSS is
calculated with the formula in the following equation, where yi is the observed value and
f(xi) is the predicted value:
[ 26 ]
Simple Linear Regression
Let's compute the RSS for our model by adding the following two lines to the previous
script:
QSJOU 3FTJEVBMTVNPGTRVBSFTG OQNFBO NPEFMQSFEJDU 9
Z
3FTJEVBMTVNPGTRVBSFT
Now that we have a cost function, we can find the values of the model's parameters that
minimize it.
is the mean of x, xi is the value of x for the ith training instance, and n is the number of
training instances. Let's calculate WBSJBODF of the pizza diameters in our training set:
*O<>
JNQPSUOVNQZBTOQ
/PUFUIBUXFTVCUSBDUPOFGSPNUIFOVNCFSPGUSBJOJOHJOTUBODFTXIFO
DBMDVMBUJOHUIFTBNQMFWBSJBODF
5IJTUFDIOJRVFJTDBMMFE#FTTFM TDPSSFDUJPO*UDPSSFDUTUIFCJBTJOUIF
FTUJNBUJPOPGUIFQPQVMBUJPOWBSJBODF
GSPNBTBNQMF
WBSJBODF 9Y@CBS TVN 9TIBQF<>
QSJOU WBSJBODF
0VU<>
[ 27 ]
Simple Linear Regression
NumPy also provides the method WBS for calculating variance. The keyword parameter
EEPG can be used to set Bessel's correction to calculate the sample variance:
*O<>
QSJOU OQWBS 9EEPG
0VU<>
Covariance is a measure of how much two variables change together. If the variables
increase together, their covariance is positive. If one variable tends to increase while the
other decreases, their covariance is negative. If there is no linear relationship between the
two variables, their covariance will be equal to zero; they are linearly uncorrelated but not
necessarily independent. Covariance can be calculated using the following formula:
th
As with variance, xi is the diameter of the i training instance, is the mean of the
diameters, is the mean of the prices, yi is the price of the ith training instance, and n is the
number of training instances. Let's calculate DPWBSJBODF of the diameters and prices of the
pizzas in the training set:
*O<>
8FQSFWJPVTMZVTFEB-JTUUPSFQSFTFOUZ
)FSFXFTXJUDIUPB/VN1ZOEBSSBZXIJDIQSPWJEFTBNFUIPEUPDBMVMDBUF
UIFTBNQMFNFBO
ZOQBSSBZ <>
Z@CBSZNFBO
8FUSBOTQPTF9CFDBVTFCPUIPQFSBOETNVTUCFSPXWFDUPST
DPWBSJBODFOQNVMUJQMZ 9Y@CBS USBOTQPTF ZZ@CBS TVN
9TIBQF<>
QSJOU DPWBSJBODF
QSJOU OQDPW 9USBOTQPTF Z <><>
0VU<>
[ 28 ]
Simple Linear Regression
Now that we have calculated the variance of our explanatory variable and the covariance of
the response and explanatory variables, we can solve for β using the following:
Here, is the mean of y and is the mean of are the coordinates of the centroid, a
point that the model must pass through.
Now that we have solved for the values of the model's parameters that minimize the cost
function, we can plug in the diameters of the pizzas and predict their prices. For instance,
an 11" pizza should be expected to cost about $12.70, and an 18" pizza should be expected
to cost $19.54. Congratulations! You used simple linear regression to predict the price of a
pizza.
Test instance Diameter in inches Observed price in dollars Predicted price in dollars
[ 29 ]
Simple Linear Regression
Several measures can be used to assess our model's predictive capability. We will evaluate
our pizza price predictor using a measure called R-squared. Also known as the coefficient
of determination, R-squared measures how close the data are to a regression line. There are
several methods for calculating R-squared. In the case of simple linear regression, R-
squared is equal to the square of the Pearson product-moment correlation coefficient
(PPMCC), or Pearson's r. Using this method, R-squared must be a positive number between
zero and one. This method is intuitive; if R-squared describes the proportion of variance in
the response variable that is explained by the model, it cannot be greater than one or less
than zero. Other methods, including the method used by scikit-learn, do not calculate R-
squared as the square of Pearson's r. Using these methods, R-squared can be negative if the
model performs extremely poorly. It is important to note the limitations of performance
metrics. R-squared in particular is sensitive to outliers, and can spuriously increase when
features are added to the model.
We will follow the method used by scikit-learn to calculate R-squared for our pizza price
predictor. First we must measure the total sum of squares. yi is the observed value of the
th
response variable for the i test instance, and is the mean of the observed values of the
response variable.
Next we must find the RSS. Recall that this is also our cost function.
[ 30 ]
Simple Linear Regression
The R-squared score of 0.662 indicates that a large proportion of the variance in the test
instances' prices is explained by the model. Now let's confirm our calculation using scikit-
learn. The TDPSF method of -JOFBS3FHSFTTJPO returns the model's R-squared value, as
seen in the following example:
*O<>
JNQPSUOVNQZBTOQ
GSPNTLMFBSOMJOFBS@NPEFMJNQPSU-JOFBS3FHSFTTJPO
NPEFM-JOFBS3FHSFTTJPO
NPEFMGJU 9@USBJOZ@USBJO
S@TRVBSFENPEFMTDPSF 9@UFTUZ@UFTU
QSJOU S@TRVBSFE
0VU<>
Summary
In this chapter, we introduced simple linear regression, which models the relationship
between a single explanatory variable and a continuous response variable. We worked
through a toy problem to predict the price of a pizza from its diameter. We used the
residual sum of squares cost function to assess the fitness of our model, and analytically
solved the values of our model's parameter that minimized the cost function. We measured
the performance of our model on a test set. Finally, we introduced scikit-learn's estimator
API. In the next chapter, we will compare and contrast simple linear regression with
another simple, ubiquitous model, k-Nearest Neighbors (KNN).
[ 31 ]
Classification and Regression
3
with k-Nearest Neighbors
In this chapter, we will introduce k-Nearest Neighbors (KNN), a simple algorithm that can
be used for classification and regression tasks. KNN's simplicity belies its power and
usefulness; it is widely used in the real world in a variety of applications, including search
and recommender systems. We will compare and contrast KNN with simple linear
regression and work through toy problems to understand the model.
K-Nearest Neighbors
KNN is a simple model for regression and classification tasks. It is so simple that its name
describes most of its learning algorithm. The titular neighbors are representations of
training instances in a metric space. A metric space is a feature space in which the distances
between all members of a set are defined. In the previous chapter's pizza problem, our
training instances were represented in a metric space because the distances between all the
pizza diameters was defined. These neighbors are used to estimate the value of the response
variable for a test instance. The hyperparameter k specifies how many neighbors can be
used in the estimation. A hyperparameter is a parameter that controls how the algorithm
learns; hyperparameters are not estimated from the training data and are sometimes set
manually. Finally, the k neighbors that are selected are those that are nearest to the test
instance, as measured by some distance function.
Classification and Regression with k-Nearest Neighbors
For classification tasks, a set of tuples of feature vectors and class labels comprise the
training set. KNN is a capable of binary, multi-class, and multi-label classification; we will
define these tasks later, and we will focus on binary classification in this chapter. The
simplest KNN classifiers use the mode of the KNN labels to classify test instances, but other
strategies can be used. The k is often set to an odd number to prevent ties. In regression
tasks, the feature vectors are each associated with a response variable that takes a real-
valued scalar instead of a label. The prediction is the mean or weighted mean of the KNN
response variables.
In contrast to most of the other models that we will discuss, KNN is a non-parametric
model. A parametric model uses a fixed number of parameters, or coefficients, to define the
model that summarizes the data. The number of parameters is independent of the number
of training instances. Non-parametric may seem to be a misnomer, as it does not mean that
the model has no parameters; rather, non-parametric means that the number of parameters
of the model is not fixed, and may grow with the number of training instances.
Non-parametric models can be useful when training data is abundant and you have little
prior knowledge about the relationship between the response and explanatory variables.
KNN makes only one assumption: instances that are near each other are likely to have
similar values of the response variable. The flexibility provided by non-parametric models
is not always desirable; a model that makes assumptions about the relationship can be
useful if training data is scarce or if you already know about the relationship.
[ 33 ]
Exploring the Variety of Random
Documents with Different Content
But apart from this, had the portrait been not anterior, like Swann's
favourite photograph, to the systematisation of Odette's features in
a fresh type, majestic and charming, but subsequent to it, Elstir's
vision would alone have sufficed to disorganise that type. Artistic
genius in its reactions is like those extremely high temperatures
which have the power to disintegrate combinations of atoms which
they proceed to combine afresh in a diametrically opposite order,
following another type. All that artificially harmonious whole into
which a woman has succeeded in bringing her limbs and features,
the persistence of which every day, before going out, she studies in
her glass, changing the angle of her hat, smoothing her hair,
exercising the sprightliness in her eyes, so as to ensure its
continuity, that harmony the keen eye of the great painter instantly
destroys, substituting for it a rearrangement of the woman's features
such as will satisfy a certain pictorial ideal of femininity which he
carries in his head. Similarly it often happens that, after a certain
age, the eye of a great seeker after truth will find everywhere the
elements necessary to establish those relations which alone are of
interest to him. Like those craftsmen, those players who, instead of
making a fuss and asking for what they cannot have, content
themselves with the instrument that comes to their hand, the artist
might say of anything, no matter what, that it would serve his
purpose. Thus a cousin of the Princesse de Luxembourg, a beauty of
the most queenly type, having succumbed to a form of art which
was new at that time, had asked the leading painter of the naturalist
school to do her portrait. At once the artist's eye had found what he
sought everywhere in life. And on his canvas there appeared, in
place of the proud lady, a street-boy, and behind him a vast, sloping,
purple background which made one think of the Place Pigalle. But
even without going so far as that, not only will the portrait of a
woman by a great artist not seek in the least to give satisfaction to
various demands on the woman's part—such as for instance, when
she begins to age, make her have herself photographed in dresses
that are almost those of a young girl, which bring out her still
youthful figure and make her appear like the sister, or even the
daughter of her own daughter, who, if need be, is tricked out for the
occasion as a "perfect fright" by her side—it will, on the contrary,
emphasise those very drawbacks which she seeks to hide, and which
(as for instance a feverish, that is to say a livid complexion) are all
the more tempting to him since they give his picture "character";
they are quite enough, however, to destroy all the illusions of the
ordinary man who, when he sees the picture, sees crumble into dust
the ideal which the woman herself has so proudly sustained for him,
which has placed her in her unique, her unalterable form so far
apart, so far above the rest of humanity. Fallen now, represented
otherwise than in her own type in which she sat unassailably
enthroned, she is become nothing more than just an ordinary
woman, in the legend of whose superiority we have lost all faith. In
this type we are so accustomed to regard as included not only the
beauty of an Odette but her personality, her identity, that standing
before the portrait which has thus transposed her from it we are
inclined to protest not simply "How plain he has made her!" but
"Why, it isn't the least bit like her!" We find it hard to believe that it
can be she. We do not recognise her. And yet there is a person there
on the canvas whom we are quite conscious of having seen before.
But that person is not Odette; the face of the person, her body, her
general appearance seem familiar. They recall to us not this
particular woman who never held herself like that, whose natural
pose had no suggestion of any such strange and teasing arabesque
in its outlines, but other women, all the women whom Elstir has ever
painted, women whom invariably, however they may differ from one
another, he has chosen to plant thus on his canvas facing you, with
an arched foot thrust out from under the skirt, a large round hat in
one hand, symmetrically corresponding at the level of the knee
which it hides to what also appears as a disc, higher up in the
picture, the face. And furthermore, not only does a portrait by the
hand of genius disintegrate and destroy a woman's type, as it has
been defined by her coquetry and her selfish conception of beauty,
but if it is also old, it is not content with ageing the original in the
same way as a photograph ages its sitter, by shewing her dressed in
the fashions of long ago. In a portrait, it is not only the manner the
woman then had of dressing that dates it, there is also the manner
the artist had of painting. And this, Elstir's earliest manner, was the
most damaging of birth certificates for Odette because it not only
established her, as did her photographs of the same period, as the
younger sister of various time-honoured courtesans, but made her
portrait contemporary with the countless portraits that Manet or
Whistler had painted of all those vanished models, models who
already belonged to oblivion or to history.
It was along this train of thought, meditated in silence by the side of
Elstir, as I accompanied him to his door, that I was being led by the
discovery that I had just made of the identity of his model, when
this original discovery caused me to make a second, more disturbing
still, involving the identity of the artist. He had painted the portrait of
Odette de Crécy. Could it possibly be that this man of genius, this
sage, this eremite, this philosopher with his marvellous flow of
conversation, who towered over everyone and everything, was the
foolish, corrupt little painter who had at one time been "taken up" by
the Verdurins? I asked him if he had known them, whether by any
chance it was he that they used to call M. Biche. He answered me in
the affirmative, with no trace of embarrassment, as if my question
referred to a period in his life that was ended and already somewhat
remote, with no suspicion of what a cherished illusion his words
were shattering in me, until looking up he read my disappointment
upon my face. His own assumed an expression of annoyance. And,
as we were now almost at the gate of his house, a man of less
outstanding eminence, in heart and brain, might simply have said
"good-bye" to me, a trifle dryly, and taken care to avoid seeing me
again. This however was not Elstir's way with me; like the master
that he was—and this was, perhaps, from the point of view of sheer
creative genius, his one fault, that he was a master in that sense of
the word, for an artist if he is to live the true life of the spirit in its
full extent, must be alone and not bestow himself with profusion,
even upon disciples—from every circumstance, whether involving
himself or other people, he sought to extract, for the better
edification of the young, the element of truth that it contained. He
chose therefore, rather than say anything that might have avenged
the injury to his pride, to say what he thought would prove
instructive to me. "There is no man," he began, "however wise, who
has not at some period of his youth said things, or lived in a way the
consciousness of which is so unpleasant to him in later life that he
would gladly, if he could, expunge it from his memory. And yet he
ought not entirely to regret it, because he cannot be certain that he
has indeed become a wise man—so far as it is possible for any of us
to be wise—unless he has passed through all the fatuous or
unwholesome incarnations by which that ultimate stage must be
preceded. I know that there are young fellows, the sons and
grandsons of famous men, whose masters have instilled into them
nobility of mind and moral refinement in their schooldays. They
have, perhaps, when they look back upon their past lives, nothing to
retract; they can, if they choose, publish a signed account of
everything they have ever said or done; but they are poor creatures,
feeble descendants of doctrinaires, and their wisdom is negative and
sterile. We are not provided with wisdom, we must discover it for
ourselves, after a journey through the wilderness which no one else
can take for us, an effort which no one can spare us, for our wisdom
is the point of view from which we come at last to regard the world.
The lives that you admire, the attitudes that seem noble to you are
not the result of training at home, by a father, or by masters at
school, they have sprung from beginnings of a very different order,
by reaction from the influence of everything evil or common-place
that prevailed round about them. They represent a struggle and a
victory. I can see that the picture of what we once were, in early
youth, may not be recognisable and cannot, certainly, be pleasing to
contemplate in later life. But we must not deny the truth of it, for it
is evidence that we have really lived, that it is in accordance with the
laws of life and of the mind that we have, from the common
elements of life, of the life of studios, of artistic groups—assuming
that one is a painter—extracted something that goes beyond them."
Meanwhile we had reached his door. I was disappointed at not
having met the girls. But after all there was now the possibility of
meeting them again later on; they had ceased to do no more than
pass beyond a horizon on which I had been ready to suppose that I
should never see them reappear. Around them no longer swirled that
sort of great eddy which had separated me from them, which had
been merely the expression of the perpetually active desire, mobile,
compelling, fed ever on fresh anxieties, which was aroused in me by
their inaccessibility, their flight from me, possibly for ever. My desire
for them, I could now set it at rest, hold it in reserve, among all
those other desires the realisation of which, as soon as I knew it to
be possible, I would cheerfully postpone. I took leave of Elstir; I was
alone once again. Then all of a sudden, despite my recent
disappointment, I saw in my mind's eye all that chain of coincidence
which I had not supposed could possibly come about, that Elstir
should be a friend of those very girls, that they who only that
morning had been to me merely figures in a picture with the sea for
background had seen me, had seen me walking in friendly intimacy
with a great painter, who was now informed of my secret longing
and would no doubt do what he could to assuage it. All this had
been a source of pleasure to me, but that pleasure had remained
hidden; it was one of those visitors who wait before letting us know
that they are in the room until all the rest have gone and we are by
ourselves. Then only do we catch sight of them, and can say to
them, "I am at your service," and listen to what they have to tell us.
Sometimes between the moment at which these pleasures have
entered our consciousness and the moment at which we are free to
entertain them, so many hours have passed, we have in the interval
seen so many people that we are afraid lest they should have grown
tired of waiting. But they are patient, they do not grow tired, and as
soon as the crowd has gone we find them there ready for us.
Sometimes it is then we who are so exhausted that it seems as
though our weary mind will not have the strength left to seize and
retain those memories, those impressions for which our frail self is
the one habitable place, the sole means of realisation. And we
should regret that failure, for existence to us is hardly interesting
save on the days on which the dust of realities is shot with magic
sand, on which some trivial incident of life becomes a spring of
romance. Then a whole promontory of the inaccessible world rises
dear in the light of our dream, and enters into our life, our life in
which, like the sleeper awakened, we actually see the people of
whom we have been so ardently dreaming that we came to believe
that we should never behold them save in our dreams.
The sense of comfort that I drew from the probability of my now
being able to meet the little band whenever I chose was all the more
precious to me because I should not have been able to keep watch
for them during the next few days, which would be taken up with
preparations for Saint-Loup's departure. My grandmother was
anxious to offer my friend some proof of her gratitude for all the
kindnesses that he had shewn to her and myself. I told her that he
was a great admirer of Proudhon, and this put it into her head to
send for a collection of autograph letters by that philosopher which
she had once bought; Saint-Loup came to her room to look at them
on the day of their arrival, which was also his last day at Balbec. He
read them eagerly, fingering each page with reverence, trying to get
the sentences by heart; and then, rising from the table, was
beginning to apologise to my grandmother for having stayed so long,
when he heard her say: "No, no; take them with you; they are for
you to keep; that was why I sent for them, to give them to you."
He was overpowered by a joy which he could no more control than
we can a physical condition that arises without the intervention of
our will. He blushed scarlet as a child who has just been whipped,
and my grandmother was a great deal more touched to see all the
efforts that he was making (without success) to control the joy that
convulsed him than she would have been to hear any words of
thanks that he could have uttered. But he, fearing that he had failed
to shew his gratitude properly, begged me to make his excuses to
her again, next day, leaning from the window of the little train of the
local railway company which was to take him back to his regiment.
The distance was, as a matter of fact, nothing. He had thought of
going, as he had frequently done that summer, when he was to
return the same evening and was not encumbered with luggage, by
road. But this time he would have had, anyhow, to put all his heavy
luggage in the train. And he found it simpler to take the train himself
also, following the advice of the manager who, on being consulted,
replied that "Carriage or train, it was more or less equivocal." He
meant us to understand that they were equivalent (in fact, very
much what Françoise would have expressed as "coming to as near
as made no difference"). "Very well," Saint-Loup had decided, "I will
take the 'little crawler'." I should have taken it too, had I not been
tired, and gone with my friend to Doncières; failing this I kept on
promising, all the time that we waited in the Balbec station—the
time, that is to say, which the driver of the little train spent in
waiting for unpunctual friends, without whom he refused to start,
and also in seeking some refreshment for himself—to go over there
and see him several times a week. As Bloch had come to the station
also—much to Saint-Loup's disgust—the latter, seeing that our
companion could hear him begging me to come to luncheon, to
dinner, to stay altogether at Doncières, finally turned to him and, in
the most forbidding tone, intended to counteract the forced civility of
the invitation and to prevent Bloch from taking it seriously: "If you
ever happen to be passing through Doncières any afternoon when I
am off duty, you might ask for me at the barracks; but I hardly ever
am off duty." Perhaps, also, Robert feared lest, if left to myself, I
might not come, and, thinking that I was more intimate with Bloch
than I made out, was providing me in this way with a travelling
companion, one who would urge me on.
I was afraid that this tone, this way of inviting a person while
warning him not to come, might have wounded Bloch, and felt that
Saint-Loup would have done better, saying nothing. But I was
mistaken, for after the train had gone, while we were walking back
together as far as the cross-roads at which we should have to part,
one road going to the hotel, the other to the Blochs' villa, he never
ceased from asking me on what day we should go to Doncières, for
after "all the civilities that Saint-Loup had shewn" him, it would be
"too unmannerly" on his part not to accept the invitation. I was glad
that he had not noticed, or was so little displeased as to wish to let it
be thought that he had not noticed on how far from pressing, how
barely polite a note the invitation had been sounded. At the same
time I should have liked Bloch, for his own sake, to refrain from
making a fool of himself by going over at once to Doncières. But I
dared not offer a piece of advice which could only have offended
him by hinting that Saint-Loup had been less pressing than himself
impressed. He was a great deal too ready to respond, and even if all
his faults of this nature were atoned for by remarkable qualities
which others, with more reserve than he, would not possess, he
carried indiscretion to a pitch that was almost maddening. The week
must not, to hear him speak, pass without our going to Doncières
(he said "our" for I think that he counted to some extent on my
presence there as an excuse for his own). All the way home,
opposite the gymnasium, in its grove of trees, opposite the lawn-
tennis courts, the mayor's office, the shell-fish stall, he stopped me,
imploring me to fix a day, and, as I did not, left me in a towering
rage, saying: "As your lordship pleases. For my part, I am obliged to
go since he has invited me."
Saint-Loup was still so much afraid of not having thanked my
grandmother properly that he charged me once again to express his
gratitude to her a day or two later in a letter I received from him
from the town in which he was quartered, a town which seemed, on
the envelope where the post-mark had stamped its name, to be
hastening to me across country, to tell me that within its walls, in
the Louis XVI cavalry barracks, he was thinking of me. The paper
was embossed with the arms of Marsantes, in which I could make
out a lion, surmounted by a coronet formed by the cap of a Peer of
France.
"After a journey which," he wrote, "passed pleasantly enough, with a
book I bought at the station, by Arvède Barine (a Russian author, I
fancy; it seemed to me remarkably well written for a foreigner, but
you shall give me your critical opinion, you are bound to know all
about it, you fount of knowledge who have read everything), here I
am again in the thick of this debased existence, where, alas, I feel a
sad exile, not having here what I had to leave at Balbec; this life in
which I cannot discover one affectionate memory, any intellectual
attraction; an environment on which you would probably look with
contempt—and yet it has a certain charm. Everything seems to have
changed since I was last here, for in the interval one of the most
important periods in my life, that from which our friendship dates,
has begun. I hope that it may never come to an end. I have spoken
of our friendship, of you, to one person only, to the friend I told you
of, who has just paid me a surprise visit here. She would like
immensely to know you, and I feel that you would get on well
together, for she too is extremely literary. I, on the other hand, to go
over in my mind all our talk, to live over again those hours which I
never shall forget, have shut myself off from my comrades, excellent
fellows, but altogether incapable of understanding that sort of thing.
This remembrance of moments spent with you I should almost have
preferred, on my first day here, to call up for my own solitary
enjoyment, without writing. But I was afraid lest you, with your
subtle mind and ultra-sensitive heart, might, if you did not hear from
me, needlessly torment yourself, if, that is to say, you still
condescend to occupy your thoughts with this blunt trooper whom
you will have a hard task to polish and refine, and make a little more
subtle and worthier of your company."
On the whole this letter, in its affectionate spirit, was not at all unlike
those which, when I did not yet know Saint-Loup, I had imagined
that he would write to me, in those daydreams from which the
coldness of his first greeting had shaken me by bringing me face to
face with an icy reality which was not, however, to endure. Once I
had received this letter, whenever, at luncheon-time, the post was
brought in, I could tell at once when it was from him that a letter
came, for it had always that second face which a person assumes
when he is absent, in the features of which (the characters of his
script) there is no reason why we should not suppose that we are
tracing an individual soul just as much as in the line of a nose or the
inflexions of a voice.
I would now gladly remain at the table while it was being cleared,
and, if it was not a moment at which the girls of the little band
might be passing, it was no longer solely towards the sea that I
would turn my eyes. Since I had seen such things depicted in water-
colours by Elstir, I sought to find again in reality, I cherished, as
though for their poetic beauty, the broken gestures of the knives still
lying across one another, the swollen convexity of a discarded napkin
upon which the sun would patch a scrap of yellow velvet, the half-
empty glass which thus shewed to greater advantage the noble
sweep of its curved sides, and, in the heart of its translucent crystal,
clear as frozen daylight, a dreg of wine, dusky but sparkling with
reflected lights, the displacement of solid objects, the transmutation
of liquids by the effect of light and shade, the shifting colour of the
plums which passed from green to blue and from blue to golden
yellow in the half-plundered dish, the chairs, like a group of old
ladies, that came twice daily to take their places round the white
cloth spread on the table as on an altar at which were celebrated the
rites of the palate, where in the hollows of oyster-shells a few drops
of lustral water had gathered as in tiny holy water stoups of stone; I
tried to find beauty there where I had never imagined before that it
could exist, in the most ordinary things, in the profundities of "still
life".
When, some days after Saint-Loup's departure, I had succeeded in
persuading Elstir to give a small tea-party, at which I was to meet
Albertine, that freshness of appearance, that smartness of attire,
both (alas) fleeting, which were to be observed in me at the moment
of my starting out from the Grand Hotel, and were due respectively
to a longer rest than usual and to special pains over my toilet, I
regretted my inability to reserve them (and also the credit accruing
from Elstir's friendship) for the captivation of some other, more
interesting person; I regretted having to use them all up on the
simple pleasure of making Albertine's acquaintance. My brain
assessed this pleasure at a very low value now that it was assured
me. But, inside, my will did not for a moment share this illusion, that
will which is the persevering and unalterable servant of our
successive personalities; hiding itself in secret places, despised,
downtrodden, untiringly faithful, toiling without intermission and
with no thought for the variability of the self, its master, if only that
master may never lack what he requires. Whereas at the moment
when we are just about to start on a long-planned and eagerly
awaited holiday, our brain, our nerves begin to ask themselves
whether it is really worth all the trouble involved, the will, knowing
that those lazy masters would at once begin to consider their
journey the most wonderful experience, if it became impossible for
them to take it, the will leaves them explaining their difficulties
outside the station, multiplying their hesitations; but busies itself
with taking the tickets and putting us into the carriage before the
train starts. It is as invariable as brain and nerves are fickle, but as it
is silent, gives no account of its actions, it seems almost non-
existent; it is by its dogged determination that the other constituent
parts of our personality are led, but without seeing it, while they
distinguish clearly all their own uncertainties. My nerves and brain
then started a discussion as to the real value of the pleasure that
there would be in knowing Albertine, while I studied in the glass vain
and perishable attractions which nerves and brain would have
preserved intact for use on some other occasion. But my will would
not let the hour pass at which I must start, and it was Elstir's
address that it called out to the driver. Brain and nerves were at
liberty, now that the die was cast, to think this "a pity." If my will
had given the man a different address, they would have been finely
"sold".
When I arrived at Elstir's, a few minutes later, my first impression
was that Mlle. Simonet was not in the studio. There was certainly a
girl sitting there in a silk frock, bare-headed, but one whose
marvellous hair, her nose, meant nothing to me, in whom I did not
recognise the human entity that I had formed out of a young cyclist
strolling past, in a polo-cap, between myself and the sea. It was
Albertine, nevertheless. But even when I knew it to be her, I gave
her no thought. On entering any social gathering, when we are
young, we lose consciousness of our old self, we become a different
man, every drawing-room being a fresh universe, in which, coming
under the sway of a new moral perspective, we fasten our attention,
as if they were to matter to us for all time, on people, dances, card-
tables, all of which we shall have forgotten by the morning. Obliged
to follow, if I was to arrive at the goal of conversation with Albertine,
a road in no way of my own planning, which first brought me to a
halt at Elstir, passed by other groups of guests to whom I was
presented, then along the table, at which I was offered, and ate a
strawberry tart or two, while I listened, motionless, to the music that
was beginning in another part of the room, I found myself giving to
these various incidents the same importance as to my introduction
to Mlle. Simonet, an introduction which was now nothing more than
one among several such incidents, having entirely forgotten that it
had been, but a few minutes since, my sole object in coming there
that day. But is it not ever thus in the bustle of daily life, with every
true happiness, every great sorrow. In a room full of other people
we receive from her whom we love the answer, propitious or fatal,
which we have been awaiting for the last year. But we must go on
talking, ideas come, one after another, forming a smooth surface
which is pricked, at the very most, now and then by a dull throb
from within of the memory, deep-rooted enough but of very slender
growth, that misfortune has come upon us. If, instead of misfortune,
it is happiness, it may be that not until many years have elapsed will
we recall that the most important event in our sentimental life
occurred without our having time to give it any prolonged attention,
or even to become aware of it almost, at a social gathering, it may
have been, to which we had gone solely in expectation of that event.
When Elstir asked me to come with him so that he might introduce
me to Albertine, who was sitting a little farther down the room, I
first of all finished eating a coffee éclair and, with a show of keen
interest, asked an old gentleman whose acquaintance I had just
made (and thought that I might, perhaps, offer him the rose in my
buttonhole which he had admired) to tell me more about the old
Norman fairs. This is not to say that the introduction which followed
did not give me any pleasure, nor assume a definite importance in
my eyes. But so far as the pleasure was concerned, I was not
conscious of it, naturally, until some time later, when, once more in
the hotel, and in my room alone, I had become myself again.
Pleasure in this respect is like photography. What we take, in the
presence of the beloved object, is merely a negative film; we
develop it later, when we are at home, and have once again found at
our disposal that inner dark-room, the entrance to which is barred to
us so long as we are with other people.
If my consciousness of the pleasure it had brought me was thus
retarded by a few hours, the importance of this introduction I felt
immediately. At such moments of introduction, for all that we feel
ourselves to have been suddenly enriched, to have been furnished
with a pass that will admit us henceforward to pleasures which we
have been pursuing for weeks past, but in vain, we realise only too
clearly that this acquisition puts an end for us not merely to hours of
toilsome search—a relief that could only fill us with joy—but also to
the very existence of a certain person, her whom our imagination
had wildly distorted, our anxious fear that we might never become
known to her enlarged. At the moment when our name sounds on
the lips of the person introducing us, especially if he amplifies it, as
Elstir was now doing, with a flattering account of us—in that
sacramental moment, as when in a fairy tale the magician
commands a person suddenly to become someone else, she to
whose presence we have been longing to attain vanishes; how could
she remain the same when, for one thing—owing to the attention
which the stranger is obliged to pay to the announcement of our
name and the sight of our person—in the eyes that only yesterday
were situated at an infinite distance (where we supposed that our
eyes, wandering, uncontrolled, desperate, divergent, would never
succeed in meeting them) the conscious gaze, the incommunicable
thought which we have been seeking have been miraculously and
quite simply replaced by our own image, painted in them as though
behind the glass of a smiling mirror. If this incarnation of ourself in
the person who seems to differ most from us is what does most to
modify the appearance of the person to whom we have just been
introduced, the form of that person still remains quite vague; and we
are free to ask ourself whether she will turn out to be a god, a table
or a basin. But, as nimble as the wax-modellers who will fashion a
bust before our eyes in five minutes, the few words which the
stranger is now going to say to us will substantiate her form, will
give her something positive and final that will exclude all the
hypotheses by which, a moment ago, our desire, our imagination
were being tempted. Doubtless, even before her coming to this
party, Albertine had ceased to be to me simply that sole phantom
worthy to haunt our life which is what remains of a passing stranger,
of whom we know nothing and have caught but the barest glimpse.
Her relation to Mme. Bontemps had already restricted the scope of
those marvellous hypotheses, by stopping one of the channels along
which they might have spread. As I drew closer to the girl, and
began to know her better, my knowledge of her underwent a
process of subtraction, all the factors of imagination and desire
giving place to a notion which was worth infinitely less, a notion to
which, it must be admitted, there was added presently what was
more or less the equivalent, in the domain of real life, of what joint
stock companies give one, after paying interest on one's capital, and
call a bonus. Her name, her family connexions had been the original
limit set to my suppositions. Her friendly greeting while, standing
close beside her, I saw once again the tiny mole on her cheek, below
her eye, marked another stage; last of all, I was surprised to hear
her use the adverb "perfectly" (in place of "quite") of two people
whom she mentioned, saying of one: "She is perfectly mad, but very
nice for all that," and of the other, "He is a perfectly common man, a
perfect bore." However little to be commended this use of "perfectly"
may be, it indicates a degree of civilisation and culture which I could
never have imagined as having been attained by the bacchante with
the bicycle, the frenzied muse of the golf-course. Nor did it mean
that after this first transformation Albertine was not to change again
for me, many times. The good and bad qualities which a person
presents to us, exposed to view on the surface of his or her face,
rearrange themselves in a totally different order if we approach them
from another angle—just as, in a town, buildings that appear strung
irregularly along a single line, from another aspect retire into a
graduated distance, and their relative heights are altered. To begin
with, Albertine now struck me as not implacable so much as almost
frightened; she seemed to me rather respectably than ill-bred,
judging by the description, "bad style," "a comic manner" which she
applied to each in turn of the girls of whom I spoke to her; finally,
she presented as a target for my line of sight a temple that was
distinctly flushed and hardly attractive to the eye, and no longer the
curious gaze which I had always connected with her until then. But
this was merely a second impression and there were doubtless
others through which I was successively to pass. Thus it can be only
after one has recognised, not without having had to feel one's way,
the optical illusions of one's first impression that one can arrive at an
exact knowledge of another person, supposing such knowledge to
be ever possible. But it is not; for while our original impression of
him undergoes correction, the person himself, not being an
inanimate object, changes in himself, we think that we have caught
him, he moves, and, when we imagine that at last we are seeing
him clearly, it is only the old impressions which we had already
formed of him that we have succeeded in making clearer, when they
no longer represent him.
And yet, whatever the inevitable disappointments that it must bring
in its train, this movement towards what we have only half seen,
what we have been free to dwell upon and imagine at our leisure,
this movement is the only one that is wholesome for the senses, that
whets the appetite. How dreary a monotony must pervade those
people's lives who, from indolence or timidity, drive in their carriages
straight to the doors of friends whom they have got to know without
having first dreamed of knowing them, without ever daring, on the
way, to stop and examine what arouses their desire.
I returned home, my mind full of the party, the coffee éclair which I
had finished eating before I let Elstir take me up to Albertine, the
rose which I had given the old gentleman, all the details selected
without our knowledge by the circumstances of the occasion, which
compose in a special and quite fortuitous order the picture that we
retain of a first meeting. But this picture, I had the impression that I
was seeing it from a fresh point of view, a long way remote from
myself, realising that it had not existed only for me, when some
months later, to my great surprise, on my speaking to Albertine on
the day on which I had first met her, she reminded me of the éclair,
the flower that I had given away, all those things which I had
supposed to have been—I will not say of importance only to myself
but—perceived only by myself, and which I now found thus
transcribed, in a version the existence of which I had never
suspected, in the mind of Albertine. On this first day itself, when, on
my return to the hotel, I was able to visualise the memory which I
had brought away with me, I realised the consummate adroitness
with which the sleight of hand had been performed, and how I had
talked for a moment or two with a person who, thanks to the skill of
the conjurer, without actually embodying anything of that other
person whom I had for so long been following as she paced beside
the sea, had been effectively substituted for her. I might, for that
matter, have guessed as much in advance, since the girl of the
beach was a fabrication invented by myself. In spite of which, as I
had, in my conversations with Elstir, identified her with this other
girl, I felt myself in honour bound to fulfil to the real the promises of
love made to the imagined Albertine. We betroth ourselves by proxy,
and think ourselves obliged, in the sequel, to marry the person who
has intervened. Moreover, if there had disappeared, provisionally at
any rate, from my life, an anguish that found adequate consolation
in the memory of polite manners, of that expression "perfectly
common" and of the glowing temple, that memory awakened in me
desire of another kind which, for all that it was placid and not at all
painful, resembling rather brotherly love, might in the long run
become fully as dangerous by making me feel at every moment a
compelling need to kiss this new person, whose charming ways, her
shyness, her unlooked-for accessibility, arrested the futile process of
my imagination but gave birth to a sentimental gratitude. And then,
since memory begins at once to record photographs independent of
one another, eliminates every link, any kind of sequence from
between the scenes portrayed in the collection which it exposes to
our view, the most recent does not necessarily destroy or cancel
those that came before. Confronted with the common-place though
appealing Albertine to whom I had spoken that afternoon, I still saw
the other, mysterious Albertine outlined against the sea. These were
now memories, that is to say pictures neither of which now seemed
to me any more true than the other. But, to make an end of this first
afternoon of my introduction to Albertine, when trying to recapture
that little mole on her cheek, just under the eye, I remembered that,
looking from Elstir's window, when Albertine had gone by, I had seen
the mole on her chin. In fact, whenever I saw her I noticed that she
had a mole, but my inaccurate memory made it wander about the
face of Albertine, fixing it now in one place, now in another.
Whatever my disappointment in finding in Mlle. Simonet a girl so
little different from those that I knew already, just as my rude
awakening when I saw Balbec church did not prevent me from
wishing still to go to Quimperlé, Pont-Aven and Venice, I comforted
myself with the thought that through Albertine at any rate, even if
she herself was not all that I had hoped, I might make the
acquaintance of her comrades of the little band.
I thought at first that I should fail. As she was to be staying (and I
too) for a long time still at Balbec, I had decided that the best thing
was not to make my efforts to meet her too apparent, but to wait for
an accidental encounter. But should this occur every day, even, it
was greatly to be feared that she would confine herself to
acknowledging my bow from a distance, and such meetings,
repeated day after day throughout the whole season, would benefit
me not at all.
Shortly after this, one morning when it had been raining and was
almost cold, I was accosted on the "front" by a girl wearing a close-
fitting toque and carrying a muff, so different from the girl whom I
had met at Elstir's party that to recognise in her the same person
seemed an operation beyond the power of the human mind; mine
was, nevertheless, successful in performing it, but after a
momentary surprise which did not, I think, escape Albertine's notice.
On the other hand, when I instinctively recalled the good-breeding
which had so impressed me before, she filled me with a converse
astonishment by her rude tone and manners typical of the "little
band". Apart from these, her temple had ceased to be the optical
centre, on which the eye might comfortably rest, of her face, either
because I was now on her other side, or because her toque hid it, or
else possibly because its inflammation was not a constant thing.
"What weather!" she began. "Really the perpetual summer of Balbec
is all stuff and nonsense. You don't go in for anything special here,
do you? We don't ever see you playing golf, or dancing at the
Casino. You don't ride, either. You must be bored stiff. You don't find
it too deadly, staying about on the beach all day. I see, you just bask
in the sun like a lizard; you enjoy that. You must have plenty of time
on your hands. I can see you're not like me; I simply adore all
sports. You weren't at the Sogne races! We went in the 'tram', and I
can quite believe you don't see the fun of going in an old 'tin-pot'
like that. It took us two whole hours! I could have gone there and
back three times on my bike." I, who had been lost in admiration of
Saint-Loup when he, in the most natural manner in the world, called
the little local train the "crawler", because of the ceaseless windings
of its line, was positively alarmed by the glibness with which
Albertine spoke of the "tram", and called it a "tin-pot". I could feel
her mastery of a form of speech in which I was afraid of her
detecting and scorning my inferiority. And yet the full wealth of the
synonyms that the little band possessed to denote this railway had
not yet been revealed to me. In speaking, Albertine kept her head
motionless, her nostrils closed, allowing only the corners of her lips
to move. The result of this was a drawling, nasal sound, into the
composition of which there entered perhaps a provincial descent, a
juvenile affectation of British phlegm, the teaching of a foreign
governess and a congestive hypertrophy of the mucus of the nose.
This enunciation which, as it happened, soon disappeared when she
knew people better, giving place to a natural girlish tone, might have
been thought unpleasant. But it was peculiar to herself, and
delighted me. Whenever I had gone for several days without seeing
her, I would refresh my spirit by repeating to myself: "We don't ever
see you playing golf," with the nasal intonation in which she had
uttered the words, point blank, without moving a muscle of her face.
And I thought then that there could be no one in the world so
desirable.
We formed that morning one of those couples who dotted the
"front" here and there with their conjunction, their stopping together
for time enough just to exchange a few words before breaking apart,
each to resume separately his or her divergent stroll. I seized the
opportunity, while she stood still, to look again and discover once
and for all where exactly the little mole was placed. Then, just as a
phrase of Vinteuil which had delighted me in the sonata, and which
my recollection allowed to wander from the andante to the finale,
until the day when, having the score in my hands, I was able to find
it, and to fix it in my memory in its proper place, in the scherzo, so
this mole, which I had visualised now on her cheek, now on her
chin, came to rest for ever on her upper lip, just below her nose. In
the same way, too, do we not come with amazement upon lines that
we know by heart in a poem in which we never dreamed that they
were to be found.
At that moment, as if in order that against the sea there might
multiply in freedom, in the variety of its forms, all the rich decorative
whole which was the lovely unfolding of the train of maidens, at
once golden and rosy, baked by sun and wind, Albertine's friends,
with their shapely limbs, their supple figures, but so different one
from another, came into sight in a cluster that expanded as it
approached, advancing towards us, but keeping closer to the sea,
along a parallel line. I asked Albertine's permission to walk for a little
way with her. Unfortunately, all she did was to wave her hand to
them in greeting. "But your friends will be disappointed if you don't
go with them," I hinted, hoping that we might all walk together. A
young man with regular features, carrying a bag of golf-clubs,
sauntered up to us. It was the baccarat-player, whose fast ways so
enraged the chief magistrate's wife. In a frigid, impassive tone,
which he evidently regarded as an indication of the highest
refinement, he bade Albertine good day. "Been playing golf,
Octave?" she asked. "How did the game go? Were you in form?"
"Oh, it's too sickening; I can't play for nuts," he replied. "Was
Andrée playing?" "Yes, she went round in seventy-seven." "Why,
that's a record!" "I went round in eighty-two yesterday." He was the
son of an immensely rich manufacturer who was to take an
important part in the organisation of the coming World's Fair. I was
struck by the extreme degree to which, in this young man and in the
other by no means numerous male friends of the band of girls, the
knowledge of everything that pertained to clothes and how to wear
them, cigars, English drinks, horses, a knowledge which he
possessed in its minutest details with a haughty infallibility that
approached the reticent modesty of the true expert, had been
developed in complete isolation, unaccompanied by the least trace of
any intellectual culture. He had no hesitation as to the right time and
place for dinner jacket or pyjamas, but neither had he any suspicion
of the circumstances in which one might or might not employ this or
that word, or even of the simplest rules of grammar. This disparity
between the two forms of culture must have existed also in his
father, the President of the Syndicate that "ran" Balbec, for, in an
open letter to the electors which he had recently had posted on all
the walls, he announced: "I desired to see the Mayor, to speak to
him of the matter; he would not listen to my righteous plaint."
Octave, at the Casino, took prizes in all the dancing competitions, for
bostons, tangos and what-not, an accomplishment that would entitle
him, if he chose, to make a fine marriage in that seaside society
where it is not figuratively but in sober earnest that the young
women "marry their dancing-partners". He lighted a cigar with a
"D'you mind?" to Albertine, as one who asks permission to finish,
while going on talking, an urgent piece of work. For he was one of
those people who can never be "doing nothing", although there was
nothing, for that matter, that he could ever be said to do. And as
complete inactivity has the same effect on us, in the end, as
prolonged overwork, and on the character as much as on the life of
body and muscles, the unimpaired nullity of intellect that was
enshrined behind Octave's meditative brow had ended by giving him,
despite his air of unruffled calm, ineffectual longings to think which
kept him awake at night, for all the world like an overwrought
philosopher.
Supposing that if I knew their male friends I should have more
opportunities of seeing the girls, I had been on the point of asking
for an introduction to Octave. I told Albertine this, as soon as he had
left us, still muttering, "I couldn't play for nuts!" I thought I would
thus put into her head the idea of doing it next time. "But I can't,"
she cried, "introduce you to a tame cat like that. This place simply
swarms with them. But what on earth would they have to say to
you? That one plays golf quite well, and that's all there is to it. I
know what I'm talking about; you'ld find he wasn't at all your sort."
"Your friends will be cross with you if you desert them like this," I
repeated, hoping that she would then suggest my joining the party.
"Oh, no, they don't want me." We ran into Bloch, who directed at me
a subtle, insinuating smile, and, embarrassed by the presence of
Albertine, whom he did not know, or, rather, knew "without knowing"
her, bent his head with a stiff, almost irritated jerk. "What's he
called, that Ostrogoth?" Albertine asked. "I can't think why he should
bow to me; he doesn't know me. And I didn't bow to him, either." I
had no time to explain to her, for, bearing straight down upon us,
"Excuse me," he began, "for interrupting you, but I must tell you
that I am going to Doncières to-morrow. I cannot put it off any
longer without discourtesy; indeed, I ask myself, what must de
Saint-Loup-en-Bray think of me. I just came to let you know that I
shall take the two o'clock train. At your service." But I thought now
only of seeing Albertine again, and of trying to get to know her
friends, and Doncières, since they were not going there, and my
going would bring me back too late to see them still on the beach,
seemed to me to be situated at the other end of the world. I told
Bloch that it was impossible. "Oh, very well, I shall go alone. In the
fatuous words of Master Arouet, I shall say to Saint-Loup, to beguile
his clericalism:"