100% found this document useful (3 votes)
91 views

Learning TensorFlow.js Gant Laborde all chapter instant download

Gant

Uploaded by

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

Learning TensorFlow.js Gant Laborde all chapter instant download

Gant

Uploaded by

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

Get ebook downloads in full at ebookmeta.

com

Learning TensorFlow.js Gant Laborde

https://ebookmeta.com/product/learning-tensorflow-js-gant-
laborde/

OR CLICK BUTTON

DOWNLOAD NOW

Explore and download more ebook at https://ebookmeta.com


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

Learning TensorFlow.js: Powerful Machine Learning in


JavaScript 1st Edition Gant Laborde

https://ebookmeta.com/product/learning-tensorflow-js-powerful-machine-
learning-in-javascript-1st-edition-gant-laborde/

ebookmeta.com

Learning TensorFlow js Powerful Machine Learning in


JavaScript 1st Edition Gant Laborde

https://ebookmeta.com/product/learning-tensorflow-js-powerful-machine-
learning-in-javascript-1st-edition-gant-laborde-2/

ebookmeta.com

Practical Machine Learning in JavaScript: TensorFlow.js


for Web Developers 1st Edition Charlie Gerard

https://ebookmeta.com/product/practical-machine-learning-in-
javascript-tensorflow-js-for-web-developers-1st-edition-charlie-
gerard/
ebookmeta.com

Magic Hunted Charmaine Ross

https://ebookmeta.com/product/magic-hunted-charmaine-ross/

ebookmeta.com
Heart of the Shadow King (Bride of the Shadow King Book 3)
2nd Edition Sylvia Mercedes

https://ebookmeta.com/product/heart-of-the-shadow-king-bride-of-the-
shadow-king-book-3-2nd-edition-sylvia-mercedes/

ebookmeta.com

Undoing Multiculturalism Resource Extraction and


Indigenous Rights in Ecuador 1st Edition Carmen Martínez
Novo
https://ebookmeta.com/product/undoing-multiculturalism-resource-
extraction-and-indigenous-rights-in-ecuador-1st-edition-carmen-
martinez-novo/
ebookmeta.com

Postcards in the Sand 1st Edition Brynn Paulin

https://ebookmeta.com/product/postcards-in-the-sand-1st-edition-brynn-
paulin/

ebookmeta.com

Guidance Part 2 Processes for Project Delivery 4th Edition


Dr Anne Kemp

https://ebookmeta.com/product/guidance-part-2-processes-for-project-
delivery-4th-edition-dr-anne-kemp/

ebookmeta.com

Suburban Sweatshops The Fight for Immigrant Rights 1st


Edition Jennifer Gordon

https://ebookmeta.com/product/suburban-sweatshops-the-fight-for-
immigrant-rights-1st-edition-jennifer-gordon/

ebookmeta.com
Grob’s Basic Electronics, 13th Edition Mitchel E. Schultz

https://ebookmeta.com/product/grobs-basic-electronics-13th-edition-
mitchel-e-schultz/

ebookmeta.com
Praise for Learning TensorFlow.js
What Gant has done with this book is to cut to the chase, and
teach you the important stuff you need to know while keeping you
firmly within the web developer role, using JavaScript and the
Browser.
Laurence Moroney, Lead AI Advocate, Google
Machine learning has the potential to influence every industry out
there. This book enables you to take your first steps with
TensorFlow.js, allowing any JavaScript developer to gain
superpowers in their next web application and beyond. This book
is a great introduction to machine learning using TensorFlow.js that
also applies what you learn with real world examples that are easy
to digest.
Jason Mayes, Senior Developer Relations Engineer for
TensorFlow.js at Google
Gant’s ability to navigate explaining the complexities of machine
learning while avoiding the pitfalls of complicated mathematics is
uncanny, and you’d be hard-pressed to find a better introduction to
data science using JavaScript.
Lee Warrick, Fullstack JavaScript Developer
I’m delighted to have read Learning TensorFlow.js. It is without
doubt a good way to get out of my comfort zone of backend
engineering and try out building some exciting frontend
applications, leveraging the power of the book’s content about
Tensorflow.js as the go-to framework for ML web applications.
Laura Uzcátegui, Software Engineer, Microsoft
This book serves as the right introduction to building small deep
learning models fit for web and mobile based applications. The
examples in the book along with the detailed explanation will make
your learning smooth and fun.
Vishwesh Ravi Shrimali, Engineer, Mercedes Benz R&D India
I wish that I’d had this book myself to learn neural networks and
TensorFlow.js in the past! Astonishingly simple and beautifully
written, it goes from zero to doing a full capstone project in 12
short chapters. A must-have in every library.
Axel Sirota, Machine Learning Research Engineer
This is a much-needed introduction to TensorFlow.js, with great
examples, amazing illustrations, and insightful quotes at the
beginning of each chapter. A must-read for anyone who’s serious
about doing AI with JavaScript.
Alexey Grigorev, Founder of DataTalks.Club
Machine learning for the web is still in its infancy, and books such
as the one you’re holding right now are super important. As a
machine learning engineer working on ML tools for the JavaScript
environment, my top recommendation for web developers seeking
to add ML to their projects is definitely LearningTensorFlow.js.
Rising Odegua, Cocreator of Danfo.js
Learning TensorFlow.js
Powerful Machine Learning in JavaScript

Gant Laborde
Learning TensorFlow.js
by Gant Laborde
Copyright © 2021 Gant Laborde. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North,
Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales
promotional use. Online editions are also available for most titles
(http://oreilly.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Acquisitions Editor: Jennifer Pollock

Development Editor: Michele Cronin

Production Editor: Caitlin Ghegan

Copyeditor: Kim Wimpsett

Proofreader: JM Olejarz

Indexer: Ellen Troutman-Zaig

Interior Designer: David Futato

Cover Designer: Karen Montgomery

Illustrator: Kate Dullea

May 2021: First Edition


Revision History for the First Edition
2021-05-07: First Release

See http://oreilly.com/catalog/errata.csp?isbn=9781492090793 for


release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
Learning TensorFlow.js, the cover image, and related trade dress are
trademarks of O’Reilly Media, Inc.
The views expressed in this work are those of the author, and do not
represent the publisher’s views. While the publisher and the author
have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and
the author disclaim all responsibility for errors or omissions, including
without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions
contained in this work is at your own risk. If any code samples or
other technology this work contains or describes is subject to open
source licenses or the intellectual property rights of others, it is your
responsibility to ensure that your use thereof complies with such
licenses and/or rights.
978-1-492-09079-3
[LSI]
Dedication
This book is dedicated
to the most infectious & gentle smile.
To the irrepressible spark & endless
joy of my heart. To my loving
daughter, I love you,
Mila.
Foreword
AI and machine learning are revolutionary technologies that can
change the world, but they can only do that if there are developers
using good APIs to take advantage of the advancements these
technologies bring.
One such advancement is the ability to run machine learning models
in the browser, empowering applications that act intelligently.
The rise of TensorFlow.js tells me that AI has arrived. It’s no longer
exclusively in the realm of data scientists with supercomputers; it’s
now accessible to the millions of developers who code in JavaScript
daily. But there’s a gap. The tools and techniques for building models
are still very much in the hands of those who know the mysteries of
Python, NumPy, graphics processing units (GPUs), data science,
feature modeling, supervised learning, tensors, and many more
weird and wonderful terms that you probably aren’t familiar with!
What Gant has done with this book is to cut to the chase, teaching
you the important stuff you need to know while keeping you firmly
within the web developer role, using JavaScript and the browser.
He’ll introduce you to the concepts of AI and machine learning with a
clear focus on how they can be used in the platform you care about.
Often, I hear developers ask, when wanting to use machine learning,
“Where can I find stuff that I can reuse? I don’t want to learn to be an
ML engineer just to figure out if this stuff will work for me!”
Gant answers that question in this book. You’ll discover premade
models that you can take lock, stock, and barrel from TensorFlow
Hub. You will also learn how to stand on the shoulders of giants by
taking selected portions of models built using millions of items of
data and many thousands of hours of training, and see how you can
transfer learn from them to your own model. Then, just drop it into
your page and have JavaScript do the rest!
Developers ask, “How can I use machine learning on the platform I
care about without extensive retraining?”
This book goes deeply into that — showing you how to bridge the
gap between JavaScript and models that were trained using
TensorFlow. From data conversion between primitives and tensors to
parsing output probabilities into text, this book guides you through
the steps to integrate tightly with your site.
Developers ask me, “I want to go beyond other people’s work and
simple prototypes. Can I do that as a web developer?”
Again, yes. By the time you’ve finished this book, not only will you be
familiar with using models, but Gant will give you all the details you
need to create them yourself. You’ll learn how to train complex
models such as convolutional neural networks to recognize the
contents of images, and you’ll do it all in JavaScript.
A survey in October 2020 showed that there were 12.4 million
JavaScript developers in the world. Other surveys showed that there
are about 300,000 AI practitioners globally. With the technology of
TensorFlow.js and the skills in this book, you, dear JavaScript
developer, can be a part of making AI matter. And this book is a
wonderful, wonderful place to start.
Enjoy the journey!

Laurence Moroney
March 2021
Preface

“If you choose not to decide, you still have made a choice.”
— Geddy Lee (Rush)
Let’s Do This
Hindsight is always 20/20. “I should have bought some bitcoin when
it was at X” or “If only I had applied at startup Y before they became
famous.” The world is replete with moments that define us for better
or worse. Time never goes backward, but it echoes the lessons of
our younger choices as we go forward. You’re lucky enough to have
this book and this moment to decide.
The foundations of the software industry are changing due to
artificial intelligence. The changes will ultimately be decided by those
who grab hold and shape the world into what it will be tomorrow.
Machine learning is an adventure into new possibilities, and when it
is unified with the broad exposure of JavaScript, the limits drift away.
As I like to tell my audience in my talks on AI, “You didn’t come this
far in creating software only to come this far.” So let’s get started and
see where our imagination takes us.
Why TensorFlow.js?
TensorFlow is one of the most popular machine learning frameworks
on the market. It’s supported by Google’s top minds and is
responsible for powering many of the world’s most influential
companies. TensorFlow.js is the indomitable JavaScript framework of
TensorFlow and is better than all the competitors. In short, if you
want the power of a framework in JavaScript, there’s only one choice
that can do it all.
Who Should Read This Book?
Two primary demographics will enjoy and benefit from the contents
of this book:
The JavaScript developer
If you’re familiar with JavaScript, but you’ve never touched
machine learning before, this book will be your guide. It leans
into the framework to keep you active in pragmatic and exciting
creations. You’ll comprehend the basics of machine learning
with hands-on experience through the construction of all kinds of
projects. While we won’t shy away from math or deeper
concepts, we also won’t overly complicate the experience with
them. Read this book if you’re building websites in JavaScript
and want to gain a new superpower.
The AI specialist
If you’re familiar with TensorFlow or even the fundamental
principles of linear algebra, this book will supply you with
countless examples of how to bring your skills to JavaScript.
Here, you’ll find various core concepts illustrated, displayed, and
portrayed in the TensorFlow.js framework. This will allow you to
apply your vast knowledge to a medium that can exist efficiently
on edge devices like client browsers or the Internet of Things
(IoT). Read this book and learn how to bring your creations to
countless devices with rich interactive experiences.
This book requires a moderate amount of comfort in reading and
understanding modern JavaScript.
Book Overview
When outlining this book, I realized I’d have to make a choice. Either
I could create a whirlwind adventure into a variety of applications of
machine learning and touch on each with small, tangible examples,
or I could choose a single path that tells an ever-growing story of the
concepts. After polling my friends and followers, it was clear that the
latter was needed. To keep this book sane and under a thousand
pages, I chose to remove any JavaScript frameworks and to focus
on a singular pragmatic journey into the visual aspects of AI.
Each chapter ends with questions and a particular challenge for you
to test your resolve. The Chapter Challenge sections have been
carefully constructed to solidify lessons into your TensorFlow.js
muscle memory.
The Chapters
Chapters 1 and 2 begin with core concepts and a concrete example.
This yin-and-yang approach reflects the teaching style of the book.
Each chapter builds on the lessons, vocabulary, and functions
mentioned in previous chapters.
Chapters 3 through 7 give you the vision to understand and
implement existing AI tools and data. You’ll be able to create
impressive libraries as well as employ models in projects that were
created by scores of data scientists.
Chapters 8 through 11 begin giving you the power of creation in
TensorFlow.js. You’ll be able to train models in JavaScript, and I
firmly believe this is one of the most fun and exciting sections of the
entire book.
Chapter 12 is the final challenge. The final chapter presents a
capstone project that empowers you to take everything the book has
to offer and express it using your own faculty.
Other documents randomly have
different content
there lay close before her the further revelations that were to be
made when touch, sight, and muscle sense could be focused all
together on the objects about her. It was a wonderful sight to see, as
the baby pressed forward to the new understanding, eager, amazed,
and absorbed.
VII
SHE LEARNS TO GRASP, AND DISCOVERS THE
WORLD OF THINGS

The baby had finished her first quarter year. A few days before, as
we have seen, she had looked for a person out of sight; and now,
just at the end of the third month, she showed that she could bring
together the testimony of sight and hearing, by turning to look in the
direction of a sound.
Here seems evidence that by this time (whether she had done so
before or not) she “externalized” her impressions more or less: that
is, when waves of sound struck on her tympanum, or of light on her
retina, she did not simply feel the resulting sensation, but threw it
back, so to speak, along the line of the wave, and seemed to herself
to perceive something outside there, away from her. For when she
looked around, seeking what she did not yet see, expecting sight
sensations and hearing sensations to come from the same source, it
is impossible to think she did not have a feeling of something really
there, outside herself.
Step by step with the sense of outsideness there must have come a
sense of insideness, of self, for the two are only opposite sides of
one feeling—that is, the feeling of difference between oneself and
the outer world. We must not suppose that before the baby
externalized her impressions she felt everything as happening inside
her: she must have just felt things, with no inside or outside about it.
This may seem impossible, but really the sense of insideness and
outsideness is not hard to upset, even at our time of life. Dizziness or
mental shock will do it. Sometimes on waking from deep sleep we
find our sense of a separate bodily self gone, and gather it slowly
back. We may almost lose ourselves by lying idly, without thought or
care, in some great, continuous sound, like the roar of a cataract, till
we do not know which is ourself and which is the outward sound.
Mystics and ecstatics have made an art of changing the bodily
feelings by fasting and other means, till the usual marks of difference
among impressions, by which we externalize some and refer others
to our own bodies, are lost; and with them the sense of being in the
body, surrounded by an outer world.
Though she externalized sight and sound, it is not likely that the
baby at this stage distinguished external and internal in touch
impressions, unless about her face. She had not at all learned the
bounds of her own body yet. Below her arms, her control of it was
almost nothing. She could not turn herself over. She had never
passed her hands over her own surface, and knew it only by chance
touches. She understood so little her relation even to her hands,
which were fairly under control, that when they met by chance, each
hand would seize the other, and try to take it to her mouth. She was
often aggrieved by the unexpected result when she tried to flourish
her arm and go on sucking her thumb at the same time, and could
not imagine what had suddenly snatched the cherished thumb away.
Her feeling of herself must have been very different from ours: more
like that of a conventional cherub, all but her head dissolved away
into oneness with the outside world.
Did she, then, seeing the vision of the world, see it as a world of
things—solid objects, visible and tangible? Probably not. Her whole
behavior showed that she had never blended the feel of a thing and
the look of a thing into the perception of the thing itself. If her body
was touched anywhere, she never looked toward the place to see
what touched her. When she groped on her tray, she seemed to be
merely repeating motions that had formerly brought sensations, not
seeking for things that she supposed were there; she never looked
for them, nor even looked at them as she held them; she seemed to
have no suspicion that the feeling in her hand was due to a visible
object there.
Nor could she well have had any idea of an object, even as one may
get it from touch alone, without sight; for she did not feel over the
things she held—she was conscious only of the part that touched
her. If she laid hold of her rattle one day by one part, and another
day by another, she could not have known it was the same object,
except as she learned a little about it in fumbling for a better hold. In
short, the things she touched and held can hardly have been to her
definite objects, but only disjointed touch and weight sensations.
With no more material than this, children born blind do build up in
time the idea of a world of things; but seeing children have a much
quicker and completer way.
Just at the end of the third month the baby had once gazed at her
rattle as she held it in her hand; but it was not till the second week of
the fourth month that she seemed really to learn that when she felt
the familiar touch in her hand, she could see something by looking.
Then her eyes began to rest on things while she picked them up; but
in a blank and passive way—the eyes looking on like outsiders, while
the awkward little hands fumbled just as they would have done in the
dark. The baby seemed to have no idea that what she saw was the
same thing as what she felt.
There was about a fortnight of this. Then, on one great day, when
three weeks of the month had passed, the baby looked at her
mother’s hand, held up before her, and made fumbling motions
toward it, keeping her eyes on it, till her hand struck it; then took hold
of it. She had formed an association between the sight of an object
and the groping movement of her hand toward it.
It was not till the last week of the month that she put out her hand
directly to the thing she wanted, instead of clawing vaguely toward it;
and even then it was doubtfully done. Still, it was real grasping, by
guidance of the eye. She was coming to realize that what she saw
was one with what she could feel; that there were things, which
could be reached for and got hold of. That is, the sight-motor series
and the touch-motor series were coalescing at last, and giving the
baby a world of objects. She had an immensity to learn as to their
form, weight, distance, and all that; but she had the key now for
learning it.
The discovery of the new quality of tangibility in the visible world
must have been gradual, however, and her new power of grasping
hardly more at first than a blind use of association. In the next
fortnight she grasped doubtfully, depending only partly on sight for
guidance. She would put out her hand uncertainly, with fingers
spread, not ready to grasp, and it was only when they touched the
object that her movement became confident. Sometimes both little
hands were brought cautiously down on either side of the thing she
wished to get hold of.
In this fortnight she grasped better with the mouth than with the
hands, and was more disposed to use it. She brought her mouth to
the nipple easily by sight. She dived at me with her head to get the
loose folds of my bodice into her mouth. In our arms, she would
attack our faces with a sudden dive of her head and a funny doubling
up movement of her body, and would mouth them over with
satisfaction. One day, as she lay on her back, a rubber ring fell out of
her mouth, and lay encircling her nose, resting on its bridge and on
the upper lip; she made many efforts to reach it with her lips,
stretching her mouth open ridiculously, but had no idea of using the
little hands, which were fluttering wildly in helpless sympathy.
During this early period of grasping, the baby was far from
appreciating what a world of delight had opened to her. Her great
interest all the fourth month and on into the fifth was in the use of her
eyes, in those eager surveys of things that I have spoken of; and
absorbed in this, she had unconsciously and almost mechanically
gathered together the associations of sight and feeling and muscle
sense, till grasping had come about, merely as a more efficient way
of getting things into the mouth.
Professor Preyer and most other observers have tried to account for
this persistent drift of everything to the baby’s mouth by the theory of
taste association: the baby’s most agreeable experience has been
that of tasting milk, and so he connects all pleasure with the idea of
getting things to his mouth. This seems to me quite untenable. An
association between taste and the feeling of something in the mouth
would not be formed unless the two occurred together quite
regularly; and what with the washing out of a baby’s mouth each
time he is nursed, and the frequent stumbling in of his hands, and
later the deliberate sucking of fists, he finds tasteless objects there
oftener than milk. Again, it is not the movement of the hands up to
the mouth that would become associated with food, but rather the
feeling of being laid at the breast (which our baby did in fact
associate early with food, as I have related). And in the third place,
there is not the least evidence that taste is the most agreeable
experience of young babies; on the contrary, the tests go to show
that they have a low taste sensibility.
The craving of hunger, of course, is an intense feeling in babies, and
its satisfaction (rather than taste pleasure) is greatly enjoyed; but
except just at the hungry moment, they pay far more attention to
looking, and hearing, and feeling than to eating. Our baby, after the
first edge of hunger was off, was always ready to desert the breast to
look at something interesting. She would nurse a little, then throw
herself back on her mother’s arm to smile up into her face. She cried
quite as hard over being obliged to lie down, where she could not
look around her, as over being hungry; and getting her meal caused
no such marked signs of pleasure as light and motion, the bath, and
the free use of her own powers.
Some babies are hungrier than ours was, and some are like her; but
I think close observation would show all alike more taken up with
their higher powers than with food. And as all alike put everything
into their mouths when they first learn to grasp, we must find some
other reason for the act than food association.
If we regard it as an exercise of the sense of touch, in what is at the
time the main touch organ, we have an activity closely parallel with
the constant interest in the use of sight in the early months.
Observers have been misled by failing to realize that the mouth, not
the hand, is the primitive touch organ. The baby behaves with the
things in his mouth as if he was interested in feeling them, not in
eating them. He does not try to swallow them (though he may be
depended on to do it without trying, if they are small), but licks,
sucks, mumbles them about, and in every way gets the utmost touch
sensation out of them. Preyer saw a look of pleasure caused by
sucking a pencil, before the baby had ever tasted food, when he
could not have had the least taste association with the feeling. There
is plenty of evidence that the act of sucking (the muscular sensation
as well as that of touch) is in itself highly agreeable to babies.
I have spoken of the great and active interest, at this time, in
studying the visible world. By the end of the fourth month the baby
had certainly learned the look of many things, and was well aware
when it was in any way changed. In a strange room she would renew
the eager and surprised staring about which had nearly ceased in
familiar rooms; and if one of us appeared in a bonnet she would look
with curiosity and interest at our changed aspect. She doubtless
knew us all apart by this time, though she gave no clear evidence of
it, except in the case of grandpa, whom she often greeted with cries
of joy and flying hands.
From the middle of the fourth month she followed us constantly with
her eyes as we moved about. Her eyes were thus drawn to greater
distances, and her range of vision increased; before this she had
hardly noticed anything across the room. In the latter part of the
month she looked with especial curiosity at people’s faces on the
other side of the room, and I guessed that it was because they
looked so much smaller to her—as they would to us if we had not
learned to allow for the distance. A face fifteen feet away can be
completely hidden by a fifty cent piece held out at arm’s length; our
friends shrink to small dolls in our eyes every time they cross the
room, but we bring them up to their real size by trained imagination.
The baby, who had not yet the trained imagination, must have seen
strange shrinkings and swellings as people moved from her or
toward her, and as she was carried about the room.
She saw a complete change of appearance, too, each time any one
turned around, and each time she was carried from one side to
another of a person, or of a piece of furniture. We have become so
used to this that we do not notice it; but to the baby each side of an
object must have looked like an entirely new thing. I think it was
some time before she learned to associate together the different
sides and the different sizes of each object—all the aspects one
chair could take, for instance, gathering into one group in her mind,
and all the aspects a table or a person could take, into another; but
she was learning. It was an enormous piece of work for the baby
brain, but babies are not lazy, and she enjoyed it.
The changes that people went through, as they moved about, were
much more complicated than those of the furniture; but that only
made them the more interesting. No wonder that as soon as the
baby knew she could touch and feel what she saw, it was our faces
she dived for with especial zeal, to explore their surfaces with her
mouth; and a fortunate thing it is for the baby’s progress in
knowledge that mothers do not mind having great and moist liberties
taken with their faces. Our baby learned, too, at this time, with the
connivance of her grandfather, and afterward her father, to fix her
fingers in their beards and tug. This was doubtless educational, and
it brought still another interest into the number that gathered about
the faces of her fellow beings: but it led to trouble later, as her hands
grew quicker and stronger in clutching.
She was a joyous and sociable little being in those days, and while
her serious business was looking about and studying out the visible
world, or exploring with her mouth the feeling of things, her delight
was as always in people’s faces and attentions. She had become
charmingly responsive, and answered to nods and prattle and
cuddling with the gayest of smiles and crows, and lively flourishing of
arms and legs. From early in the month she acquired an ecstatic little
chuckle, and once or twice even broke into a genuine laugh when
she was played with a little more boisterously than usual.
For by this time, and more and more every week, she began to like a
frolic, and when she was tossed, rolled over, or slid down one’s
knee, she crowed and beamed and chuckled in high delight. She
was such a tiny baby for rough play that we tumbled her about most
gingerly, but she seemed ready for anything herself. She was a baby
singularly free from fear or nervous excitability, showing already
quite clearly the temperament she has carried through her later
childhood.
She was also physically strong, and once or twice in the fourth
month sat quite alone on some one’s lap. I do not count this real
sitting alone, however, for the lap gives under the baby’s weight, and
steadies her a little: one should not record sitting alone till the baby
has balanced successfully on a hard level, the floor or table. But as
far as strength of back was concerned, our baby was now evidently
ready to sit alone.
At this stage the babies of grandpa’s line have always been seated
on the floor in a horse-collar, as befitted farm babies; and this latest
one went into the collar at four months old, like the rest of us in our
day, and spent much of her fifth month sitting there, sucking or
brandishing her rattle, and looking happily about her. It is really a
comfortable seat for a baby not yet quite ready to sit alone. When
the collar is not brand new, one will of course scrub and disinfect it;
and it is the better in any case for a blanket or thick shawl thrown
over it. Also of course, one will never set a baby on the floor without
seeing that all possible drafts, under doors or about loose window
casings, are shut off with shawls and screens. Otherwise, there may
be pneumonia to fight.
I have just spoken of the baby’s boldness. She showed fear now and
then, however. About the middle of the fourth month she cried while
a caller was present, dressed in black, with a large hat. Ten days
later she was quite upset when her father leaned over suddenly,
bringing his face into view from one side. Here were the first eye
fears, considerably later than ear fears.
A still more advanced form of fear appeared two days later. The
baby had waked and cried alone in the dark for some minutes, and
when she was at last taken up, she had evidently become
frightened, and was not easily reassured; she kept leaning toward
her mother, and uttering troubled cries, and as it was some minutes
before her mother took her, she grew more and more disturbed, and
finally broke into a wail, and was soothed with difficulty, and all the
evening she was anxious and easily upset. The next night, waking
alone at the same hour, she began again to cry with the note of
fright.
Here was not yet fear in the sense of definite expectation of harm. It
was still purely instinctive, a sort of vague panic, from a sense of
unfamiliarity. The darkness no doubt contributed to this unfamiliarity,
but I do not think there was yet anything that could be called fear of
the dark. It is doubtless, however, in large part from such
experiences that fear of the dark is born; each one leaves its trace in
the nervous system, and associations of terror with darkness and
solitude are quickly formed. In these days of leaving babies to wail
themselves to sleep for the good of their souls, and the convenience
of mamma’s going out evenings, innumerable such associations
must be bred—and again the schoolbooks take the blame when in
later days the child proves nervous and excitable.
During the latter part of the fourth month, the baby was greatly
interested in making sounds, and the one that most delighted her
was a sort of harsh cawing or croaking, made deep in the throat, on
the vowel â. She would lie and utter this sound at intervals, by the
half hour, with deep satisfaction. But when she had not been making
it for some hours, she was apt to forget just how, and to get it too
high or low in the throat, producing an extraordinary collection of
squeaks and grunts. She usually hit it at last; but after repeated
losings, it became quite dissolved away among the many new ones
it had apparently given rise to.
Later, she took much pains over some imperfect lip sounds; she
would lie looking earnestly at me, draw her breath, gather her lips
into shape, and finally explode the sound with a great expenditure of
breath.
She made her little sounds often with an air of friendly response
when we prattled to her, giving back murmurs, croaks, and gurgles
for words. From the latter part of the fourth month, if we imitated to
her some of these sounds, she seemed to imitate them back. Preyer,
who records the same thing of his boy at the same age, thinks it
marks a most important epoch, the beginning of action guided by
ideas; but Baldwin, who considers the beginning of imitation even
more important than Preyer does, thinks it cannot be so early, and
that the repeating of the sounds must be mere coincidence.
This is likely enough, for a baby is always repeating his pet sounds,
and it is not safe to conclude that he means to imitate us, even if he
does chance to give back the same sound after us several times. But
as to action guided by ideas, we scarcely need wait for the first
imitation to see that. It appears in a simple form when the baby first
looks for an object out of sight. This our baby had done weeks
before, and by this time many of her actions seemed to be of
ideomotor type. The effort to recall her croak was an instance. In the
early weeks of the fifth month, she would seem to think suddenly of
one of her little sounds, and dash at it, bringing it out with a comical
doubling up of her body. In the same way she would have the happy
thought, “Fingers in mouth!” and up they would come with a jerk, her
head diving forward to meet them.
In the nineteenth week, she seemed to act once from something like
a definite memory. Her grandfather entered the room while she was
in her bath, and her usual joyous up and down movement of arms at
sight of him produced a novel and fascinating splashing. Next day
the baby splashed without suggestion, and again the next, looking
up to my face and smiling; and after that no one could teach her
anything about splashing. Yet even this was probably not really
memory, but an association formed by a single vivid occurrence.
During these weeks a note of real desire, unheard before, appeared
in her voice. Her face had at times, when she saw something new, or
when she gazed at us while we talked to her, an expression of
inquiry and effort to comprehend, with lips drawn in and brow tense.
No one could watch her and not see the beginnings of some sort of
mental life.
VIII
THE ERA OF HANDLING THINGS

She sprang into this era suddenly, within four days. It was not
infrequently thus, and perhaps more and more as the little brain grew
complex. Some power that had been slowly developing would leap
up into completion, unlocking a dozen other doors of mental life. To
put it physiologically, some one new connection established between
brain cells would bring a whole network of others into coöperation—
the more easily as ancestral nerve paths seemed often to open up at
a touch.
When the baby had passed ten days of her fifth month, she was still
grasping half mechanically. On the eleventh day, lying on her back,
she held her rattle above her and looked at it carefully. Her attention
had turned to the things that she grasped. She had come before to
the perception of a world of objects, but apparently only now to the
realization of it. And thereupon, that very day, I saw that she was no
longer using eyes and hands merely as means of getting mouth
sensations; she was holding objects, looking at them, and pulling
them about, for some moments, before they went to her mouth.
The pleasure of this handling seemed to be in the free movement of
the objects (seen and felt at the same time), not especially in the
touch sensations. When this new pleasure was exhausted, things
went to the mouth as before for the enjoyment of touch. It was long
before the fingers rivaled the lips in pure æsthetic touch enjoyment;
perhaps they never do, else the dandy would finger his cane knob,
instead of mouthing it, girls would smooth rose-leaves across their
finger tips, not their lips, and a kiss would have no higher rank than a
hand-clasp. But for grasping purposes the supremacy now passed
promptly over to the hands, and from this week the habit of grasping
with the mouth by head movements declined and disappeared.
In a few hours the baby was reaching for everything near her, and in
three days more her desire to lay hold on things was the dominant
motive of her life. Her grasping was still oftener with both hands than
one, and was somewhat slow, but always accurate. Some babies
learn to grasp more suddenly than she did, and often miss their aim;
but with her cautious method of bringing down her hands toward an
object from either side, penning it in between, she could hardly make
errors. The thing once corralled, she would pull it around, perhaps a
minute, then put it to her mouth.
It is an epoch of tremendous importance when the baby first, with
real attention, brings sight and touch and muscle feeling to bear
together on an object. “In a very deep sense,” says John Fiske, “all
human science is but the increment of the power of the eye, and all
human art is the increment of the power of the hand. Vision and
manipulation—these in their countless indirect and transfigured
forms are the two coöperating factors in all intellectual progress.”
And the first great result of this coöperation is the completion of
vision itself. It cannot be doubted that it is mainly by studying objects
with eye and hand together that we get our ability to see solid form.
A colt grasping his ear of corn with his teeth, even a puppy licking
and turning his bone all over, or a kitten tapping a spool to and fro
and hugging it in her paws, without losing sight of it—none of these
can bring the united powers of three senses to bear on an object so
perfectly as a monkey or human baby can, holding it in the most
convenient positions, turning it this way and that, seeing every part,
feeling it with finger tips and mouth; and it is doubtful if the
quadrupeds ever attain to as clear a sense of form as we do.
In these first days of the passion for grasping at things, the baby
reached for flat figures as readily as for solid objects; but (to look
ahead a little) she learned to discriminate with surprising ease, and
after the first week I have only three or four notes of her trying to pick
up such things as pictures on a page, roses on a quilt, shadows in
the sun. Yet I do not think this was because she gained quickly any
such sense of the difference between plane and solid form as we
have, but rather that she learned quickly to associate a certain look
about an object with the experience of being able to get hold of it.
The reason that I think so is that even weeks later, when she was six
months old, she showed signs of having no real ability to judge form
by the eye. At that age she turned a round cracker round and round
at her lips, trying to find the corner to bite, as she was used to doing
with square ones. And the only time she was ever taken in by a flat
figure afterward was when (at nine months old) she tried a long time
to capture the swaying shadow of a rope end on the deck of a yacht;
things that moved could always be taken hold of in her experience,
and she went solely by experience, not by any general ideas of form.
But such general ideas really require a good deal of development of
reason—so much that it is likely the lower animals never rise to
them. We must think of the baby’s seeing, therefore, as rounding out
but slowly to full equality with ours in such matters as estimates of
form, distance, and size, where much experience and some reason
are required.
To go back to those swift four days in which the baby came into
realization of her power of using hands and eyes together,—they had
been preceded by a marked advance in the use of eyes alone (or
jointly with the sense of motion in being carried about) to get the
relations of things about her more clearly arranged in her mind. The
day before the baby held up her rattle to look at, she had declined to
go to sleep in her mother’s arms, and kept lifting her head to look at
me, till I crossed the room and put myself out of sight. Presently she
lifted her head again, turned round, and searched persistently the
quarter of the room toward which she had seen me disappear. She
had gained much in sense of direction and in association of ideas
when she could look along the line in which I had been seen to move
moments before, expecting to see me somewhere there.
Later, the same day, she sat in my lap, watching with an intent and
puzzled face the back and side of her grandmother’s head. Grandma
turned from her knitting and chirruped to her, and the little one’s jaw
dropped and her eyebrows went up with an expression of blank
surprise. Presently I began to swing her on my foot, and at every
pause in the swinging she would sit gazing at the puzzling head till
grandma turned, and nodded or chirruped to her; then she would
turn away satisfied and want more swinging.
Here we seem to get a glimpse of the process I have spoken of, by
which the baby gradually associates together the front and rear and
side aspects of a person or thing, till at last they coalesce together in
his mind as all one object. At first amazed to see the coil of silver
hair and the curve of cheek turn suddenly into grandma’s front face,
the baby watched for the repetition of the miracle till it came to seem
natural, and the two aspects were firmly knit together in her mind.
She began, too, to watch people’s motions carefully for long spaces
of time—all through the process of setting the table, for instance—
with a serious little face, and an attention so absorbed that it was
hardly possible to divert her if one tried (which one ought not to do,
for power of attention is a precious attainment, and people have no
business to meddle with its growth for their own amusement). When
her mother’s dark-eyed sister had a little reception in consequence
of having married the minister, baby was in the thick of it, watching
first the preparations, and then the comings and goings of people,
with the closest attention and the deepest enjoyment, cheerfully
willing to have her meals postponed, her nap broken, anything, if the
fun would only go on.
There was a decided advance, too, in her acquaintance with her own
body. Sitting as usual in her horse-collar, she was bending herself
back over it, a thing that she had done before; but to-day she kept it
up so persistently, and bent herself back with such exertion, that at
last the back of her head touched the floor. She righted herself with
an expression of great surprise. Evidently she had been
experimenting in new muscular sensations only, and (as happens to
all experimenters sometimes) had got an extra result that she did not
bargain for and did not understand. She bent back again, with her
head screwed around to see what had given her the touch. In this
position, she did not reach the floor. She sat up again, looked at me
with a perplexed face, and tried it over, a full dozen times, till her
mother picked her up to stop it, on the ground that the baby was
more valuable than the experiment, and that she would break her
little back. For days, however, the baby returned to the investigation,
doubling herself back over the arm of any one who held her till her
head hung straight down, or over the horse-collar till it rested on the
floor.
We may perhaps fairly guess that in this incident she had for the first
time discovered the back of her head as a part of herself, and any of
us might well be surprised to find himself extending off behind into
space that way, if he had never known about it before. The baby had
of course felt daily and hourly touches on the back of her head, from
pillow and floor and lap, from cap and hair brush; but all her previous
behavior, and her surprise now, indicate that this was the first time
she had externalized these touches—which implies also the first time
she had felt herself as receiving them.
One of the first things she did when she began grasping zealously
was to seize her own toes, and she bent her foot forward on the
ankle to bring it better in reach. This may have been a purely
instinctive coöperating act at first, but it helped on the control of feet
and legs, and the recognition of them as parts of herself—the more
as they were now for some time favorite playthings every time the
baby was undressed.
Another significant movement the next day, also brought about by
the advance in grasping, was the first attempt to scramble forward as
she lay on her stomach, to get hold of something—a futile effort, but
the forerunner of creeping.
These days of rapid unfolding were joyous days. The baby laughed
aloud more than ever before, and her daily frolics were as necessary
to her as her meals, and were fretted for as persistently if she did not
get them. The door of communion with fellow beings, too, was
trembling on its hinges, ready to come ajar. The little thing began to
look up into our faces as if for sympathy in pleasure or perplexity, as
I have mentioned in the case of her surprise at discovering the back
of her head; she did it laughing when she splashed in the bath, and
with smiles of satisfaction when she listened to the piano. When her
mother held out her arms to take her, she learned to put forward her
little hands in response; and on the same day she took up the
instinctive gesture of stretching out her arms toward an object in
desire—always, I suspect (records are wanting), the next gesture
after turning away the head. Neither of these reaching gestures was
as yet used intentionally to convey ideas, but both entered later into
genuine sign language. Both seem to grow naturally out of grasping
movements.
In the baby’s absorption in grasping, most of her little sounds were
abandoned; but she clung to a favorite long gurgle, and used it with
an air of amiable response when people talked or nodded to her,
often kicking her legs in the air or flinging up her arms, by way of
emphasis. Sometimes she would look earnestly into your face and
address you with the gurgle in all seriousness. Sometimes it would
seem to occur to her suddenly, and she would burst out with it, with
an impulsive movement of body and limbs.
In a few days she had become a different baby, with a new world of
interests, and a wonderfully more varied and vivid life. After this, she
went on smoothly to the end of the fifth month (and for that matter,
through the sixth), absorbed in looking, feeling, and handling,
reaching this way and that to lay hold of everything she saw, and
improving steadily in skill. A small steel bell given her in the twenty-
first week was at first pulled and shoved about on the table, picked
up with two fingers or more as might chance, and put into her mouth
by any part that came handiest; but in three or four days it was taken
up properly and rung. More and more all the time she found
something to do with things besides putting them in her mouth.
She liked hard, bright, and rattling things best to handle, and
preferred metal or bone to rubber. One can hardly think of a thing
less useful to a baby educationally at this stage than soft, colored
worsted balls; he needs something that he can feel, hard and
definite, in his hand; something with distinctly unlike sides that he
can see as he pulls and shakes it about; he loves glitter, but cares
little for color, perhaps does not yet see it; and any dyes and worsted
shreds that can come off in wet little mouths are conclusive against
such a toy.
On the other hand, bright metal objects are apt in the course of their
gyrations to deal bad thumps to little heads and noses; so one must
compromise on rubber—uninteresting, but safe—and on such bone,
metal (perhaps aluminum), and unpainted wooden toys as can be
trusted to give only very mild thumps, such as a baby had better take
now and then rather than be deprived of all really interesting toys.
This is one of the many dilemmas in which the baby is lucky who has
a grandma, or whose mamma can spare time to associate with him a
great deal; for no end of things can be trusted in the little hands, that
ache for everything in sight, if only vigilant fingers hover close, ready
to ward gently off any dangerous movement. Sitting in one’s lap at
the table, too, the baby may push and pull at many things not safe
for him to lift; or he may be allowed to handle something safely
tethered with a string. Certainly the wider liberty of holding and
handling he can by any device be allowed, the better; the instinct is
very strong, and wholly healthy, and the thwarting of normal instincts
is not good for any one’s nerves or mind.
In sight, important changes were no longer to be looked for: except
possibly in the matter of color sense, the baby’s seeing had now
passed through all the stages of development, and needed only
practice and mental growth to become as perfect as it would ever be.
She was evidently still at work somewhat, especially in new places,
in reducing confused appearances to order; but so much of this work
was already done that more and more she could sit and enjoy the
varied spectacle. More than once she spent half an hour gazing thus
out of the window with quiet pleasure.
There were for the first time signs that she could distinguish between
the sounds of voices. She looked and listened one day in the middle
of the month, as if she noticed something unusual, when I was
hoarse with a cold. Late in the month, as I read to her mother while
she nursed the baby, singing softly to her (a frequent custom), the
baby suddenly raised her head and looked curiously at me, evidently
for the first time distinguishing the two voices as separate sounds.
Her mother and grandmother had been saying to her a great deal,
“Papa!” hoping to hasten her understanding of the word. This same
day she imitated the motion of the lips, and seemed to find the
feeling very funny, for she laughed, and laughed whenever she
heard the sound explosively uttered during the next fortnight; she
stopped in the midst of crying to laugh at it. Her amusement had not
the faintest connection with the meaning of the word; indeed, she
chuckled aloud with even more gayety when I ejaculated “poo-poo!”
or “boo-boo!” instead. It was something in the explosive labial sound
that struck her as comical.
In this beginning of discrimination in articulate sounds, we see the
root of the later understanding of speech. But it was by another road
that the baby now began to move toward human communication: by
the way, that is, of signs and inarticulate cries. One day when she
was four and a half months old, she raised a strange little clamor on
catching sight of her grandfather, as if on purpose to call his
attention, and was satisfied when she got it; she began to hold out
her arms of her own accord, instead of merely to meet ours, held out
to her; and in the very last days of the fifth month she made a sound
of request when she wished to be taken, a whimpering, coaxing
sound, leaning and looking toward her mother, instead of the mere
fretting sounds of desire, addressed to nobody, which she had made
for weeks.
When I have spoken before of the baby’s “addressing” her little
noises to us, I have not meant that there was really anything of
language in them. Some expression of interest in our presence,
some sort of social feeling, there must have been, but no more than
in her kicking up her feet or chuckling at our attentions. These first
asking sounds and motions, on the contrary, were beginnings of real
language—not yet of human language, but of such as the baby
shares with all the beasts and birds.
A sort of intelligence shared with the beasts and birds, too, appeared
in these same closing days of the fifth month—what may be called
“adaptive intelligence,” the use of means to an end—in the patient
devices by which the baby manœuvred her toe into her mouth; but
this was a sort of anticipation of a development that belonged really
to the next month, and so I shall leave the account of it to the next.
The increasing ownership of her body that this toe feat showed was
evident in several other ways. The baby’s sitting up grew
imperceptibly firmer and more independent of support: at nineteen
weeks old, she was sitting alone in our laps a quarter of a minute at
a time; four days later, a minute at a time, provided she did nothing
to upset herself, such as flourishing her arms, or reaching after
things; two days later yet, she balanced successfully for a few
seconds on the table—and this was real sitting alone at last, for on
the table there could be no least support from the yielding of the
surface under her. All babies can sit alone earlier on the lap or a
cushion than on a perfectly flat, hard surface.
At just about nineteen weeks old, too, the baby began to roll over to
her side when she was laid on her back on the floor, and to squirm
and bend around into a variety of positions, instead of lying where
she was put.
The period was coming to an end in which the main activity of
development was in the senses, and in coming through the
coöperation of the senses to a bodily consciousness of herself in a
world of objects, of distances, and directions. Now the baby had to
learn to use that body, and explore that world. But before this second
great period of activity fully began, there was a transition month, a
month of vigorous practice in the powers already gained, and of
gathering forces for the new developments.

You might also like