0% found this document useful (0 votes)
227 views

Machine Learning with Python 1st Edition Oliver Theobald download

The document provides information about various machine learning ebooks available for download, including titles by Oliver Theobald and others. It discusses the evolution of machine learning, its significance in the job market, and the importance of Python as a programming language for machine learning applications. Additionally, it outlines the structure of the book, including datasets used and key concepts covered for beginners in machine learning.

Uploaded by

foltztoyos1e
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
227 views

Machine Learning with Python 1st Edition Oliver Theobald download

The document provides information about various machine learning ebooks available for download, including titles by Oliver Theobald and others. It discusses the evolution of machine learning, its significance in the job market, and the importance of Python as a programming language for machine learning applications. Additionally, it outlines the structure of the book, including datasets used and key concepts covered for beginners in machine learning.

Uploaded by

foltztoyos1e
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

Machine Learning with Python 1st Edition Oliver

Theobald pdf download

https://ebookname.com/product/machine-learning-with-python-1st-
edition-oliver-theobald/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Machine Learning with Spark and Python 2nd Edition


Michael Bowles

https://ebookname.com/product/machine-learning-with-spark-and-
python-2nd-edition-michael-bowles/

Python Machine Learning Cookbook 1st Edition Joshi

https://ebookname.com/product/python-machine-learning-
cookbook-1st-edition-joshi/

Python Machine Learning 1st Edition Wei-Meng Lee

https://ebookname.com/product/python-machine-learning-1st-
edition-wei-meng-lee/

CD and DVD Forensics 1st Edition Paul Crowley

https://ebookname.com/product/cd-and-dvd-forensics-1st-edition-
paul-crowley/
The English Medieval Town A Reader in English Urban
History 1200 1540 Richard Holt

https://ebookname.com/product/the-english-medieval-town-a-reader-
in-english-urban-history-1200-1540-richard-holt/

The Cambridge Companion to Adam Smith First Edition


Knud Haakonssen

https://ebookname.com/product/the-cambridge-companion-to-adam-
smith-first-edition-knud-haakonssen/

Principles for Best Practice in Clinical Audit 1st


Edition National Institute For Clinical Excellence

https://ebookname.com/product/principles-for-best-practice-in-
clinical-audit-1st-edition-national-institute-for-clinical-
excellence/

Contemporary Colonialities in Mexico and Beyond 1st


Edition Kathleen Ann Myers

https://ebookname.com/product/contemporary-colonialities-in-
mexico-and-beyond-1st-edition-kathleen-ann-myers/

Bloodshot Cherie Priest

https://ebookname.com/product/bloodshot-cherie-priest/
Global Citizenship A Critical Introduction 1st Edition
Nigel Dower (Editor)

https://ebookname.com/product/global-citizenship-a-critical-
introduction-1st-edition-nigel-dower-editor/
First Edition

Copyright © 2024 by Oliver Theobald

Published by Scatterplot Press

All rights reserved. No part of this publication may be reproduced, distributed,


or transmitted in any form or by any means, including photocopying, recording,
or other electronic or mechanical methods, without the prior written permission
of the publisher, except in the case of brief quotations embodied in critical
reviews and certain other non-commercial uses permitted by copyright law.

www.scatterplotpress.com

Please contact the author at oliver.theobald@scatterplotpress.com for


feedback, media contact, omissions or errors regarding this book.

2
FIND US ON:

Newsletter
http://eepurl.com/gKjQij

Enjoy book recommendations, free giveaways of future book releases from the
author, and other blog posts and news concerning machine learning, trends, and
data science.

Teachable
http://scatterplotpress.com

For introductory video courses on machine learning.

Skillshare
www.skillshare.com/user/machinelearning_beginners

For introductory video courses on machine learning and video lessons from other
instructors.

Instagram
machinelearning_beginners

For mini-lessons, book quotes, and more!

3
TABLE OF CONTENTS

FOREWORD ..................................................................................................................... 5

DATASETS USED IN THIS BOOK.......................................................................................... 8

INTRODUCTION ............................................................................................................. 10

DEVELOPMENT ENVIRONMENT ...................................................................................... 17

MACHINE LEARNING LIBRARIES ...................................................................................... 20

EXPLORATORY DATA ANALYSIS....................................................................................... 26

DATA SCRUBBING .......................................................................................................... 38

PRE-MODEL ALGORITHMS .............................................................................................. 49

SPLIT VALIDATION .......................................................................................................... 64

MODEL DESIGN .............................................................................................................. 69

LINEAR REGRESSION ...................................................................................................... 79

LOGISTIC REGRESSION .................................................................................................... 92

SUPPORT VECTOR MACHINES ....................................................................................... 105

K-NEAREST NEIGHBORS ................................................................................................ 114

TREE-BASED METHODS................................................................................................. 122

NEXT STEPS .................................................................................................................. 137

APPENDIX 1: INTRODUCTION TO PYTHON ..................................................................... 138

APPENDIX 2: PRINT COLUMNS ...................................................................................... 144

4
FOREWORD

While it’s luring to see trends rise quickly, it’s important to see long periods of
resilience before the curve. For those pursuing a career in machine learning, it’s
reassuring to know this field of study not only predates the Internet and the moon
landing but also most readers of this book.
Machine learning is not an overnight movement and the path to the present day
has been anything but smooth sailing. Conceptual theories emerged in the 1950s
but progress was stalled by computational constraints and limited data. This
resulted in a logjam of research and good intentions as theoretical models of
prediction, algorithm design, and extrapolation of future possibilities accumulated
in research institutions until powerful processing chips and large datasets emerged
in the 1990s. Renewed interest helped to breach the gap between theory and
capability during this decade but it still wasn’t enough to push field-altering
breakthroughs in the space of deep learning.
That breakthrough came in 2009 when Adjunct Professor Andrew Ng and his team
at Stanford University experimented with tethering gaming chips—better known for
image rendering—to solve complex data problems. The combination of inexpensive
GPU (graphic processing unit) chips and compute-intensive algorithms pushed the
lead domino in the development of deep learning. This crucial breakthrough
coalesced with other developments in reinforcement learning to spark a surge in
interest, an oversupply of newspaper analogies to Hollywood movies, and an
international hunt for AI talent.
In 2016, media interest climbed to a new high at the glitzy Four Seasons Hotel in
Seoul, where TV cameras locked lenses on an 18-by-18 Go board with the world
champion on one side and an AI program on the other. The game of Go consists of
billions of permutations and commentators described the then world champion, Lee
Sodol, as having a sixth sense for interpreting the state of play. His opponent was
AlphaGo, a sophisticated deep learning model designed to outperform any
opponent—mortal or synthetic.
The team of human developers responsible for designing the AlphaGo program
scarcely knew the rules of the game when they began work on the project, but
they watched on excitedly as AlphaGo performed its first move.
The AI model unsettled Lee early—forcing him to take a nervous cigarette break—
before systemically defeating the South Korean four games to one. News headlines
of AlphaGo’s cold and mechanistic victory beamed across the globe—as had been
the case with other televised AI feats before it. Predictably, these reports focused
on the superiority of machine intelligence over humans.
Contrary to these initial headlines, the 2017 Netflix documentary AlphaGo helped
to later realign attention towards the human ingenuity behind AlphaGo’s victory.
The documentary details the lead-up to Seoul and in doing so shines the light on a
team of talented employees thriving in a new and far-reaching line of work.
Dressed in casual attire, the AlphaGo team can be seen working hard behind their
screens stocking the model with training data, optimizing its hyperparameters, and

5
coordinating vital computational resources before extracting game tactics from
human experts honed over many years of competition.
Despite its prolific success, the AlphaGo program has not replaced any of the
programmers who worked on its source code or taken away their salaries. In fact,
the development of AlphaGo has helped to expand the size and profile of the
company DeepMind Technologies, which was acquired by Alphabet Inc earlier in
2014.

Working in AI
After two AI winters and ongoing battles for academic funding, we have entered a
golden age in industry employment. Complex databases, fast and affordable
processing units, and advanced algorithms have rejuvenated established fields of
human expertise in mathematics, statistics, computer programming, graphics and
visualization as well as good old problem-solving skills.
In a global job market steadily automated and simplified by Web 2.0 technology,
the field of machine learning provides a professional nirvana for human ingenuity
and meaningful work. It’s a cognitively demanding occupation; one that goes far
beyond tuning ad campaigns or tracking web traffic on side-by-side monitors. With
jobs in this industry demanding expertise in three distinct fields, achieving machine
intelligence is far from easy and demands a high level of expertise.
The ideal skillset for a machine learning developer spans coding, data management,
and knowledge of statistics and mathematics. Optional areas of expertise include
data visualization, big data management, and practical experience in distributed
computing architecture. This book converges on the vital coding part of machine
learning using Python.
Released in 1991 by Guido van Rossum, Python is widely used in the field of
machine learning and is easy to learn courtesy of van Rossum’s emphasis on code
readability. Python is versatile too; while other popular languages like R offer
advantages in advanced mathematical operations and statistical functions, they
offer limited practical use outside of hard data crunching. The utility of Python,
however, extends to data collection (web scraping) and data piping (Hadoop and
Spark), which are important for sending data to the operating table. In addition,
Python is convertible to C and C++, enabling practitioners to run code on graphic
processing units reserved for advanced computation.
The other advantages of learning a popular programming language (such as Python)
are the depth of jobs and the spread of relevant support. Access to documentation,
tutorials, and assistance from a helpful community to troubleshoot code problems
cannot be overlooked and especially for anyone beginning their journey in the
complex world of computer programming.
As a practical introduction to coding machine learning models, this book falls short
of a complete introduction to programming with Python. Instead, general nuances
are explained to enlighten beginners without stalling the progress of experienced
programmers. For those new to Python, a basic overview of Python can be found
in the Appendix section of this book. It’s also recommended that you spend 2-3

6
hours watching introductory Python tutorials on YouTube or Udemy if this is your
first time working with Python.

What You Will Learn


As the second book in the Machine Learning for Beginner’s Series, the key premise
of this title is to teach you how to code basic machine learning models. The content
is designed for beginners with general knowledge of machine learning, including
common algorithms such as logistic regression and decision trees. If this doesn’t
describe your experience or you’re in need of a refresher, I have summarized key
concepts from machine learning in the opening chapter and there are overviews of
specific algorithms dispersed throughout the book. For a gentle and more detailed
explanation of machine learning theory minus the code, I suggest reading the first
title in this series Machine Learning for Absolute Beginners (Third Edition), which
is written for a more general audience.
Finally, it’s important to note that as new versions of Python code libraries become
available, it’s possible for small discrepancies to materialize between the code
shown in this book and the actual output of Python in your development
environment. To clarify any discrepancies or to help troubleshoot your code, please
contact me at oliver.theobald@scatterplotpress.com for assistance. General code
problems can also be solved by searching for answers on Stack Overflow
(www.stackoverflow.com) or by Google searching the error message outputted by
the Python interpreter.

Conventions Used in This Book


- Italic indicates the introduction of new technical terms
- lowercase bold indicates programming code in Python
- the terms “target variable” and “output” are used interchangeably
- the terms “variable” and “feature” are used interchangeably
- Typical of machine learning literature, “independent variables” are
expressed as an uppercase “X” and the “dependent variable” as a lowercase
“y”

7
DATASETS USED IN THIS BOOK

For any issues accessing and downloading these three datasets, please
contact the author at oliver.theobald@scatterplotpress.com

Advertising Dataset
Overview: This dataset contains fabricated information about the features of users
responding to online advertisements, including their sex, age, location, daily time
spent online, and whether they clicked on the target advertisement. The dataset
was created by Udemy course instructor Jose Portilla of Pierian Data and is used in
his course Python for Data Science and Machine Learning Bootcamp.
Features: 10
Missing values: No
File name: advertising.csv
http://scatterplotpress.com/p/datasets

Melbourne Housing Market Dataset


Overview: This dataset contains data on house, unit, and townhouse prices in
Melbourne, Australia. This dataset comprises data scraped from publicly available
real estate listings posted weekly on www.domain.com.au. The full dataset contains
21 variables including address, suburb, land size, number of rooms, price, longitude,
latitude, postcode, etc.
Features: 21
Contains missing values: Yes
File name: Melbourne_housing_FULL.csv

https://www.kaggle.com/anthonypino/melbourne-housing-market/#Melbourne_housing_FULL.csv

Berlin Airbnb Dataset


Overview: Airbnb has exploded in growth following its humble beginnings in 2008,
and Berlin is one of the biggest markets for alternative accommodation in Europe,
with over 22,552 Airbnb listings recorded as of November 2018. The dataset
contains detailed data, including location, price, and reviews.
Features: 16
Contains missing values: Yes
File name: listings.csv

http://scatterplotpress.com/p/datasets

Kickstarter Dataset
Overview: Kickstarter.com is the world's largest crowd-funding platform for
creative projects and this dataset was created using data extracted from the
Kickstarter website.
Features: 35

8
Contains missing values: Yes
File name: 18k_Projects.csv
https://www.kaggle.com/tayoaki/kickstarter-dataset

9
1

INTRODUCTION

As an empirical and specialized field of data science and a dominant sub-field of AI,
machine learning1 describes the ability of computer models to learn from data and
perform cognitive reasoning without direct programming.2 This is a process known
as self-learning—an exciting but somewhat vague concept that underpins machine
learning. While the human programmer maintains ownership of variable selection
and setting algorithm learning hyperparameters (settings), the decision model
interprets patterns and generates an output without a direct command. This course
of action serves as a major distinction from traditional computer programming
where computers are designed to produce fixed outputs in response to pre-
programmed commands.
The initial blueprints for machine learning were conceived by Arthur Samuel while
working for IBM as an engineer in the late 1950s. Samuel defined machine
learning as a subfield of computer science that provides computers the ability to
learn without being explicitly programmed.3 Incorporating probability theory and
statistical modeling, Samuel outlined the potential for machines to detect patterns
and improve performance based on data and empirical information; all without
direct programming commands.
Samuel held that by using data as input, machines could mimic the ability of
humans to learn and identify optimal decisions without explicit code commands
from the programmer. While human programmers were required to facilitate the
input of data and the selection of algorithm(s), they would forego the role of rule-
maker under Samuel’s radical new theory.
In 1959, Samuel published a paper in the IBM Journal of Research and
Development investigating the application of machine learning in the game of
checkers. The goal of his research was to program a computer to gradually exceed
the capabilities of the person who programmed it. The machine was designed to
assess the state of a checkers board and incorporated probability theory to identify
a move that would best lead to a winning outcome. After each game, the program
integrated experience and logged new strategies to refine its performance for play
against the next opponent. This process repeated until the computer program was
able to consistently beat its programmer.
Samuel’s chess program held a competitive edge over symbolic systems that were
in vogue at this time and which relied on pre-programmed knowledge. Unlike

1
The word “machine” was a common byname for computers during this time and the moniker has stuck
over the decades.
2
Aurélien Géron, “Hands-On Machine Learning with Scikit-Learn and TensorFlow: Concepts, Tools, and
Techniques to Build Intelligent Systems,” O’Reilly Media, 2017.
3
Arthur Samuel, “Some Studies in Machine Learning Using the Game of Checkers,” IBM Journal of
Research and Development, Vol. 3, Issue. 3, 1959.

10
symbolic systems, human experts weren’t needed to predefine steps or game
strategy. Instead, the machine developed intelligence by reviewing data to
determine patterns and then codifying these patterns to inform game strategy.
Validation of Samuel’s work came in 1961 when his checkers program claimed
victory in a live match played against a professional and competitively ranked
human player.
While Samuel made significant progress in machine learning research and model
design during his time at IBM, it wasn’t until after his retirement in 1966 that the
full scope of his findings spread to the broader artificial intelligence community.
According to the authors of Human + Machine: Reimagining Work in the Age of AI,
Paul R. Daugherty and H. James Wilson, news of Samuel’s work was partly inhibited
by his modest character and reluctance to self-promote.4
Over the next two decades, attention took a backseat as other fields of artificial
intelligence including symbolic systems and expert systems5 took precedence in
industry and academic funding. Artificial intelligence, itself, underwent two periods
of declined interest, better known as the two AI winters.
The dot-com era in the 1990s eventually revived investment in machine learning
as a solution to maximize the value of data collected from online retail and digital
systems. While it seems trivial now, access to a large and cheap supply of data to
facilitate learning was a major constraint for AI researchers before this period.
Drastic advances in computer storage and processing capacity also provided the
infrastructure desperately needed to cross the chasm between theory and practical
application.
A new supply of data and cheap computing power handed machine learning a
decisive victory over expert systems as it became more efficient to derive
knowledge from data rather than task experts to configure code as an elaborate
series of if/else rules. Machine learning also offered a comparative advantage in
tackling complex and unknown problems where known steps of reasoning and
action weren’t available, such as detecting fraud and classifying spam email
messages.

Dependent and Independent Variables


As with other fields of statistical inquiry, machine learning is based on the cross-
analysis of dependent and independent variables. The dependent variable (y) is the
output you wish to predict and the independent variable (X) is an input that
supposedly impacts the dependent variable (output). The goal of machine learning
is to then find how the independent variable/s (X) affect the dependent variable
(y).
To predict the value of a house, for example, a machine learning framework called
supervised learning analyzes the relationship between house features (distance to
the city, suburb, number of rooms, land size, etc.) as independent variables and

4
Paul R. Daugherty and H. James Wilson, “Human + Machine: Reimagining Work in the Age of AI,”
Harvard Business Review Press, 2018.
5
Systems that enabled machines to perform rudimentary reasoning using if/else rules as an alternative
to strict predetermined code.

11
the selling price of other houses in the neighborhood as the dependent variable to
design a prediction model. The prediction model can then predict the value (y) of
a house with an unknown selling price by inputting its features (X) into the
prediction model.

Figure 1: House value prediction model

Supervised, Unsupervised & Reinforcement Learning


Self-learning can be divided into three categories: supervised, unsupervised, and
reinforcement.
Supervised learning decodes known relationships between independent variables
and the dependent variable. This involves feeding the machine sample data with
various features (X) and their known output value (y). The fact that the input and
output values are known qualifies the dataset as “labeled” or “supervised.” The
algorithm deciphers patterns that exist in the dataset and creates a model that
interprets new data based on the underlying rules of the labeled data.
The house model mentioned earlier is a typical example of supervised learning in
which a set of input features (i.e. rooms, distance to the city, etc.) are analyzed in
response to their labeled output (house value) across many examples to build a
prediction model. Using rules learned from the existing data, the model is then able
to predict the output of new data based on the input features.
In the case of unsupervised learning, the dependent variables aren’t known or
labeled and the model looks at patterns among independent variables to create a
new output. In the case of clustering analysis, this can be achieved by grouping
similar data points and finding connections that generalize patterns, such as the
grouping of suburbs with two-bedroom apartments that generate a high property
valuation. In the case of dimensionality reduction, the goal of unsupervised
learning is to create an output with fewer dimensions (features) than the original
input data.
As there are no known output observations available to check and validate the
model, there is no true output in unsupervised learning and predictions are more
subjective than that of supervised learning.
Unsupervised learning is useful in situations where there’s no single clear prediction
goal and exploratory data analysis is required to uncover new categories and

12
subgroups. Unsupervised learning is also useful for taking complex unlabeled data
with a high number of variables and transforming that data into a low number of
synthesized variables that are plottable on a 2-D or 3-D plot as output. Although
the input data has been transformed, the goal is to preserve as much of the data’s
original structure as possible, allowing you to better understand the structure of
the data and identify unsuspected patterns.6
Other popular unsupervised learning tasks include anomaly detection such as
fraudulent transactions or catching manufacturing defects, and automatically
removing outliers and complexity from a dataset before feeding the data to a
supervised learning algorithm.
Reinforcement learning is the third and most advanced category of machine
learning and is generally used for performing a sequence of decisions, such as
playing chess or driving an automobile.
Reinforcement learning is the opposite of unsupervised learning as the output (y)
is known but the inputs (X) are unknown. The output can be considered as the
intended goal (i.e. win a game of chess) and the optimal input is found using a
brute force technique based on trial and error. Random input data is fed to the
model and graded according to its relationship to the target output. In the case of
self-driving vehicles, movements to avoid a crash are graded positively, and in the
case of chess, moves to avoid defeat are rewarded. Over time, the model leverages
this feedback to progressively improve its choice of input variables to achieve its
desired output goal.
The AI company Wayve has released a live video recording of a car learning to
drive, which demonstrates the random and iterative nature of reinforcement
learning. Using sensors and a safety driver who intervenes when the car drifts off-
course, the car learns to navigate the circuit within just 20 minutes of training.

Video link: http://bit.ly/2YZHaLS

6
Aurélien Géron, “Hands-On Machine Learning with Scikit-Learn and TensorFlow: Concepts, Tools, and
Techniques to Build Intelligent Systems,” O’Reilly Media, 2017.

13
QUIZ
1) A model that predicts the height of adult students based on the height
of their adult relatives is an example of:

a. Supervised learning

b. Unsupervised learning

c. Reinforcement learning

d. Classification

2) What type of machine learning model is most likely to perform a never-


seen-before move in a video game to defeat its human opponent?

a. Supervised learning

b. Unsupervised learning

c. Extra supervised learning

d. Reinforcement learning

3) What type of machine learning model can we use to filter customers


into unlabeled groups based only on known inputs such as age, average
spending amount, and nationality?

a. Supervised learning

b. Unsupervised learning

c. Reinforcement learning

d. Extra supervised learning

4) Arthur Samuel’s checkers program is an example of:

a. Supervised learning

b. Unsupervised learning

c. Reinforcement learning

d. Extra supervised learning

5) Which is not an example of an independent variable for predicting house


prices as part of a supervised learning model?

14
a. Distance to city

b. Year built

c. Suburb

d. Price of house

15
SOLUTIONS
1) a, Supervised learning

2) d, Reinforcement learning

3) b, Unsupervised learning

4) a, Supervised learning

5) d, Price of house

16
2

DEVELOPMENT ENVIRONMENT

As the practical exercises delivered in this book use Jupyter Notebook as the
development environment for Python 3, this chapter serves as an optional guide
for installing Jupyter Notebook. If you have prior experience using Jupyter
Notebook or have read my earlier title Machine Learning for Absolute Beginners,
then you may wish to proceed to the next chapter.

Jupyter Notebook is a popular choice for practitioners and online courses alike, as
it combines live code, explanatory notes, and visualizations into one convenient
workspace and runs from any web browser.
Jupyter Notebook can be installed using the Anaconda Distribution or Python’s
package manager, pip. As an experienced Python user, you may wish to install
Jupyter Notebook via pip, and there are instructions available on the Jupyter
Notebook website (http://jupyter.org/install.html) outlining this option. For
beginners, I recommend choosing the Anaconda Distribution option, which offers
an easy click-and-drag setup (https://www.anaconda.com/products/individual/).
This installation option will direct you to the Anaconda website. From there, you
can select your preferred installation for Windows, macOS, or Linux. Again, you
can find instructions available on the Anaconda website based on your operating
system.
After installing Anaconda on your machine, you’ll have access to a number of data
science applications including rstudio, Jupyter Notebook, and graphviz for data
visualization through the Anaconda application. Next, you need to select Jupyter
Notebook by clicking on “Launch” inside the Jupyter Notebook tab.

17
Figure 2: The Anaconda Navigator portal

To initiate Jupyter Notebook, run the following command from the Terminal (for
Mac/Linux) or Command Prompt (for Windows):

jupyter notebook

Terminal/Command Prompt then generates a URL for you to copy and paste it into
your web browser.

Figure 3: Copy URL and paste it in into your browser

Copy and paste the generated URL into your browser to access Jupyter Notebook.
Once you have Jupyter Notebook open in your browser, click on “New” in the top
right-hand corner of the web application to create a new notebook project, and
select “Python 3.”

Figure 4: Inside Jupyter Notebook

18
You’ve now successfully set up a sandbox environment in your web browser using
Jupyter Notebook. This means that the following experimentation and code
changes will not affect resources outside of the isolated testing environment.

Figure 5: A new Jupyter notebook ready for coding

19
3

MACHINE LEARNING LIBRARIES

Data scientists rarely work alone. This means it’s vital to maintain consistent code
that can be read and reused by other programmers. Similar to using WordPress
plugins with websites, code libraries make it easy for data scientists to perform
common tasks using pre-written modules of code.
With WordPress, for example, you can install a comments management plugin
called Discuz on a portfolio of websites. Using the same plugin for each website
eliminates the need for developers to familiarize themselves with each site’s
underlying code. They simply need to familiarize themselves with the basic
interface and customization settings of the Discuz plugin.
The same logic and benefits apply to machine learning libraries, as complex
algorithms and other functions can be called through the same code interface.
Moreover, rather than writing the statistical requirements of a regression algorithm
over many lines of code, you can call the algorithm from a library such as Scikit-
learn using just one line of code.

Example:

my_model = LinearRegression()

The libraries themselves are imported on a project-by-project basis according to


the scope of your project, i.e. data visualization, deep learning, exploratory data
analysis, shallow algorithms, data scrubbing, decision tree flow maps, ensemble
modeling using multiple algorithm types, etc.
The remainder of this chapter provides a brief rundown of the most popular Python
libraries used within machine learning.

Pandas
Pandas is a library for managing and presenting your data. The name “Pandas”
comes from the term “panel data,” which refers to Panda’s ability to create a series
of panels, similar to sheets in Excel.
Pandas can be used to organize structured data as a dataframe, which is a two-
dimensional data structure (tabular dataset) with labeled rows and columns, similar
to a spreadsheet or SQL table. You can also use Pandas to import and manipulate
an external dataset including CSV files as a dataframe without affecting the source
file as modifications take place inside your development environment.

20
Figure 6: Example of a Pandas’ dataframe

NumPy
NumPy is often used in combination with Pandas and is short for “numeric Python.”
On its own, NumPy is used for managing multi-dimensional arrays and matrices,
merging and slicing datasets, and offers a collection of mathematical functions
including min, max, mean, standard deviation, and variance.
NumPy consumes less memory and is said to perform better than Pandas with
50,000 rows or less.7 NumPy, though, is often used in conjunction with Pandas as
the latter is more user-friendly and easier to interpret in an interactive environment
such as Jupyter Notebook. A Pandas dataframe is also more suitable for managing
a mix of data types, whereas a NumPy array is designed for dealing with numerical
data, especially multi-dimensional data.8
Most machine learning models demonstrated to beginners in massive open online
courses and textbooks structure data as a Pandas dataframe rather than a NumPy
array but often draw on the NumPy library for mathematical and other
miscellaneous operations.

Scikit-learn
Scikit-learn is the core library for general machine learning. It offers an extensive
repository of shallow algorithms9 including logistic regression, decision trees, linear
regression, gradient boosting, etc., a broad range of evaluation metrics such as
mean absolute error, as well as data partition methods including split validation
and cross validation.
Scikit-learn is also used to perform a number of important machine learning tasks
including training the model and using the trained model to predict the test data.
The following table is a brief overview of common terms and functions used in
machine learning from Scikit-learn.

7
Goutham Balaraman, “NumPy Vs Pandas Performance Comparison,” gouthamanbalaraman.com,
March 14, 2017, http://gouthamanbalaraman.com/blog/numpy-vs-pandas-comparison.html
8
Dimensions are the number of variables characterizing the data, such as the city of residence, country
of residence, age, and sex of a user. Up to four variables can be plotted on a scatterplot but three-
dimensional and two-dimensional plots are easier for human eyes to interpret.
9
Shallow algorithms can be roughly characterized as non-deep learning approaches that aren’t
structured as part of a sophisticated network. In shallow learning, the model predicts outcomes directly
from the input features, whereas in deep learning, the output is based on the output of preceding layers
in the model and not directly from the input features.

21
Table 1: Overview of key Scikit-learn terms and functions

Matplotlib
Matplotlib is a visualization library you can use to generate scatterplots, histograms,
pie charts, bar charts, error charts, and other visual charts with just a few lines of
code. While Matplotlib offers detailed manual control over line styles, font
properties, colors, axes, and properties, the default visual presentation is not as
striking and professional as other visualization libraries and is generally used in
conjunction with Seaborn themes.

Seaborn
Seaborn is a popular Python visualization library based on Matplotlib. This library
comes with numerous built-in themes for visualization and complex visual
techniques including color visualization of dependent and independent variables,
sophisticated heatmaps, cluster maps, and pairplots. The combination of
Seaborn’s pre-formatted visual design and Matplotlib’s customizability make it
easy to generate publication-quality visualizations.
Other popular visualization libraries include Plotly (an interactive visualization
Python library) and Cufflinks (which connects Plotly directly
with Pandas dataframes to create graphs and charts).

TensorFlow
A round-up of popular machine learning libraries wouldn’t be complete without an
introduction to Google’s TensorFlow. While Scikit-learn offers a broad set of popular

22
shallow algorithms, TensorFlow is the library of choice for deep learning and
artificial neural networks (ANN).
TensorFlow was created at Google and supports various advanced distributed
numerical computation techniques. By distributing computations on a network with
up to thousands of GPU instances, TensorFlow supports advanced algorithms
including neural networks that would be impossible to run on a single server.
Unfortunately for Mac users, TensorFlow is only compatible with the Nvidia GPU
card, which is no longer available with Mac OS X. Mac users can still run TensorFlow
on their CPU but will need to run their workload on the cloud to access the GPU.

23
QUIZ

1) Which library is better for managing a mix of data types (numeric and
non-numerical data)?

a. NumPy

b. Pandas

c. Seaborn

d. Matplotlib

2) Which Python library should we use for importing common shallow


algorithms?

a. Scikit-learn

b. Pandas

c. Tensorflow

d. Seaborn

3) Which Python libraries can be used for visualizing data relationships?

a. Scikit-learn

b. Cuffles-learn

c. Matplotlib

d. Seaborn

4) Which of the following is a dataframe?

a. A NumPy data structure

b. A Pandas data structure

c. A Scikit-learn function

d. An Excel pivot table

5) Tensorflow is generally used for deep learning. True or False?

24
SOLUTIONS
1) b, Pandas

2) a, Scikit-learn

3) c & d, Matplotlib and Seaborn

4) b, A Pandas data structure

5) True

25
Exploring the Variety of Random
Documents with Different Content
far from low-priced. They are never very exclusive organizations and
yet they give to the strain of the workaday New Yorker his last
lingering trace of hospitality—the hospitality that has lingered around
Bowling Green and Trinity and St. Paul's church-yards since colonial
days and the coffee houses.

* * * * *

Even the hospitality of the genial host seems to end—with the


ending of the lunch-hour. As he takes his last sip of café noir he is
tugging at his watch.

"Bless me," he says, "It is going on three o'clock. I've got that
railroad crowd due in my office in fifteen minutes."

That is your dismissal. For ninety minutes he has given you his
hospitality—his rare and unselfish self. He has put the perplexing
details of his business out of his mind and given himself to whatever
flow of talk might suit your fancy. Now the hour and a half of grace
is over—and you are dismissed, courteously—but none the less
dismissed. With your host you descend to the crowded noisome
street. He sees you to the subway—gives you a fine warm grasp of
his strong hand—and plunges back into the great and grinding
machine of business.

Lunch in your Day of Days within the City of the Towers is over.
Three o'clock. Before the last echoes of Trinity's bell go ringing down
through Wall street to halt the busy Exchange—the multitude has
been fed. Miss Stenographer has had her salad and éclair, two
waltzes and perhaps a "turkey trot" into the bargain, and is back at
the keys of her typewriter. Mr. President has entertained that Certain
Party at the club and has made him promise to sign that mighty
important contract. And the certain Party and Mr. President rode for
half an hour on the mechanical horses in the gymnasium. What fun,
too, for those old boys?
Three o'clock! The cashiers are totaling their receipts, the
waiters and the 'buses are upturning chairs and tables to make way
for the scrub-women, some are already beginning to don their
overcoats to go uptown; but the three-quarters of a million of
hungry mouths have been fed. New York has caught its breath in
mid-day relaxation and once more is hard at work—putting in the
last of its hours of the business day with renewed and feverish
energy.

IV
You had planned at first to walk up Broadway. You wanted to see
once again the church-yards around Trinity and St. Paul's, perhaps
make a side excursion down toward Fraunces' Tavern—just now
come back into its own again. Some of the old landmarks that are
still hidden around downtown New York seemed to appeal to you.
But your host at luncheon laughed at you.

"If you want to spend your time that way, all right," he said, "but
the only really old things you will find in New York are the faces of
the young men. You can find those anywhere in the town."

And there was another reckoning to be figured. Three o'clock


means the day well advanced and there is a vis-à-vis awaiting you
uptown. Of course, there is a Her to enjoy your Day of Days with
you. And just for convenience alone we will call her Katherine. It is a
pretty name for a woman, and it will do here and now quite as well
as any other.

Katherine is waiting for you in the Fourteenth street station of


the subway. She is prompt—after the fashion of most New York girls.
And it is a relief to come out of the overcrowded tube and find her
there at the entrance that leads up to sunshine and fresh air. She
knows her New York thoroughly and as a prelude to the trip uptown
she leads you over to Fifth avenue—to the upper deck of one of
those big green peregrinating omnibuses.

"It's a shame that we could not have started at Washington


square," she apologizes. "When you sweep around and north
through the great arch it almost seems as if you were passing
through the portals of New York. It is one of the few parts of the
town that are not changing rapidly."

For Fifth avenue—only a few blocks north of that stately arch—


has begun to disintegrate and decay. Not in the ordinary sense of
those terms. But to those who remember the stately street of fifteen
or twenty years ago—lined with the simple and dignified homes of
the town—its change into a business thoroughfare brings keen
regrets. Katherine remembers that she read in a book that there are
today more factory workers employed in Fifth avenue or close to it,
than in such great mill cities as Lowell or Lawrence or Fall River, and
when you ask her the reason why she will tell you how these great
buildings went soaring up as office-buildings, without office tenants
to fill them. They represent speculation, and speculation is New
Yorkish. But speculation in wholesale cannot afford to lose, and that
is why the garment manufacturers and many others of their sort
came flocking to the great retail shopping district between Fourth
and Seventh avenues and Fourteenth and Thirty-fourth streets, and
sent the shops soaring further to the north. It has been expensive
business throughout, doubly expensive, because absolutely
unnecessary. Some of the great retail houses of New York built
modern and elaborate structures south of Thirty-fourth street within
the past twenty years in the firm belief that the retail shopping
section had been fixed for the next half century. But the new stores
had hardly been opened before the deluge of manufacturing came
upon them. Shoppers simply would not mix with factory hands upon
lower Fifth avenue and the side streets leading from it. And so the
shop-keepers have had to move north and build anew. And just
what a tax such moving has been upon the consumer no one has
ever had the audacity to estimate.
"They should have known that nothing ever stays fixed in New
York," says Katherine. "We are a restless folk, who make a restless
city. Stay fixed? Did you notice the station at which you entered
today?"

Of course you did. The new Grand Central, with its marvelous
blue ceiling capping a waiting-room so large that the New York City
Hall, cupola, wings and all could be set within it, can hardly escape
the attention of any traveler who passes within its portals.

"It is the greatest railroad station in the world," she continues,


"and yet I have read in the newspapers that Commodore Vanderbilt
built on that very plat of ground in 1871 the largest station in the
world for the accommodation of his railroads. He thought that it
would last for all time. In forty years the wreckers were pulling it
down. It was outgrown, utterly outgrown and they were carting it off
piece by piece to the rubbish heaps."

She turns suddenly upon you.

"That is typical of our restless, lovely city," she tells you. And
you, yourself, have heard that only two years ago they tore down a
nineteen story building at Wall and Nassau streets so that they
might replace it by another of the towers—this one thirty stories in
height.

* * * * *

The conductor of the green omnibus thrusts his green fare-box


under your nose. You find two dimes and drop it into the
contrivance.

"You can get more value for less money and less value for much
money in New York than in any other large city in the world," says
Katherine.
She is right—and you know that she is right. You can have a
glorious ride up the street, that even in its days of social decadence
is still the finest highway in the land—a ride that continues across
the town and up its parked rim for long miles—for a mere ten cents
of Uncle Sam's currency and as for the reverse—well you are going
to dinner in a smart hotel with Katherine in a little while.

You swing across Broadway and up the west edge of Madison


square, catch a single, wondering close-at-hand glimpse of the white
campanile of the Metropolitan tower which dominates that open
place and so all but replaces Diana on her perch above Madison
Square Garden—a landmark of the New York of a quarter of a
century ago and which is apt to come into the hands of the wreckers
almost any day now. Now you are at the south edge of the new
shopping district, although some of the ultra places below Thirty-
fourth street have begun to move into that portion of the avenue
just south of Central Park. In a little while they may be stealing up
the loveliest portion of the avenue—from Fifty-ninth street north.

The great shops dominate the avenue. And if you look with
sharp eyes as the green bus bears you up this via sacre, you may
see that one of the greatest ones—a huge department store encased
in architecturally superb white marble—bears no sign or token of its
ownership or trade. An oversight, you think. Not a bit of it. Four
blocks farther up the avenue is another great store in white marble
—a jewelry shop of international reputation. You will have to scan its
broad façade closely indeed before you find the name of the firm in
tiny letters upon the face of its clock. Oversight? Not a bit of it. It is
the ultra of shop-keeping in New York—the assumption that the shop
is so well known that it need not be placarded to the vulgar world.
And if strangers from other points fail to identify it—well that is
because of their lack of knowledge and the shopkeeper may secretly
rejoice.

But, after all, it is the little shops that mark the character of Fifth
avenue—not its great emporiums. It is the little millinery shops
where an engaging creature in black and white simpers toward you
and calls you, if you are of the eternal feminine, "my dear;" the
jewelry shops where the lapidary rises from his lathe and offers a bit
of craftsmanship; the rare galleries that run from old masters to
modern etchers; specialty shops, filled top to bottom with toys or
Persian rugs, or women's sweaters, or foreign magazines and books,
that render to Fifth avenue its tremendous cosmopolitanism. These
little shops make for personality. There is something in the personal
contact between the proprietor and the customer that makes mere
barter possess a real fascination. And if you do pay two or three
times the real value in the little shop you have just so much more
fun out of the shopping. And there are times when real treasures
may come out of their stores.

"Look at the cornices," interrupts Katherine. "Mr. Arnold Bennett


says that they are the most wonderful things in all New York."

Katherine may strain her neck, looking at cornices if she so wills.


As for you, the folk who promenade the broad sidewalks are more
worth your while. There are more of them upon the west walk than
upon the east—for some strange reason that has long since brought
about a similar phenomenon upon Broadway and sent west side
rents high above those upon the east. Fifth avenue thrusts its
cosmopolitanism upon you, not alone in her shops, with their
wonderfully varied offerings, but in the very humans who tread her
pavements. The New York girl may not always be beautiful but she is
rarely anything but impeccable. And if in the one instance she is
extreme in her styles, in the next she is apt to be severe in her
simplicity of dress. And it is difficult to tell to which ordinary
preference should go. These girls—girls in a broad sense all the way
from trim children in charge of maid or governess to girls whose
pinkness of skin defies the graying of their locks—a sprinkling of
men, not always so faultless in dress or manner as their sisters—and
you have the Fifth avenue crowd. Then between these two quick
moving files of pedestrians—set at all times in the rapid tempo of
New York—a quadruple file of carriages; the greater part of them
motor driven.

Traffic in Fifth avenue, like traffic almost everywhere else in New


York is a problem increasing in perplexity. A little while ago the
situation was met and for a time improved by slicing off the fronts of
the buildings—perhaps the most expensive shave that the town has
ever known—and setting back the sidewalks six or eight feet. But
the benefits then gained have already been over-reached and the
traffic policeman at the street corners all the way up the avenue
must possess rare wit and diplomacy—while their fellows at such
corners as Thirty-fourth and Forty-second are hardly less than field
generals. And with all the finesse of their work the traffic moves like
molasses. Long double and triple files of touring cars and limousines,
the combined cost of which would render statistics such as would
gladden the heart of a Sunday editor, make their way up and down
the great street tediously. If a man is in a hurry he has no business
even to essay the Avenue. And occasionally the whole tangle is
double-tangled. The shriek of a fire-engine up a side street or the
clang of an ambulance demanding a clear right-of-way makes the
traffic question no easier. Yet the policemen at the street corners are
not caught unawares. With the shrill commands of their own
whistles they maneuver trucks and automobiles and even some old-
fashioned hansom cabs, pedestrians, all the rest—as coolly and as
evenly as if it had been rehearsed for whole weeks.

* * * * *

New York is wonderful, the traffic of its chief show street—for


Fifth avenue can now be fairly said to have usurped Broadway as the
main highway of the upper city—tremendous. You begin to compute
what must be the rental values upon this proud section of Fifth
avenue, as it climbs Murray Hill from Thirty-fourth street to Forty-
second street, when Katherine interrupts you once again. She knows
her New York thoroughly indeed.
"Do you notice that house?" she demands.

You follow her glance to a very simple brick house, upon the
corner of an inconsequential side street. Beside it on Fifth avenue is
an open lot—of perhaps fifty feet frontage, giving to the avenue but
a plain brown wooden fence.

"A corking building lot," you venture, "Why don't they—"

"I expected you to say that," she laughs. "They have wanted to
build upon that lot—time and time again. But when they approach
the owner he laughs at them and declines to consider any offer. 'My
daughter has a little dog,' he says politely, 'It must have a place for
exercise.' We New Yorkers are an odd lot," she laughs. "You know
that the Goelets kept a cow in the lawn of their big house at
Broadway and Nineteenth street until almost twenty years ago—until
there was not a square foot of grass outside of a park within five
miles. And in New York the man who can do the odd thing
successfully is apt to be applauded. You could not imagine such a
thing in Boston or Baltimore or Philadelphia, could you?"

You admit that your imagination would fall short of such heights
and ask Katherine if you are going up to the far end of the 'bus run
—to that great group of buildings—university, cathedral, hospital,
divinity school—that have been gathered just beyond the
northwestern corner of Central Park.

"No, I think not," she quickly decides, "You know that Columbia
is not to New York as Harvard is to Boston. Harvard dominates
Boston, Columbia is but a peg in the educational system of New
York. The best families here do not bow to its fetich. They are quite
as apt to send their boys to Yale or Princeton—even Harvard."

"Then there's the cathedral and the Drive," you venture.

"We have a cathedral right here on Fifth avenue that is finished


and, in its way, quite as beautiful. And as for the Drive—it is merely
a rim of top-heavy and expensive apartment houses. The West Side
is no longer extremely smart. The truth of the matter is that we
must pause for afternoon tea."

You ignore that horrifying truth for an instant.

"What has happened to the poor West Side?" you demand.

Katherine all but lowers her voice to a whisper.

"Twenty years ago and it had every promise of success. It looked


as if Riverside Drive would surpass the Avenue as a street of fine
residences. The side streets were preëminently nice. Then came the
subway—and with it the apartment houses. After that the very nice
folk began moving to the side streets in the upper Fifties, the Sixties
and the Seventies between Park and Fifth avenues."

"Suppose that the apartment houses should begin to drift in


there—in any numbers?" you demand.

"Lord knows," says Katherine, and with due reverence adds:


"There is the last stand of the prosperous New Yorker with an old-
fashioned notion that he and his would like to live in a detached
house. The Park binds him in on the West, the tenement district and
Lexington avenue on the East—to the North Harlem and the equally
impossible Bronx. The old guard is standing together."

"There is Brooklyn?" you venture.

"No New Yorker," says Katherine, with withering scorn, "ever


goes publicly to Brooklyn unless he is being buried in Greenwood
cemetery."

* * * * *

Tea for you is being served in a large mausoleum of a white


hotel—excessively white from a profuse use of porcelain tiles which
can be washed occasionally—of most extraordinary architecture.
Some day some one is going to attempt an analysis of hotel
architecture in New York and elsewhere in the U.S.A. but this is not
the time and place. Suffice it to say here and now that you finally
found a door entering the white porcelain mausoleum. What a feast
awaited your eyes—as well as your stomach—within. Rooms of rose
pink and rooms of silver gray, Persian rooms, Japanese rooms,
French rooms in the several varieties of Louis, Greek rooms—Europe,
the ancients and the Orient, have been ransacked for the furnishing
of this tavern. And in the center of them all is a great glass-enclosed
garden, filled with giant palms and tiny tables, tremendous waiters
and infinitesimal chairs. A large bland-faced employé—who is a sort
of sublimated edition of the narrow lean hat-boys who we shall find
in the eating places of the Broadway theater districts—divests you of
your outer wraps. You elbow past a band and arrive at the winter
garden. A head waiter in an instant glance of steel-blue eyes decides
that you are fit and finds the tiniest of the tiny tables for you. It is so
far in the shade of the sheltering palm that you have to bend almost
double to drink your tea—and the orchestra is rather uncomfortably
near.
Washington Square and its lovely Arch—New York

Katherine might have taken you to other tea dispensaries—an


unusual place in a converted stable in Thirty-fourth street, another
stable loft in West Twenty-eighth—dozens of little shops, generally
feminine to an intensified degree, which combine the serving of tea
with the vending of their wares. But she preferred the big white
hotel.

"Tea at the Plaza is so satisfactory and so restful," she says, as


you dodge to permit two ladies—one in gray silk and the other in a
cut of blue cloth that gives her the contour of a magnified frog—to
slip past you without knocking your tea out of your untrained
fingers. "We might have gone to the Manhattan—but it's so filled
with young girls and the chappies from the schools—the Ritz is
proper but dull, so is Sherry's—all the rest more or less impossible."

She rattles on—the matter of restaurants is always dear to the


New York heart. You ignore the details.
"But why?" you demand.

"Why what?" she returns.

"Why tea?"

You explain that afternoon tea in its real lair—London—in a sort


of climatic necessity. The prevalence of fog, of raw damp days,
makes a cup of hot tea a real bracer—a stimulant that carries the
human through another two or three hours of hard existence until
the late London dinner. The bracing atmosphere of New York—with
more clear days than any other metropolitan city in the world—does
not need tea. You say so frankly.

"I suppose you are right," Katherine concedes, "but we have


ceased in this big city to rail at the English. We bow the knee to
them. The most fashionable of our newest hotels and shops run—
absurdly many times—to English ways. And afternoon tea has long
since ceased to be a novelty in our lives. Why, they are beginning to
serve it at the offices downtown—just as they do in dear old
London."

You swallow hard—some one has recommended that to you as a


method of suppressing emotion—for polite society is never
emotional.

V
Dinner is New York's real function of the day. And dinner in New
York means five million hungry stomachs demanding to be filled. The
New York dinner is as cosmopolitan as the folk who dwell on the
narrow island of Manhattan and the two other islands that press
closely to it. The restaurant and hotel dinners are as cosmopolitan as
the others. Of course, for the sake of brevity, if for no other reason,
you must eliminate the home dinners—and read "home" as quickly
into the cold and heavy great houses of the avenue as into the little
clusters of rooms in crowded East Side tenements where poverty is
never far away and next week's meals a real problem. And
remember, that to dine even in a reasonably complete list of New
York's famous eating places—a new one every night—would take
you more than a year. At the best your vision of them must be
desultory.

Six o'clock sees the New York business army well on its way
toward home—the seething crowds at the Brooklyn bridge terminal
in Park Row, the overloaded subway straining to move its fearful
burden, the ferry and the railroad terminals focal points of great
attractiveness. To make a single instance: take that division of the
army that dwells in Brooklyn. It begins its march dinnerward a little
after four o'clock, becomes a pushing, jostling mob a little later and
shows no sign of abatement until long after six. Within that time the
railroad folk at the Park Row terminal of the old bridge have
received, classified and despatched Brooklynward, more than one
hundred and fifty thousand persons—the population of a city almost
the size of Syracuse. And the famous old bridge is but one of four
direct paths from Manhattan to Brooklyn.

Six o'clock sees restaurants and cafés alight and ready for the
two or three hours of their really brisk traffic of the day. There are
even dinner restaurants downtown, remarkably good places withal
and making especial appeal to those overworked souls who are
forced to stay at the office at night. There are bright lights in
Chinatown where innumerable "Tuxedos" and "Port Arthurs" are
beginning to prepare the chop-suey in immaculate Mongolian
kitchens. But the real restaurant district for the diner-out hardly
begins south of Madison square. There are still a very few old hotels
in Broadway south of that point—a lessening company each year—
one or two in close proximity to Washington square. Two of these
last make a specialty of French cooking—their table d'hôtes are
really famous—and perhaps you may fairly say when you are done
at them that you have eaten at the best restaurants in all New York.
From them Fifth avenue runs a straight course to the newer hotels
far to the north—a silent brilliantly lighted street as night comes
"with the double row of steel-blue electric lamps resembling torch-
bearing monks" one brilliant New York writer has put it. But before
the newest of the new an intermediate era of hotels, the Holland,
the nearby Imperial and the Waldorf-Astoria chief among these. The
Waldorf has been from the day it first opened its doors—more than
twenty years ago—New York's really representative hotel. Newer
hostelries have tried to wrest that honor from it—but in vain. It has
clung jealously to its reputation. The great dinners of the town are
held in its wonderful banqueting halls, the well-known men of New
York are constantly in its corridors. It is club and more than club—it
is a clearing-house for all of the best clubs. It is the focal center for
the hotel life of the town.

There is an important group of hotels in the rather spectacular


neighborhood of Times square—the Astor, with its distinctly German
flavor, and the Knickerbocker which whimsically likes to call itself
"the country club on Forty-second street" distinctive among them.
And ranging upon upper Fifth avenue, or close to it, are other
important houses, the Belmont, the aristocratic Manhattan, the ultra-
British Ritz-Carlton, the St. Regis, the Savoy, the Netherland, the
Plaza, and the Gotham. In between these are those two impeccable
restaurants—so distinctive of New York and so long wrapped up in
its history—Sherry's and Delmonico's.

Over in the theatrical brilliancy of Broadway up and down from


Times square are other restaurants—Shanley's, Churchill's, Murray's
—the list is constantly changing. A fashionable restaurant in New
York is either tremendously successful—or else, as we shall later see,
they are telephoning for the sheriff. And the last outcome is apt
more to follow than the first. For it is a tremendous undertaking to
launch a restaurant in these days. The decorations of the great
dining-rooms must rival those of a Versailles palace while the so-
called minor appointments—silver, linen, china and the rest must be
as faultless as in any great house upon Fifth avenue. The first cost is
staggering, the upkeep a steady drain. There is but one opportunity
for the proprietor—and that opportunity is in his charges. And when
you come to dine in one of these showy uptown places you will find
that he has not missed his opportunity.

All New York that dines out does not make for these great places
or their fellows. There are little restaurants that cast a glamour over
their poor food by thrusting out hints of a magic folk named
Bohemians who dine night after night at their dirty tables. There are
others who with a Persian name seek to allure the ill-informed, some
stout German places giving the substantial cheer of the Fatherland,
beyond them restaurants phrasing themselves in the national dishes
and the cooking of every land in the world, save our own. For a real
American restaurant is hard to find in New York—real American
dishes treats of increasing rarity. A great hotel recently banished
steaks from its bills-of-fare, another has placed the ban on pie; and
as for strawberry short-cake—just ask for strawberry short-cake. The
concoction that the waiter will set before you will leave you
hesitating between tears and laughter—ridicule for the pitiful
attempts of a French cook and tears for your thoughts of the tragedy
that has overwhelmed an American institution. Some day some one
is going to build a hotel with the American idea standing back of it
right in the heart of New York. He is going to have the bravery or
the patriotism to call it the American House or the United States
Hotel or Congress Hall or some other title that means something
quite removed from the aristocratic nomenclature that our modern
generation of tavern-keepers have borrowed from Europe without
the slightest sense of fitness; and to that man shall be given more
than mere riches—the satisfaction that will come to him from having
accomplished a real work.

The truth of the matter is that we have borrowed more than


nomenclature from Europe. We have taken the so-called "European
plan" with all of its disadvantages and none of its advantages. We
have done away with the stuffy over-eating "American plan" and
have made a rule of "pay-as-you-go" that is quite all right—and is
not. For to the simple "European plan" has recently been added
many complications. In other days the generosity of the portions in a
New York hotel was famous. A single portion of any important dish
was ample for two. Your smiling old-fashioned waiter told you that.
The waiter in a New York restaurant today does not smile. He merely
tells you that the food is served "per portion" which generally means
that an unnecessary amount of food is prepared in the kitchen and
sent from the table, uneaten, as waste. And a smart New York
restauranteur recently made a "cover charge" of twenty-five cents
for bread and butter and ice-water. Others followed. It will not be
long before a smarter restauranteur will make the "cover charge"
fifty cents, and then folk will begin streaming into his place. They
don't complain. That's not the New York way.

They do not even complain of the hat-boys—bloodthirsty little


brigands who snatch your hat and other wraps before you enter a
restaurant. The brigands are skillfully chosen—lean, hungry little
boys every time, never fat, sleek, well-fed looking little boys. They
are employed by a trust, which rents the "hat-checking privilege"
from the proprietor of the hotel or restaurant. The owner of the trust
pays well for these privileges and the little boys must work hard to
bring him back his rental fees and a fair profit beside.

Leave that to them. Emerge from a restaurant, well-fed and at


peace with the world and deny that lean-looking, swarthy-faced,
black-eyed boy a quarter if you can—or dare. A dime is out of the
question. He might insult you, probably would. But a quarter buys
your self-respect and the head of the trust a share in his new motor
car. The lean-looking boy buys no motor cars. He works on a salary
and there are no pockets in his uniform. There is a stern-visaged
cicerone in the background and to the cicerone roll all the quarters,
but the New Yorker does not complain—save when he reaches Los
Angeles or Atlanta or some other fairly distant place and finds the
same sort of highway brigandage in effect there.
VI
After the dinner and the hat-boy—the theater. You suggest the
theater to Katherine. She is enthusiastic. You pick the theater. It is
close at hand and you quickly find your way to it. A gentleman,
whose politeness is of a variety, somewhat frappé, awaits you in the
box-office. A line of hopeful mortals is shuffling toward him, to
disperse with hope left behind. But this anticipates.

You inquire of the man in the box-office for two seats—two


particularly good seats. You remember going to the theater in
Indianapolis once upon a time, a stranger, and having been seated
behind the fattest theater pillar that you could have ever possibly
imagined. But you need not worry about the pillars in this New York
playhouse. The box-office gentleman, whose thoughts seem to be a
thousand miles away, blandly replies that the house is sold out.

"So good?" you brashly venture. You had not fancied this
production so successful. He does not even assume to hear your
comment. You decide that you will see this particular play at a later
time. You suggest as much to the indifferent creature behind the
wicket. He replies by telling you that he can only give you tickets for
a Monday or Tuesday three weeks hence—and then nothing ahead
of the seventeenth row. Can he not do better than that? He cannot.
He is positive that he cannot. And his positiveness is Gibraltarian in
its immobility. A faint sign of irritation covers his bland face. He
wants you to see that you are taking too much of his time.

Katherine saves the situation. She whispers to you that she


noticed a little shop nearby with a sign "Tickets for all Theaters"
displayed upon it.

"You know they abolished the speculators two years ago," she
explains.
You move on to the little shop with the inviting sign. The
gentleman behind its counters has manners at least. He greets you
with the smile of the professional shopkeeper.

"Have you tickets for 'The Giddiest Girl'?" you inquire.

He smiles ingratiatingly. Of course he has, for any night and


anywhere you wish them.

"What is the price of them?"

You are not coldly commercial but, despite that smile, merely
apprehensive. And you are beginning to understand New York.

"Four dollars."

Not so bad at that—just the box-office price. You bring out four
greasy one-dollar bills. His eyes fixed upon them, he places a ticket
down upon the counter.

"There—there are two of us," you stammer.

He does not stammer.

"Do you think that they are four dollars a dozen?" he sallies.

You give him a ten dollar bill this time. You do not kick. Even
though the show is perfectly rotten and the usherette charges you
ten cents for a poorly printed program and scowls because you take
the change from her itching palm, do not complain. You would not
complain even if you knew that the man in the chair next to you
paid only the regular prices, because he happened to belong to the
same lodge as the cousin of the treasurer of the theater, while the
man in the chair next to Katherine paid nothing at all for his seat—
having a relative who advertises in the theater programs. You do not
kick. Complaint has long since been eliminated from the New York
code and you have begun to realize that.
* * * * *

After the theater, another restaurant—this time for supper—more


hat-boys, more brigandage but it is the thing to do and you must do
it. And you must do it well. Splendor costs and you pay—your full
proportion. If up in your home town you know a nice little place
where you can drop in after the show at the local playhouse and
have a glass of beer and a rarebit—dismiss that as a prevailing idea
in the neighborhood of Long Acre square. The White Light district of
Broadway can buy no motor cars on the beer and rarebit trade.
Louey's trade in his modest little place up home is sufficient to keep
him in moderate living year in and year out, but Louey does not
have to pay Broadway ground rent, or Broadway prices for food-
stuffs or Broadway salaries—to say nothing of having a thirst for a
bigger and faster automobile than his neighbor. And as we have
said, the opportunity for bankruptcy in the so-called "lobster
palaces" of Broadway runs high. As this is being written, one of the
most famous of them has collapsed.

Its proprietor—he was a smart caterer come east from Chicago


where he had made his place fashionable and himself fairly rich—for
a dozen years ran a prosperous restaurant within a stone-throw of
the tall white shaft of the Times building. And even if the heels were
the highest, the gowns the lowest, the food was impeccable and if
you knew New York at all you knew who went there. It was gay and
beautiful and high-priced. It was immensely popular. Then the
proprietor listened to sirens. They commanded him to tear down the
simple structure of his restaurant and there build a towering hotel.
He obeyed orders. With the magic of New York builders the new
building was ready within the twelvemonth. It represented all that
might be desired—or that upper Broadway at least might desire—in
modern hotel construction.

But it could not succeed. A salacious play which made a


considerable commercial success took its title from the new hotel
and called itself "The Girl from R——'s." That was the last straw. It
might have been good fun for the man from Baraboo or the man
from Jefferson City to come to New York and dine quietly and
elegantly at R——'s, but to stop at R——'s hotel, to have his mail
sent there, to have the local paper report that he was registered at
that really splendid hostelry—ah, that was a different matter, indeed.
Your Baraboo citizen had some fairly conservative connections—
church and business—and he took no risks. The new hotel went
bankrupt.A
A Another hotel man has just taken the property. His first
step has been to change its name and, if possible, its
reputation. E. H.

Beer and rarebits, indeed. Sam Blythe tells of the little group of
four who went into a hotel grillroom not far from Forty-second street
and Broadway, who mildly asked for beer and rabbits.

"We have fine partridges," said the head-waiter, insinuatingly.

"We asked for beer and rabbits," insisted the host of the little
group. He really did not know his New York.

"We have fine partridges," reiterated the head-waiter, then


yawned slightly behind his hand. That yawn settled it. The head of
the party was bellicose. He lost his temper completely. In a few
minutes an ambulance and a patrol wagon came racing up
Broadway. But the hotel had won. It always does.

* * * * *

One thing more—the cabaret. We think that if you are really


fond of Katherine, and Katherine's reputation, you will avoid the
restaurants that make a specialty of the so-called cabarets. Really
good restaurants manage to get along without them. And the very
best that can be said of them is that they are invariably indifferently
poor—a mélange contributed by broken-down actors or actresses, or
boys or girls stolen from the possibilities of a really decent way of
earning a living. As for the worst, it is enough to say that the
familiarity that begins by breeding contempt follows in the wake of
the cabaret. It may be very jolly for you, of a lonely summer evening
in New York and forgetting all the real pleasures of a lonely summer
night in the big town—wonderful orchestral concerts in Central Park,
dining on open-air terraces and cool quiet roofs, motoring off to
wonderful shore dinners in queer old taverns—to hunt out these
great gay places in the heart of the town. Easy camaraderie is part
and parcel of them. But you will not want such comrades to meet
any of the Katherines of your family. And therein lies a more than
subtle distinction.

VII
It has all quite dazed you. You turn toward Katherine as you ride
home with her in the taxicab—space forbids a description of the
horrors and the indignities of the taxicab trust.

"Is it like this—every night?" you feebly ask.

"Every night of the year," she replies. "And typical New Yorkers
like it."

That puts a brand-new thought into your mind.

"What is a typical New Yorker?" you demand.

"We are all typical New Yorkers," she laughs.

It is a foolish answer—of course. But the strange part of the


whole thing is that Katherine is right. Either there are no typical New
Yorkers—as many sane folk solemnly aver—or else every one who
tarries in the city through the passing of even a single night is a
typical New Yorker. How can it be else in a city who is still growing
like a girl in her teens, who adds to herself each year in permanent
population 135,000 human beings, whose transient population is
nightly estimated at over a hundred thousand? They are all typical
New Yorkers.

Here is Solomon Strunsky who has just arrived through Ellis


Island, scared and forlorn, with his scared and forlorn little family
trailing on behind, Solomon Strunsky all but penniless, and the
merciless home-sickness for the little faraway town in Polish hills
tearing at his heart. Is Solomon Strunsky less a typical New Yorker
than the scion of this fine old family which for sixty years lived and
died in a red-brick mansion close by Washington square? For in four
years Solomon Strunsky will be keeping his own little store in the
East Side, in another year he will be moving his brood up to a fine
new house in Harlem, an even dozen years from the entrance at Ellis
Island and you may be reading the proud patronymic of Strunsky
spelled along a signboard upon one of the great new commercial
barracks, which, not content with remaining downtown, began the
despoliation of Fifth avenue and its adjacent retail district. Can you
keep Solomon Strunsky out of the family of typical New Yorkers? We
think not.

We think that you cannot exclude the man who through some
stroke of fortune has accumulated money in a smaller city, and who
has come to New York to live and to spend it. There are many
thousands of him dwelling upon the island of Manhattan; with his
families they make a considerable community by itself. They are
good spenders, good New Yorkers in that they never complain while
the strings of their purses are never tightly tied. They live in smart
apartments uptown, at tremendously high rentals, keep at least one
car in service at all seasons of the year, dine luxuriously in luxurious
eating-places, attend the opera once a week or a fortnight, see the
new plays, keep abreast of the showy side of New York. They are
typical New Yorkers. In an apartment a little further down the street
—which rents at half the figure and comes dangerously near being
called a flat—is another family. This family also attends the new
plays, although it is far more apt to go a floor or even two aloft,
than to meet the speculator's prices for orchestra seats. It also goes
to the opera, and the young woman of the house is in deadly
earnest when she says that she does not mind standing through the
four or five long acts of a Wagnerian matinee, because the nice
young ushers let you sit on the floor in the intermissions. But this
family goes farther than the drama—spoken or sung. It is conversant
with the new books and the new pictures. That same young woman
swings the Phi Beta Kappa key of the most difficult institution of
learning on this continent. And she knows more about the trend of
modern art than half of the artists themselves. And yet she "goes to
business"—is the capable secretary of a very capable man
downtown.

These are typical New Yorkers. So are a family over in the next
block—theirs is frankly a flat in every sense of that despised word.
They have not been in the theater in a dozen years, never in one of
the big modern restaurants or hotels. Yet the head of that family is a
man whose name is known and spoken reverently through little
homes all the way across America. He is a worker in the church,
although not a clergyman, a militant friend of education, although
not an educator, and he believes that New York is the most
thoughtful and benevolent city in the world. And if you attempt to
argue with him, he will prove easily and smilingly, that he is right
and you—are just mistaken. He and his know their New York—a New
York of high Christian force and precept—and they, too, are New
Yorkers.

So, too, is Bliffkins and the little Bliffkins—although Bliffkins


holds property in a bustling Ohio city and votes within its precincts.
To tell the truth baldly, the Bliffkinses descend upon New York once
each year and never remain more than a fortnight. But they stop at
a great hotel and they are great spenders. Floor-walkers, head-
waiters, head-ushers know them. Annually, and for a few golden
days they are part of New York—typical New Yorkers, if you please.
And when they are gone other Bliffkinses, from almost every town
across the land, big and little, come to replace them. And all these
are typical New Yorkers.

What is the typical New Yorker?

Are the sane folk right when they say that he does not exist? We
do not think so. We think that Katherine in all her flippancy was
right. They are all typical New Yorkers who sojourn, no matter for
how little a time, within her boundaries. We will go farther still. You
might almost say that all Americans are typical New Yorkers. For
New York is, in no small sense, America. Other towns and cities may
publicly scoff her, down in their hearts they slavishly imitate her, her
store fronts, her fashions, her hotel and her theater customs, her
policemen, even her white-winged street cleaners. They publicly
laugh at her—down in their hearts they secretly adore her.
3

ACROSS THE EAST RIVER

Physically only the East river separates Brooklyn from Manhattan


island. The island of Manhattan was and still is to many folk the city
of New York. Across that narrow wale of the East river—one of the
busiest water-highways in all the world—men have thrust several
great bridges and tunnels. Politically Brooklyn and Manhattan are
one. They are the most important boroughs of that which has for
the past fifteen years been known as Greater New York.

But in almost every other way Manhattan and Brooklyn are


nearly a thousand miles apart. In social customs, in many of the
details of living they are vastly different, and this despite the fact
that the greater part of the male population of Brooklyn daily travels
to Manhattan island to work in its offices and shops and you can all
but toss a stone from one community into the other. The very fact
that Brooklyn is a dwelling place for New York—professional funny-
men long ago called it a "bed-chamber"—has done much, as we
shall see, toward building up the peculiar characteristics of the town
that stands just across the East river from the tip of the busiest little
island in the world.

Consider for an instant the situation of Brooklyn. It fills almost


the entire west end of Long island—a slightly rolling tract of land
between a narrow and unspeakably filthy stream on the north
known as Newtown creek and the great cool ocean on the south.
This entire tract has for many years been known as Kings county—its
name a slight proof of its antiquity. Many years ago there were
various villages in the old county—among them Greenpoint,
Bushwick, Williamsburgh, Canarsie, Flatbush, Gravesend and
Brooklyn. They were Dutch towns, and you can still see some
evidences of this in their old houses, although these are
disappearing quite rapidly nowadays. Brooklyn grew the most rapidly
—from almost the very day of the establishment of the republic.
Robert Fulton developed his steam-ferry and the East river ceased to
be the bugaboo it had always been to sailing vessels. Fulton ferry
was popular from the first. With the use of steam its importance
waxed and soon it was overcrowded. Another ferry came, another
and another—many, many others. They were all crowded, for
Brooklyn was growing, a close rim of houses and churches and
shops all the way along the bank of the East river from the Navy
Yard at the sharp crook of the river that the Dutch called the
Wallabout, south to the marshy Gowanus bay. Upon the river shore,
north of the Wallabout, was Williamsburgh, which was also growing
and which had been incorporated into a city. But when the horse-
cars came and men were no longer forced to walk to and from the
ferries or to ride in miserable omnibuses, Brooklyn and
Williamsburgh became physically one. Williamsburgh then gave up
its charter and its identity and became lost in the growth of a
greater Brooklyn. That was repeated slowly but surely throughout all
Kings county. Within comparatively recent years there came the
elevated railroad—at almost the same time the great miracle of the
Brooklyn bridge—and all the previous growth of the town was as
nothing. For two decades it grew as rapidly as ever grew a "boom-
town" in the West. The coming of electric city transportation, the
multiplying of bridges, the boring of the first East river tunnel, all
helped in this great growth. But the fairy web of steel that John A.
Roebling thrust across the busiest part of the East river marked the
transformation of Brooklyn—a transformation that did not end when
Brooklyn sold her political birthright and became part and parcel of
New York. That transformation is still in progress.
We have slipped into history because we have wanted you to
understand why Brooklyn today is just what she is. The submerging
of these little Dutch villages with their individual customs and
traditions has done its part in the making of the customs and
traditions of the Brooklyn of today. For Brooklyn today remains a
congregation of separate communities. You may slip from one to the
other without realizing that you have done more than pass down a
compactly built block of houses or crossed a crowded street.

And so it has come to pass that Brooklyn has no main street—in


the sense that about every other town in the United States, big or
little, has a main street. If you wish to call Fulton street, running
from the historic Fulton ferry right through the heart of the original
city and far out into the open country a main street, you will be
forced to admit that it is the ugliest main street of any town in the
land: narrow, inconsequential, robbed of its light and air by a low-
hanging elevated railroad almost its entire length. And yet right on
Fulton street you will find two department-stores unusually complete
and unusually well operated. New Yorkers come to them frequently
to shop. The two stores seem lost in the dreariness of Fulton street
—a very contradiction to that highway.

Yet Brooklyn is a community of contradictions. Here we have


called Fulton street a possible main street of Brooklyn, and yet there
is a street in the town, for the most part miles removed from it, that
is quite as brisk by day and the only street in the borough which has
any real activity at night. Like that great main-stem of Manhattan it
is called Broadway, and it is a wider and more pretentious street
than Fulton, although in its turn also encumbered with an elevated
railroad. But up and down Broadway there courses a constant traffic;
on foot, in automobiles, in trolley-cars. Broadway boasts its own
department-stores, some of them sizable, many hundreds of small
shops, cheap theaters—and some better—by the score. It is an
entertaining thoroughfare and yet we will venture to say that not
one in ten thousand of the many transients who come to New York
at regular intervals and who know the Great White Way as well as
four corners up at home, have ever stepped foot within it. We will go
further. Of the two million humans who go to make the population of
Brooklyn; a large part, probably half, certainly a third, have never
seen its own Broadway.

This speaks volumes for the provincialism of the great


community across the East river from Manhattan. Remember all this
while that it is a community of communities, self-centered and rather
more intent upon the problem of getting back and forth between its
homes and Manhattan than on any other one thing in the world. As
a rule, people live in Brooklyn because it is less expensive than
residence upon the island of Manhattan, more accessible and far
more comfortable than the Bronx or the larger cities of New Jersey
that range themselves close to the shore of the Hudson river. It is in
reality a larger and a better Jersey City or a Hoboken or a Long
Island City.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like