Machine Learning for Time Series Forecasting with Python 1st Edition Francesca Lazzeridownload
Machine Learning for Time Series Forecasting with Python 1st Edition Francesca Lazzeridownload
or textbooks at https://ebookultra.com
_____ Follow the link below to get your download now _____
https://ebookultra.com/download/machine-learning-for-time-
series-forecasting-with-python-1st-edition-francesca-
lazzeri/
https://ebookultra.com/download/python-machine-learning-1st-edition-
wei-meng-lee/
https://ebookultra.com/download/python-machine-learning-by-example-
the-easiest-way-to-get-into-machine-learning-1st-edition-yuxi-hayden-
liu/
https://ebookultra.com/download/learning-selenium-testing-tools-with-
python-1st-edition-gundecha/
https://ebookultra.com/download/deep-learning-with-python-1st-edition-
francois-chollet/
Machine Learning with R Cookbook 2nd Edition Bhatia
https://ebookultra.com/download/machine-learning-with-r-cookbook-2nd-
edition-bhatia/
https://ebookultra.com/download/mastering-machine-learning-with-
scikit-learn-2nd-edition-gavin-hackeling/
https://ebookultra.com/download/scala-for-machine-learning-second-
edition-patrick-r-nicolas/
https://ebookultra.com/download/probabilistic-machine-learning-for-
civil-engineers-james-a-goulet/
Machine Learning for Time Series Forecasting with
Python 1st Edition Francesca Lazzeri Digital Instant
Download
Author(s): Francesca Lazzeri
ISBN(s): 9781119682363, 1119682363
Edition: 1
File Details: PDF, 3.44 MB
Year: 2020
Language: english
Machine Learning for
Time Series Forecasting
with Python®
Francesca Lazzeri, PhD
Machine Learning for Time Series Forecasting with Python®
ISBN: 978-1-119-68236-3
ISBN: 978-1-119-68237-0 (ebk)
ISBN: 978-1-119-68238-7 (ebk)
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or
by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted
under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permis-
sion of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright
Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to
the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc.,
111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at www.wiley.com/go/
permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or war-
ranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all
warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be
created or extended by sales or promotional materials. The advice and strategies contained herein may not
be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in
rendering legal, accounting, or other professional services. If professional assistance is required, the services
of a competent professional person should be sought. Neither the publisher nor the author shall be liable for
damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation
and/or a potential source of further information does not mean that the author or the publisher endorses
the information the organization or website may provide or recommendations it may make. Further, readers
should be aware that Internet websites listed in this work may have changed or disappeared between when
this work was written and when it is read.
For general information on our other products and services please contact our Customer Care Department
within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included
with standard print versions of this book may not be included in e-books or in print-on-demand. If this book
refers to media such as a CD or DVD that is not included in the version you purchased, you may down-
load this material at booksupport.wiley.com. For more information about Wiley products, visit www
.wiley.com.
Library of Congress Control Number: 2020947403
Trademarks: Wiley and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc.
and/or its affiliates, in the United States and other countries, and may not be used without written permis-
sion. Python is a registered trademark of Python Software Foundation. All other trademarks are the property
of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned
in this book.
About the Author
iii
About the Technical Editor
v
Acknowledgments
In the past few years, I had the privilege to work with many data scientists,
cloud advocates, developers, and professionals from Microsoft and Wiley: all
these people inspired me and supported me through the creation and writing of
this book. I am particularly grateful to the Cloud Advocacy team at Microsoft,
for their trust and encouragement and for making my job so much easier and
more enjoyable.
Thanks to Jim Minatel, associate publisher at John Wiley & Sons, who worked
with me since the beginning of the publishing process and acted as a bridge
between my work and the editorial staff. It was a pleasure to work with Pete
Gaughan, content enablement manager; with David Clark, project editor, who
managed the process that got us from outline to a finished manuscript; and
with Saravanan Dakshinamurthy, content refinement specialist, who managed
the last stages of this book development and made them go as smoothly as they
did. I appreciate the support and guidance provided by the technical reviewer,
James Winegar, and I hope we will work on other projects together in the future.
Last but not least, I will be forever grateful to my daughter, Nicole, who
reminds me of the goodness in this world and inspires me to be the greatest
version of myself; to my husband, Laurent, for his unconditional and endless
support, inspiration, and encouragement; to my parents, Andrea and Anna
Maria, and my brother, Marco, for always being there for me and believing in
me through all walks of my life.
—Francesca Lazzeri
vii
Contents at a Glance
Acknowledgmentsvii
Introductionxv
ix
Contents
Acknowledgmentsvii
Introductionxv
xi
xii Contents
Converting to Timestamps 69
Providing a Format Argument 70
Indexing71
Time/Date Components 76
Frequency Conversion 78
Time Series Exploration and Understanding 79
How to Get Started with Time Series Data Analysis 79
Data Cleaning of Missing Values in the Time Series 84
Time Series Data Normalization and Standardization 86
Time Series Feature Engineering 89
Date Time Features 90
Lag Features and Window Features 92
Rolling Window Statistics 95
Expanding Window Statistics 97
Conclusion98
Chapter 4 Introduction to Autoregressive and Automated
Methods for Time Series Forecasting 101
Autoregression102
Moving Average 119
Autoregressive Moving Average 120
Autoregressive Integrated Moving Average 122
Automated Machine Learning 129
Conclusion136
Chapter 5 Introduction to Neural Networks for Time Series Forecasting 137
Reasons to Add Deep Learning to Your Time Series Toolkit 138
Deep Learning Neural Networks Are Capable of Automatically
Learning and Extracting Features from Raw and
Imperfect Data 140
Deep Learning Supports Multiple Inputs and Outputs 142
Recurrent Neural Networks Are Good at Extracting
Patterns from Input Data 143
Recurrent Neural Networks for Time Series Forecasting 144
Recurrent Neural Networks 145
Long Short-Term Memory 147
Gated Recurrent Unit 148
How to Prepare Time Series Data for LSTMs and GRUs 150
How to Develop GRUs and LSTMs for Time Series Forecasting 154
Keras155
TensorFlow156
Univariate Models 156
Multivariate Models 160
Conclusion164
Chapter 6 Model Deployment for Time Series Forecasting 167
Experimental Set Up and Introduction to Azure
Machine Learning SDK for Python 168
Contents xiii
Workspace169
Experiment169
Run169
Model170
Compute Target, RunConfiguration, and ScriptRun
Config171
Image and Webservice 172
Machine Learning Model Deployment 173
How to Select the Right Tools to Succeed with Model
Deployment175
Solution Architecture for Time Series Forecasting
with Deployment Examples 177
Train and Deploy an ARIMA Model 179
Configure the Workspace 182
Create an Experiment 183
Create or Attach a Compute Cluster 184
Upload the Data to Azure 184
Create an Estimator 188
Submit the Job to the Remote Cluster 188
Register the Model 189
Deployment189
Define Your Entry Script and Dependencies 190
Automatic Schema Generation 191
Conclusion196
References 197
Index199
Exploring the Variety of Random
Documents with Different Content
CHAPTER XVII.
ALL-HALLOW-EVE.
For a long while most of the old customs of these holidays were
retained; then, although new ceremonies were gradually introduced,
Hallow-Eve remained the night of the year for wild, mysterious, and
superstitious rites. Fairies and all supernatural beings were believed
to be abroad at this time, and to exercise more than their usual
power over earthly mortals. Because the fairy folk were believed to
be so near us on Halloween, it was considered the best evening of
the season for the practice of magic, and the customs observed on
this night became mostly those of divination, by the aid of which it
was thought the future might be read.
Before proceeding further with this subject we desire our readers
to appreciate and fully understand that we are far from wishing to
inculcate any superstitious belief in the power of charms to forecast
future events; that we regard all fortune-telling as nonsense, pure
and simple, and only insert it here, as we would any other game, for
the sake of the amusement it affords. Although, to make our
descriptions more intelligible, we announce the results of charms as
facts, we would not have it understood that they are to be taken as
such.
Nowadays, so practical has the world become, no fairy, witch, or
geni could we conjure up, were we to practice all the charms and
spells ever known to soothsayer or seer. Our busy, common-sense
age allows no fairies to interfere with its concerns, and these
creatures, who existed only in the belief of the people, must needs
vanish, to return no more, when that belief is gone.
A few fortune-telling games are all that now remain of the weird
ceremonies that once constituted the rites of Halloween, and the
spirit of this old heathen holiday is once more changed, for it is now
considered only an occasion for fun and frolic.
It was the custom for quite a number of years of some friends of
the writer to give a Halloween party on each recurring Halloween;
and merrier, jollier parties than those were, it would not be easy to
devise. The home which opened wide its hospitable doors to the
favored few on this night is a country-house, large and spacious;
there is a basement under the whole lower floor, which is divided
into kitchen, laundry, and various store-rooms intersected with
passages, and this basement, deserted by the servants, was given
up to the use of the Halloween revellers. The rooms and passage-
ways were decorated with and lighted by Chinese lanterns, which
produced a subdued glow in their immediate vicinity, but left
mysterious shadows in nooks and corners.
Putting aside conventionality and dignity as we laid aside our
wraps, ready for any fun or mischief that might be on hand, we
proceeded down-stairs and into the kitchen, where a large pot of
candy was found bubbling over the fire. This candy, poured into
plates half-full of nuts, was eaten at intervals during the evening,
and served to keep up the spirits of those who were inclined to be
cast down by the less pleasing of Fortune’s decrees. With plenty of
room and no fear of breaking or destroying anything, which is apt to
put a check upon frolics in the parlor, the company could give full
vent to their high spirits. Now in this room, now in that, again flitting
through the dim passages and around dark corners, each person
seemed to be everywhere at once, and although the party was
limited to about twenty-five, there appeared to be at least twice that
number present. Bursts of merry laughter and little screams of
pretended terror would announce, now and then, that some charm
was being gone through with and someone’s fortune being told. All
sorts of games were played, and the variety of our entertainment
made the evening pass very quickly. All too soon the hands of the
kitchen clock warned the guests that to reach home at a seasonable
hour they must put an end to their Halloween festivities. A number
of the following methods of telling fortunes were tried at these
parties, one might say with success, for we certainly succeeded in
accomplishing our main object, which was, to have a good time. By
Melted Lead
we used to ascertain what the occupation of one’s future husband
would be. The fortune is told in this way: Each girl, in turn, holds a
door-key in one hand, while with the other hand she pours the
melted lead, from an iron spoon or ladle, through the handle of the
key into a pan of cold water.
In the fanciful shapes the lead assumes can be traced
resemblances to all sorts of things. Sometimes it is a sword or gun,
which indicates that a soldier will win the fair prize; again, traces of
a ship may be seen: then the favored one is to be a sailor; a plough
suggests a farmer; a book, a professor, or perhaps a minister; and
when the lead forms only drops, it seems to mean that the gentle
inquirer will not marry, or if she does, her husband will be of no
profession.
Nutshell Boats
foretell in a general way what their owner’s future life will be. They
should be prepared beforehand in this manner: Split an English
walnut directly in half, remove the kernel, and clear away any of the
partitions which may remain in the shell; then place a short piece of
heavy cotton string in the shell and pour around it melted beeswax.
Mould the wax into a cone shape around the string, as shown in Fig.
129, allowing the end to come out at the top. Fig. 130 shows what it
is like when finished.
The tapers first being lighted, several of these
little craft are launched at the same time, by their
respective owners, upon the sea of life, or, in
other words, in a tub of water.
When a light burns steadily until the wax is all
melted, and the frail bark safely rides the waves
(which are occasioned by stirring the water with a
stick, or shaking the tub from side to side), a
happy life is predicted, and a long one.
When two boats come in contact, it means that
their owners will meet and have mutual interests
some time during their lives.
If one boat crosses another’s path, it denotes that their owners
will do the same.
If two boats come together and continue to sail about side by
side, their owners will in some way pass much of their lives together.
When a boat clings closely to the sides of the tub, refusing to sail
out into the centre, it shows that its owner will be a stay-at-home.
Touching often at the side of the tub is indicative of short
voyages; and extended travel is predicted when a boat seldom
touches the tub.
It depends a good deal upon the fancy and imagination of those
testing their fate how the antics of the little fleet are interpreted, and
the meanings given to the movements of the boats create no end of
fun.
“Three Luggies.”[C]
“In order, on the clean hearth-stane,
The luggies three are ranged,
And ev’ry time great care is ta’en
To see them duly changed.”
The three bowls, or dishes, one containing clear water, one milky,
and the other nothing at all, are placed in a row on the hearth-stone
or table, and the girl wishing to try her fortune is blindfolded and led
up to where the dishes stand. She is then told to put her left hand
into one of the bowls. If she dips her fingers in the clear water, she
will marry a bachelor; if in the milky water, a widower; and if into
the empty bowl, it is a sure sign that she will live in single
blessedness all her days.
This ceremony must be gone through with three times, and the
hand be dipped twice in the same bowl, in order to make the
prediction of any value.
Roasting Nuts
is the charm by which the friendship of anyone may be tested. The
applicant for knowledge on this point names two nuts, one for her
friend and the other for herself, and then places them side by side
upon the grate, or a shovel held over the fire. If they burn quietly, it
is prophetic of a long and happy friendship kept up by both parties;
but if in roasting they burst with a loud report and fly apart, they are
decidedly uncongenial, and should not seek much intercourse. The
movements of the nuts while heating are closely watched, for the
tempers of the persons for whom they are named is said to be thus
revealed.
Kaling
is a mode of telling one’s fortune not as well known, perhaps, as the
foregoing methods. The ceremony is carried out in the following
manner: Two girls are blindfolded and started off on the path to the
kitchen-garden and cabbage-patch, where each pulls up the first
stalk she finds. They then return at once to the house, where the
bandages are removed and the mysterious stalks examined.
According to the state of the stalk, so will be the gatherer’s fate.
If it is straight or crooked, large or small, so will the future husband
be; if it has a pleasant taste, or the reverse, the character of the
person will correspond, and the quantity of earth clinging to the
roots denotes whether their riches will be little or great.
When there are no cabbages at hand, almost any other garden
vegetable will answer; and if there be objections to going out-of-
doors, vegetables of various kinds, such as turnips, beets, and
parsnips, may be placed on a table, and the persons blindfolded can
choose from them. No doubt the charm will work as well with the
plants upon a table as when they are pulled from a kitchen-garden.
A Lighted Candle
is again used in a game which is exceedingly amusing. The candle is
placed upon a table in full view of everyone; then one of the players
is blindfolded, turned around several times, and set free to seek for
the candle and blow out the light, if possible.
To see girls, with their hands clasped behind them, going crazily
about the room, blowing at anything and everything, is very
ludicrous. They seldom find the candle, and even when the table is
reached it is difficult to blow in such a direction as to extinguish the
flame.
Buckeye Portière.
The writer assures you that you will find it much easier to do this
than she did to make a picture of the curtain, for it is difficult with a
pen-and-ink drawing to give an idea of the richness of color in the
handsome hangings these horse-chestnuts make when properly
fashioned into a portière for hall or doorway. Two full bushels of
buckeyes will be needed to make a curtain two yards and a half long
and one yard and a quarter wide.
Take a very large, long needle and a strong, waxed thread a little
longer than you desire to have your curtain, make a large knot in the
end of the thread, and commence to string your buckeyes in the
same way as stringing beads or buttons. Continue until the thread in
the needle is exhausted, then tie the thread in a large knot close to
the last buckeye, leaving a length of three inches of thread. Make
your other strands in the same way. When all are finished, fasten as
many small screw-eyes in a straight line on a curtain-pole, or a rustic
pole if desired, as there are strands of buckeyes, and tie securely to
each screw-eye one string of buckeyes. When all are fastened on,
your portière is finished and ready to be hung. This is easily
accomplished if the pole used is a regular curtain-pole, as they
always come with brackets; but should your pole be rustic, it must
be supported by bands of strong birch-bark, or leather, as in Fig.
131. Our illustration shows over the portière a
Should you desire it, the screen can be painted black or any other
color, and the decorations bronzed instead of gilded. The bronzes
come in different shades, and the color of real bronze can be easily
copied.
A Panel of Field-Corn
As an ornament for the dining-room is very decorative and easy
to make. When the corn ripens, select some nice, firm, golden ears,
with husks and without; then break off pieces of cornstalk and group
them together, as in the illustration; cover a board of requisite size
with a piece of old black velvet; if you have no velvet, paint the
board black, and after tying the corn firmly together, tack it securely
on the board, and the dark background will bring out the many
yellow tints of the decoration beautifully; fasten two screw-eyes in
the back of the board, by
which to attach the wire,
and the panel will be
ready to hang on the
wall.
The corn can also be
fastened to a rough
board of the desired size
and the panel and
decoration bronzed,
using green bronze for
the background and
portions of the group,
while all the edges and
prominent points should
be of copper-colored
bronze.
Early in November the
many varieties of gourds
ripen, and their odd and
fantastic forms seem like
nature’s suggestions of
the unique in
ornamentation. So
suggestive are they that
it needs but little
originality to make them
into many useful and
beautiful articles. As a
decoration for looping
over the poles of
portières, and for holding back draperies, these
Ornamental Gourds
are convenient. They must first be allowed to become perfectly dry;
then they can be made into tasselled festoons. Take six mock-
oranges, which imitate so closely our real oranges in color, size, and
form, and cut a hole about the size of a silver dime in the top and
bottom of each one; then shake out the seeds. To make the
openings in the gourds, first bore a small hole with the point of a
large needle, then twist the needle around and around until it will
easily pass through. Next, carefully enlarge the opening with a sharp
penknife until it is of the stated size. Make a rope two yards and a
half long of Persian colored wools or worsted; on the end fasten a
slender tassel, six or seven inches long, made of the same worsted;
now string one of the bright orange-gourds on the rope down
against the tassel, which should be large enough to prevent the
gourd from slipping off; make another similar tassel, and attach it to
the rope about twelve inches from the first one, and thread another
gourd on the rope, bringing it down against the second tassel;
proceed in like manner with the remaining gourds, making a tassel
for each one, and you will have a decoration unlike any to be found
elsewhere.
We are all more or less familiar with the
Gourd-Dippers
so common in the South, where, in olden times, scarcely a spring
bubbled in a rustic nook that was not supplied with its drinking-
gourd. These dippers are made by sawing an opening in the large
part of the gourd, scraping out the contents, and making the inside
as smooth as possible with sand-paper. They need no
ornamentation.
The kind of gourds resembling flattened globes can be made into
graceful and unique
Bowls.
The gourds must be sawed into two parts, with the inside of each
sand-papered, and flowers painted, with oil-colors, on the outside.
After they have thoroughly dried, give a coat of white varnish to
both the inside and outside. A pretty
Bonbon-Box
can be fashioned of one of these gourds. Saw off the top, which will
serve as a lid, and fasten it to the bowl with narrow ribbons tied
through holes at the back of each; line both lid and box with satin by
gluing it along the edges with stiff glue put on sparingly, and cover
the raw edge of the satin with chenille; this is also put on with a
little glue. Do not allow the chenille to interfere with the closing of
the box, but place it along the inside edge of the box and lid.
Another form is the
Bottle-Gourd.
Ornament this with ivy-leaves painted as if twined around bowl
and neck, and when the paint is dry varnish the gourd all over; if
you wish it for use as well as decoration, saw off the top about two
or three inches deep, shake out the seeds, then fit a cork in the
piece cut off, and so glue it in that the cork may extend an inch
downward to fit in the bottle.
The large egg-shaped gourds look well as
Vases.
Foot Bent Down.
Select a deep-colored gourd, saw off the top and scrape out the
inside; then varnish the vase and mount it on feet of twisted wire,
made according to Fig. 134; bend down the feet, as in Fig. 135,
when the wire will be formed into Fig. 136. To fasten this on the
vase, first bore holes in the bottom of the gourd, then sew the feet
firmly on, passing the needle through the holes previously made and
bending the wire a little to fit to the gourd. Gild the wire feet, and
your vase is finished. Another way is to save the top sawed off,
fasten an ornament of twisted wire on the top of it, and then, after
making the vase as the one just described, add bands of gilded
cardboard made to fit the gourd, fastening them to the vase with
glue. Handles can also be fashioned of cardboard and sewed to the
upper band before it is glued to the vase, as in the illustration.
Ornamental and Useful Gourds.
There are many other ways of utilizing gourds, but we will leave it
to your ingenuity to think up new and pretty conceits.
Pine-cones, large and small, acorns, and balls from the sweet-
gum tree, can be used as
Small Decorations.
Never try to fasten them by the natural stems, for these will soon
break off, but place in each one a small screw-eye, and when tied in
groups they form ornaments for waste-baskets and fancy baskets of
all kinds. We have seen chandeliers with gilded cones hanging from
the different points, and being the identical color of the chandelier,
they seemed of the same metal, and added novelty and grace to its
appearance.
There are some varieties of the tree-fungi which make dark, rich-
colored
Brackets.
Use heavy cardboard or thin board as a covering for the back;
have this fit the fungus perfectly, and fasten it securely in position
with very stiff glue or nails. Paint the back the same color as the
fungus, and on either side of the upper edge place screw-eyes by
which to fasten up the bracket.
Many of the curiously formed galls and oak-apples to be found on
different trees can also be employed as ornaments.
Nothing can be finer than our brilliant autumn season, which is
said to be more beautiful in this than in other countries, with its
crisp mornings and bright sunny afternoons.
When the weather is too lovely to remain in-doors, and all nature
invites us out, then is the time to gather our fall decorations.
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.
ebookultra.com