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

Download full Reinforcement Learning for Finance: Solve Problems in Finance with CNN and RNN Using the TensorFlow Library 1st Edition Samit Ahlawat ebook all chapters

The document promotes the ebook 'Reinforcement Learning for Finance' by Samit Ahlawat, which focuses on applying CNN and RNN techniques using TensorFlow to solve financial problems. It includes links to download the ebook and other recommended digital products related to reinforcement learning and finance. The book aims to provide a comprehensive resource for Python programmers interested in reinforcement learning applications in finance, covering both theoretical and practical aspects.

Uploaded by

iwazhinel
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)
9 views

Download full Reinforcement Learning for Finance: Solve Problems in Finance with CNN and RNN Using the TensorFlow Library 1st Edition Samit Ahlawat ebook all chapters

The document promotes the ebook 'Reinforcement Learning for Finance' by Samit Ahlawat, which focuses on applying CNN and RNN techniques using TensorFlow to solve financial problems. It includes links to download the ebook and other recommended digital products related to reinforcement learning and finance. The book aims to provide a comprehensive resource for Python programmers interested in reinforcement learning applications in finance, covering both theoretical and practical aspects.

Uploaded by

iwazhinel
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/ 39

Get the full ebook with Bonus Features for a Better Reading Experience on ebookmeta.

com

Reinforcement Learning for Finance: Solve Problems


in Finance with CNN and RNN Using the TensorFlow
Library 1st Edition Samit Ahlawat

https://ebookmeta.com/product/reinforcement-learning-for-
finance-solve-problems-in-finance-with-cnn-and-rnn-using-
the-tensorflow-library-1st-edition-samit-ahlawat/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookmeta.com


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

Deep Reinforcement Learning with Python: With PyTorch,


TensorFlow and OpenAI Gym 1st Edition Nimish Sanghi

https://ebookmeta.com/product/deep-reinforcement-learning-with-python-
with-pytorch-tensorflow-and-openai-gym-1st-edition-nimish-sanghi-3/

ebookmeta.com

Deep Reinforcement Learning with Python With PyTorch


TensorFlow and OpenAI Gym 1st Edition Nimish Sanghi

https://ebookmeta.com/product/deep-reinforcement-learning-with-python-
with-pytorch-tensorflow-and-openai-gym-1st-edition-nimish-sanghi/

ebookmeta.com

Deep Reinforcement Learning with Python With PyTorch


TensorFlow and OpenAI Gym 1st Edition Nimish Sanghi

https://ebookmeta.com/product/deep-reinforcement-learning-with-python-
with-pytorch-tensorflow-and-openai-gym-1st-edition-nimish-sanghi-2/

ebookmeta.com

Intersectionality in Action A Guide for Faculty and Campus


Leaders for Creating Inclusive Classrooms and Institutions
1st Edition Peter Felten
https://ebookmeta.com/product/intersectionality-in-action-a-guide-for-
faculty-and-campus-leaders-for-creating-inclusive-classrooms-and-
institutions-1st-edition-peter-felten/
ebookmeta.com
The Cambridge Handbook of Workplace Training and Employee
Development Kenneth G. Brown

https://ebookmeta.com/product/the-cambridge-handbook-of-workplace-
training-and-employee-development-kenneth-g-brown/

ebookmeta.com

All The Beautiful People The Dread Novels 1 1st Edition


Jonathan Yanez

https://ebookmeta.com/product/all-the-beautiful-people-the-dread-
novels-1-1st-edition-jonathan-yanez/

ebookmeta.com

Gini Inequality Index: Methods and Applications 1st


Edition Nitis Mukhopadhyay

https://ebookmeta.com/product/gini-inequality-index-methods-and-
applications-1st-edition-nitis-mukhopadhyay/

ebookmeta.com

Berserker Bounty Hunter 1st Edition Carlsson Roland

https://ebookmeta.com/product/berserker-bounty-hunter-1st-edition-
carlsson-roland/

ebookmeta.com

Capitalism and the Emergence of Civic Equality in


Eighteenth Century France 1st Edition William H. Sewell
Jr.
https://ebookmeta.com/product/capitalism-and-the-emergence-of-civic-
equality-in-eighteenth-century-france-1st-edition-william-h-sewell-jr/

ebookmeta.com
Love of the Spirit The FGB 173 1st Edition Various

https://ebookmeta.com/product/love-of-the-spirit-the-fgb-173-1st-
edition-various/

ebookmeta.com
Reinforcement
Learning for
Finance
Solve Problems in Finance with
CNN and RNN Using the
TensorFlow Library

Samit Ahlawat
Reinforcement
Learning for Finance
Solve Problems in Finance
with CNN and RNN Using
the TensorFlow Library

Samit Ahlawat
Reinforcement Learning for Finance: Solve Problems in Finance with CNN
and RNN Using the TensorFlow Library

Samit Ahlawat
Irvington, NJ, USA

ISBN-13 (pbk): 978-1-4842-8834-4 ISBN-13 (electronic): 978-1-4842-8835-1


https://doi.org/10.1007/978-1-4842-8835-1

Copyright © 2023 by Samit Ahlawat


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Celestin Suresh John
Development Editor: Laura Berendson
Coordinating Editor: Mark Powers
Cover designed by eStudioCalamar
Cover image by Joel Filipe on Unsplash (www.unsplash.com)
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY
10004, U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com,
or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance
Inc is a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for
reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub (https://github.com/Apress). For more detailed information,
please visit http://www.apress.com/source-code.
Printed on acid-free paper
To my family and friends without whose support this book
would not have been possible.
Table of Contents
About the Author���������������������������������������������������������������������������������ix

Acknowledgments�������������������������������������������������������������������������������xi

Preface����������������������������������������������������������������������������������������������xiii

Introduction����������������������������������������������������������������������������������������xv

Chapter 1: Overview�����������������������������������������������������������������������������1
1.1 Methods for Training Neural Networks�����������������������������������������������������������2
1.2 Machine Learning in Finance��������������������������������������������������������������������������3
1.3 Structure of the Book��������������������������������������������������������������������������������������4

Chapter 2: Introduction to TensorFlow�������������������������������������������������5


2.1 Tensors and Variables�������������������������������������������������������������������������������������5
2.2 Graphs, Operations, and Functions���������������������������������������������������������������11
2.3 Modules��������������������������������������������������������������������������������������������������������14
2.4 Layers�����������������������������������������������������������������������������������������������������������17
2.5 Models����������������������������������������������������������������������������������������������������������25
2.6 Activation Functions��������������������������������������������������������������������������������������33
2.7 Loss Functions����������������������������������������������������������������������������������������������37
2.8 Metrics����������������������������������������������������������������������������������������������������������46
2.9 Optimizers�����������������������������������������������������������������������������������������������������77
2.10 Regularizers������������������������������������������������������������������������������������������������96
2.11 TensorBoard����������������������������������������������������������������������������������������������120

v
Table of Contents

2.12 Dataset Manipulation��������������������������������������������������������������������������������122


2.13 Gradient Tape��������������������������������������������������������������������������������������������126

Chapter 3: Convolutional Neural Networks���������������������������������������139


3.1 A Simple CNN����������������������������������������������������������������������������������������������140
3.2 Neural Network Layers Used in CNNs���������������������������������������������������������148
3.3 Output Shapes and Trainable Parameters of CNNs�������������������������������������150
3.4 Classifying Fashion MNIST Images�������������������������������������������������������������152
3.5 Identifying Technical Patterns in Security Prices����������������������������������������159
3.6 Using CNNs for Recognizing Handwritten Digits�����������������������������������������172

Chapter 4: Recurrent Neural Networks���������������������������������������������177


4.1 Simple RNN Layer���������������������������������������������������������������������������������������178
4.2 LSTM Layer�������������������������������������������������������������������������������������������������182
4.3 GRU Layer���������������������������������������������������������������������������������������������������186
4.4 Customized RNN Layers������������������������������������������������������������������������������188
4.5 Stock Price Prediction���������������������������������������������������������������������������������190
4.6 Correlation in Asset Returns�����������������������������������������������������������������������207

Chapter 5: Reinforcement Learning Theory��������������������������������������233


5.1 Basics���������������������������������������������������������������������������������������������������������234
5.2 Methods for Estimating the Markov Decision Problem�������������������������������240
5.3 Value Estimation Methods���������������������������������������������������������������������������241
5.3.1 Dynamic Programming�����������������������������������������������������������������������242
5.3.2 Generalized Policy Iteration����������������������������������������������������������������265
5.3.3 Monte Carlo Method���������������������������������������������������������������������������277
5.3.4 Temporal Difference (TD) Learning�����������������������������������������������������284
5.3.5 Cartpole Balancing�����������������������������������������������������������������������������305

vi
Table of Contents

5.4 Policy Learning�������������������������������������������������������������������������������������������319


5.4.1 Policy Gradient Theorem���������������������������������������������������������������������319
5.4.2 REINFORCE Algorithm�������������������������������������������������������������������������321
5.4.3 Policy Gradient with State-Action Value Function Approximation������323
5.4.4 Policy Learning Using Cross Entropy��������������������������������������������������325
5.5 Actor-Critic Algorithms��������������������������������������������������������������������������������326
5.5.1 Stochastic Gradient–Based Actor-Critic Algorithms���������������������������329
5.5.2 Building a Trading Strategy����������������������������������������������������������������330
5.5.3 Natural Actor-Critic Algorithms�����������������������������������������������������������346
5.5.4 Cross Entropy–Based Actor-Critic Algorithms������������������������������������347

Chapter 6: Recent RL Algorithms�����������������������������������������������������349


6.1 Double Deep Q-Network: DDQN������������������������������������������������������������������349
6.2 Balancing a Cartpole Using DDQN���������������������������������������������������������������353
6.3 Dueling Double Deep Q-Network����������������������������������������������������������������356
6.4 Noisy Networks�������������������������������������������������������������������������������������������357
6.5 Deterministic Policy Gradient����������������������������������������������������������������������359
6.5.1 Off-Policy Actor-Critic Algorithm���������������������������������������������������������360
6.5.2 Deterministic Policy Gradient Theorem����������������������������������������������361
6.6 Trust Region Policy Optimization: TRPO������������������������������������������������������362
6.7 Natural Actor-Critic Algorithm: NAC�������������������������������������������������������������368
6.8 Proximal Policy Optimization: PPO��������������������������������������������������������������369
6.9 Deep Deterministic Policy Gradient: DDPG��������������������������������������������������370
6.10 D4PG���������������������������������������������������������������������������������������������������������373
6.11 TD3PG�������������������������������������������������������������������������������������������������������376
6.12 Soft Actor-Critic: SAC��������������������������������������������������������������������������������379

vii
Table of Contents

6.13 Variational Autoencoder����������������������������������������������������������������������������384


6.14 VAE for Dimensionality Reduction�������������������������������������������������������������389
6.15 Generative Adversarial Networks��������������������������������������������������������������399

Bibliography�������������������������������������������������������������������������������������403

Index�������������������������������������������������������������������������������������������������411

viii
About the Author
Samit Ahlawat is Senior Vice President in
Quantitative Research, Capital Modeling, at
JPMorgan Chase in New York, USA. In his
current role, he is responsible for building
trading strategies for asset management
and for building risk management models.
His research interests include artificial
intelligence, risk management, and
algorithmic trading strategies. He has given CQF Institute talks on artificial
intelligence, has authored several research papers in finance, and holds a
patent for facial recognition technology. In his spare time, he contributes
to open source code.

ix
Acknowledgments
I would like to express my heartfelt appreciation for my friends and
coworkers, in academia and the workplace, who encouraged me to write
this book.

xi
Preface
When I began using artificial intelligence tools in quantitative financial
research, I could not find a comprehensive introductory text focusing on
financial applications. Neural network libraries like TensorFlow, PyTorch,
and Caffe had made tremendous contributions in the rapid development,
testing, and deployment of deep neural networks, but I found most
applications restricted to computer science, computer vision, and robotics.
Having to use reinforcement learning algorithms in finance served as
another reminder of the paucity of texts in this field. Furthermore, I found
myself referring to scholarly articles and papers for mathematical proofs of
new reinforcement learning algorithms. This led me to write this book to
provide a one-stop resource for Python programmers to learn the theory
behind reinforcement learning, augmented with practical examples drawn
from the field of finance.
In practical applications, reinforcement learning draws upon deep
neural networks. To facilitate exposition of topics in reinforcement
learning and for continuity, this book also provides an introduction to
TensorFlow and covers neural network topics like convolutional neural
networks (CNNs) and recurrent neural networks (RNNs).
Finally, this book also introduces readers to writing modular, reusable,
and extensible reinforcement learning code. Having worked on developing
trading strategies using reinforcement learning and publishing papers,
I felt existing reinforcement learning libraries like TF-Agents are tightly
coupled with the underlying implementation framework and do not

xiii
Preface

express central concepts in reinforcement learning in a manner that is


modular enough for someone conversant with concepts to pick up
TF-­Agent library usage or extend its algorithms for specific applications.
The code samples covered in this book provide examples of how to write
modular code for reinforcement learning.

xiv
Introduction
Reinforcement learning is a rapidly growing area of artificial intelligence
that involves an agent learning from past experience of rewards gained
by taking specific actions in certain states. The agent seeks to learn a
policy prescribing the optimum action in each state with the objective of
maximizing expected discounted future rewards. It is an unsupervised
learning technique where the agent learns the optimum policy by past
interactions with the environment. Supervised learning, by contrast, seeks
to learn the pattern of output corresponding to each state in training
data. It attempts to train the model parameters in order to get a close
correspondence between predicted and actual output for a given set of
inputs. This book outlines the theory behind reinforcement learning
and illustrates it with examples of implementations using TensorFlow.
The examples demonstrate the theory and implementation details of the
algorithms, supplemented with a discussion of corresponding APIs from
TensorFlow and examples drawn from quantitative finance. It guides
a reader familiar with Python programming from basic to advanced
understanding of reinforcement learning algorithms, coupled with a
comprehensive discussion on how to use state-of-the-art software libraries
to implement advanced algorithms in reinforcement learning.
Most applications of reinforcement learning have focused on robotics
or computer science tasks. By focusing on examples drawn from finance,
this book illustrates a spectrum of financial applications that can benefit
from reinforcement learning.

xv
CHAPTER 1

Overview
Deep neural networks have transformed virtually every scientific human
endeavor – from image recognition, medical imaging, robotics, and self-­
driving cars to space exploration. The extent of transformation heralded
by neural networks is unrivaled in contemporary human history, judging
by the range of new products that leverage neural networks. Smartphones,
smartwatches, and digital assistants – to name a few – demonstrate the
promise of neural networks and signal their emergence as a mainstream
technology. The rapid development of artificial intelligence and machine
learning algorithms has coincided with increasing computational power,
enabling them to run rapidly. Keeping pace with new developments in
this field, various open source libraries implementing neural networks
have blossomed. Python has emerged as the lingua franca of the artificial
intelligence programming community. This book aims to equip Python-­
proficient programmers with a comprehensive knowledge on how to use
the TensorFlow library for coding deep neural networks and reinforcement
learning algorithms effectively. It achieves this by providing detailed
mathematical proofs of key theorems, supplemented by implementation of
those algorithms to solve real-life problems.
Finance has been an early adopter of artificial intelligence algorithms
with the application of neural networks in designing trading strategies
as early as the 1980s. For example, White (1988) applied a simple
neural network to find nonlinear patterns in IBM stock price. However,
recent cutting-edge research on reinforcement learning has focused

© Samit Ahlawat 2023 1


S. Ahlawat, Reinforcement Learning for Finance,
https://doi.org/10.1007/978-1-4842-8835-1_1
Chapter 1 Overview

predominantly on robotics, computer science, or interactive game-­


playing. The lack of financial applications has led many to question
the applicability of deep neural networks in finance where traditional
quantitative models are ubiquitous. Finance practitioners feel that the
lack of rigorous mathematical proofs and transparency about how neural
networks work has restricted their wider adoption within finance. This
book aims to address both of these concerns by focusing on real-life
financial applications of neural networks.

1.1 Methods for Training Neural Networks


Neural networks can be trained using one of the following three methods:

1. Supervised learning involves using a training


dataset with known output, also called ground
truth values. For a classification task, this would
be the true labels, while for a regression task, it
would be the actual output value. A loss function
is formulated that measures the deviation of the
model output from the true output. This function is
minimized with respect to model parameters using
stochastic gradient descent.

2. Unsupervised learning methods use a training


dataset made up of input features without any
knowledge of the true output values. The objective
is to classify inputs into clusters for clustering or
dimension reduction applications or for identifying
outliers.

3. Reinforcement learning involves an agent that


learns an optimal policy within the framework of
a Markov decision problem (MDP). The training

2
Another Random Document on
Scribd Without Any Related Topics
XXII

Helsingissä oli tullut tänäkin vuonna kevät niinkuin lehdet tulevat


Esplanaadien puihin, ja Albert Hakalalle se oli tullut suurine
sielullisine tulvineen ja suurine suruineen.

Hän, joka niin paljon rakasti nuorisoa ja joka koko sydämensä


lämmöllä todella toivoi nuorille parasta, oli vähitellen, varsinkin
kuluneen talven aikana, oppinut huomaamaan, että hän ei
sittenkään oikein sopinut nuorisonkasvattajaksi.

Mitä hän välitti siitä, että ilkeät kielet parjasivat häntä Lahja
Kaarion tähden. Olihan siitä puhuttu niin, että jutut olivat päässeet
hänenkin korviinsa. Itse hän parhaiten tiesi, kuinka paljon oli
kärsinyt tuon onnettoman suhteen takia. Ja täytyihän niiden juttujen
kerran vaieta, kun neiti Kaario nyt oli onnellisesti kihloissa. Mutta
enemmän koski häneen sittenkin tunto siitä, että opiskeleva nuoriso,
varsinkin osakunnassa, oli ymmärtänyt häntä väärin, pitäen häntä
ankarana tuomarina, joka itseltänsä vaati vähän, mutta muilta sitä
enemmän…

Kauan mietittyänsä asiaa hän oli vihdoin ilmoittanut osakunnan


virkailijoille luopuvansa kuraattorintoimestaan. Hänellä oli siitä
huolimatta, että niin suuri osa osakuntalaisia oli myötätunnolla
seurannut hänen pyrintöjään, kuitenkin vastustamaton halu jättää
koko osakunta, sillä varsinkin viimeisen suuren puheensa jälkeen hän
tunsi sanoneensa kaiken, mitä hänellä oli sydämellään, ja hän tahtoi
väistyä syrjään jättääksensä paikkansa jollekin toiselle. Hänen
eronsa kuului herättäneen suurta huomiota ja mielipahaa
osakunnassa. Mutta päivällisillä, jotka pidettiin eroavan kuraattorin
kunniaksi, hän kuitenkin huomasi tehneensä oikein jättäessään
asemansa jollekin toiselle…

Osanotto päivällisiin oli ollut harvinaisen suuri, katsoen siihen, että


oli kevät, jolloin osa ylioppilaista oli jo matkustanut maalle. Myöskin
puheet olivat olleet ystävällisiä ja lukuisia. Mutta siitä huolimatta hän
tunsi hermoillaan, että oli tehnyt viisaasti luopuessaan toimesta, joka
kuitenkin oli hänelle sanomattoman rakas. Häneltä ei jäänyt
huomaamatta, että monet osakunnan huomattavimmista
toimihenkilöistä, joiden hän tiesi kuuluvan hänen vastustajiinsa,
olivat jääneet pois.

Hän sai osakuntalaisilta kauniin hopeaisen maljakon, jonka kylkeen


oli kaiverrettu hänen nimensä, osakunnan nimi ja vuosiluvut, joina
hän oli ollut osakunnan kuraattorina, nuo rakkaat, vaiherikkaat
vuodet…

Hän oli kiitollinen nuorisolle siitä näkyväisestä lahjasta, joka oli


hänellä kotona aina muistuttamassa siitä, että suurin osa osakunnan
parhaimmistoa oli sittenkin ymmärtänyt häntä oikein, taikka ainakin
uskonut, että hän tarkoitti nuorison parasta. Erikoisesti hämmästytti
häntä se, että hänen kiivaan vastustajansa, tuomari Katajistonkin
käyntikortti oli korttien joukossa…
Erotessaan toimestaan ja pitäessään kiitos- ja
hyvästijättöpuheensa hänen kunniakseen pidetyillä päivällisillä hän
oli lopettanut lausumalla toivomuksen, että hän vielä muutenkin kuin
vain yliopiston opettajana voisi edelleen toimia nuorison herättäjänä
ja nuorison hyväksi…

Hän oli usein miettinyt, mitenkä voisi täyttää lupauksensa, ja


vihdoin se oli kirkastunut hänelle… Hän aikoi kerran kirjoittaa kirjan,
jossa käsittelisi nuorisokysymystä sen kaikilta mahdollisilta puolilta.
Saattoiko hän toteuttaa aikomuksensa, oli jäävä tulevaisuuden
ratkaistavaksi. Nyt hän ei vielä ainakaan sitä ehtinyt tehdä, sillä
suuri, tekeillä oleva taidehistoriallinen teos »Sadun moraali» ei ollut
vielä valmis…

*****

Kesä oli jo ehtinyt heinäkuun alkuun, ja yhä viipyi tohtori Hakala


perheineen kaupungissa. Heidän oma, tulipalon jälkeen korjattu
talonsa Kaivopuistossa oli kylläkin viileä ja sopiva vaikkapa
kesäasunnoksikin, sillä olihan sen yhteydessä, paitsi suurta
Kaivopuistoa, oma pienoinen puutarhansa. Ebba oli tahtonut jäädä
Annikin kanssa kaupunkiin, kun Albert joka tapauksessa yliopiston
kirjastossa käsillä olevien töidensä takia olisi jäänyt kaupunkiin.

Iltapäivisin, lopetettuaan työnsä kirjastossa, Albert kulki usein


Annikin kanssa kaupungilla. Aurinko paistoi helteisesti, ja kuumat
kadut ja korkeat kivimuurit huokuivat lämpöä, mutta hän ei kärsinyt
siitä, sillä hän iloitsi lämmöstä, jota tässä maassa ei suinkaan
koskaan saanut tarpeeksi, puhumattakaan liiasta…

Suloista oli nähdä, kuinka kivet kukkivat.


Ne, jotka eivät olleet voineet päästä maalle, näkyivät ikäänkuin
suurella kauneuden- ja tuoreudenjanolla hankkineen itsellensä
kukkia ja kasvavia kasveja. Avonaisissa akkunoissa näkyi
lukemattomia, kirkasvärisiä kukkia. Satojen akkunoiden eteen oli
ilmestynyt punaisia ja vihreitä, monivärisiä kukkia kantavia
multalaatikoita, akkunoiden riippuvia puutarhoja…

Kaupungin kaikki puistot ikäänkuin kilpailivat kukkasupeudessaan.


Esplanaadien istutukset olivat suorastaan ruhtinaalliset, Kappelin ja
Tähtitorninmäen hortensiat kerrassaan huimasivat upeudessaan
värijanoisia silmiä. Oopperakellarin edustalla ja yliopiston kirjaston
pihalla kukkivat suuret kastanjapuut niinkuin konsanaan Pariisin
bulevardeilla ja levittivät suurista, valkoisista kukistaan, jotka seisoa
törröttivät kuin kynttilät kuusen oksilla, huomaavaa tuoksuaan…
Siellä, missä Kaartinkalliot ennen olivat olleet, kukki nyt tuo talvisin
ja keväisin niin kovalta ja karulta vaikuttava »kalliokaupunki»
tuhansine kukkineen. Jokaisen talon akkunoilla, parvekkeilla,
seinävierillä, pihoilla ja aidoilla kasvoi sadoittain mitä erilaisimpia,
suloisesti tuoksuvia kukkia. Villiviini kierteli pilareita kuin konsanaan
etelässä, ja monen »huvilan» rautaportin takaa pilkisti paratiisillinen
piha niinkuin Rivieralla tai Italiassa. Nämä ennen kuivat ja karut
kalliot todella kukkivat…

Lähelle Eiran sairaalaa oli syntynyt pienoinen Luxembourgin puisto


valkoisine penkkeineen, satoine ruusuineen ja lukemattomine
leikkivine, iloisine lapsineen. Tämän puiston kauneudesta ei
puuttunut muuta kuin vilpoisesti soiva suihkulähde altaineen, jossa
lapset auringonpaisteessa olisivat uittaneet valkopurjeisia laivojaan.
Mutta puistoista ehkä kaunein ja ainakin luonnollisin oli suuri
Kaivopuisto, jossa lukemattomat sireenipensaat kukkivat kymmenin
värivivahduksin kuin maalaispappiloiden puutarhoissa, jossa
ruohokentät hymyilivät tuoreempina kuin missään muualla, ja jossa
ihmiset saivat niillä vapaasti istuskella ja loikoilla.

Lauvantai-iltoina oli liikettä ja menoa. Tuhansiin nousevat iloiset


joukot työläisiä ja pikkuporvareita pyrkivät rautatieasemalle ja
satamiin merenrannalle. Illan tunnussanat olivat: maalle, saareen,
riippumattoihin ja kahvikesteihin ulkosalla.

Harva näky maailmassa oli Albertista niin iloinen, elämänhaluinen


ja värikäs kuin suuret ihmisjoukot Kaivopuiston, Kaisaniemen ja
Eläintarhan nurmilla. Vaaleita, keveitä pukuja, päivänvarjoja, vanhoja
ja nuoria ihmisiä, leikkiviä lapsia, sanomalehtiä lukevia perheenisiä,
riippumattoja, ruokakoreja, paloöljykeittiöillä kiehuvia kahvipannuja,
paukahtelevia virvoitusjuomapulloja, puhetta, huutoa, naurua,
soittoa, iloa ja ääntä…

Hän olisi itse mielellänsä sekoittunut tuohon kirjavaan joukkoon,


mutta hän ei sentään kehdannut…

Eräänä heinäkuun sunnuntain iltapäivänä Albert seisoo


Kaivopuiston korkealla, vanhalla vallilla. Hänen takanansa on
kesäinen kaupunki tuhansine iloisine ja kärsivine ihmisineen. Aurinko
paistaa jo laskussaan kaupungin takana, ja Viaporin suurimman
saaren kivirakennusten seinät hehkuvat valkean hohtavina niinkuin
unelmien valkeat kaupungit…

Meri näkyy laajana, rannattomana hänen edessään. Monet saaret


kukkivat vihreinä sen aaltoilevassa, vilpoisessa sylissä. On maatuuli,
joka tuo kukkivasta kaupungista suloisen, monesta kukasta
lähteneen lauhan tuoksun, niinkuin hyvin kallisarvoisen hajuveden
lemun, joka on puserrettu sadoista erilaisista kukista.
Annikki leikkii käytävällä loistavavärisellä gummipallolla. Albert on
istahtanut penkille ja katselee merelle päin. Lauhat, tuoksuvat
tuulenpuuskat nostattavat laineita, jotka pakenevat rannasta pois
ulappaa kohti. Albertin ajatukset kiitävät noiden laineitten lailla. Ne
syntyvät ja kuolevat samoinkuin hänen ajatuksenakin.

Hän on tavallaan epäonnistunut elämässään… Hän ei ole


onnistunut nuorison kasvattajana eikä myöskään avioliitossaan eikä
rakkaudessaan… Suurilla työn lupauksilla Ebba ja hän olivat
lähteneet elämän taipaleelle. Hän oli tehnyt paljon työtä heidän
yhteisen onnensa hyväksi, mutta onni oli ollut lyhytaikainen ja
epämääräinen… Hänessä itsessään oli piillyt paljon voimia, joiden
olemassaoloa hän tuskin oli osannut aavistaa, ja ne olivat särkeneet
heidän kauniin onnensa… Eräs jakso heidän elämässään oli taaskin
kulunut, mutta he eivät olleet oppineet senkään ajanjakson
taisteluista, myrskyistä ja kokemuksista mitään, sillä mitkään
tilanteet elämässä eivät uusiinnu samanlaisina, ja näin on elämä
koulua alusta loppuun saakka…

Hän oli kuvitellut voivansa opastaa elämän vaikeilla poluilla muita,


kokonaisia joukkoja, mutta kuinka hän voisi sitä, kun hän ei itsekään
osaa elää…

Albert katselee kauan edessään leikkivää Annikkia. Hänen suunsa


vetäytyy hymyyn.

Ihmiset etsivät helmeä aavan meren rantahiekasta eivätkä


huomaa, että se löytyy kätkettynä suljettuun simpukankuoreen…

Hän nousee seisomaan. Edessä loistavat valkeat kaupungit, ja


etäämmällä kukkivat saaret rannattomassa meressä. Hänen
takanansa hymyilee laskevan auringon valossa suorien katujen ja
kauniitten puistojen hurmaava kaupunki. Tuoksuva maatuuli käy
rajummaksi ja vierittää aaltoja ulapalle pois kauaksi merelle. Albertin
valtaa sanomaton halu niiden matkaan, pois kauaksi merien taa,
toisiin maihin, toisiin oloihin uusia vaikutelmia saamaan…

Loppuisipa vihdoinkin tämä hirvittävä sota, jossa toiset kuolevat,


toiset vanhenevat odottaessaan sen päättymistä… Yli noiden
vapaiden aaltojen, pois, kauaksi etelään, vain lyhyeksi aikaa, ja
sitten taas tänne takaisin uusin voimin, uusin innoin työhön…

Hän kutsuu Annikin syliinsä. Hän tahtoo kasvattaa edes yhdestä


olennosta onnellisen ihmisen.

Hän juttelee Annikille paljon hauskoja asioita. Annikki kuuntelee ja


leikkii hänen kellonsa vitjoilla. Hetkiseksi hän vaikenee ja katselee
Annikkia silmiin ja ajattelee itseksensä:

— Sinussa on minulla tarpeeksi nuorisoa. Olen onnellinen, jos


sinusta vihdoinkin löydän sen kalliin helmen, jota sieluni ikävöi. —
Mutta Annikille hän sanoo ääneen:

— Nyt me lähdemme kotiin äidin luo ja kerromme hänelle siitä,


mitä taaskin olemme kaupungilla nähneet.

Ja hän käveli taluttaen pientä Annikkia alas korkeita, puisia


portaita, jotka johtivat kaupungin puistoista kauneimpaan,
Kaivopuistoon, ja auringon laskussa kimaltelevat aallot vierivät pois
rannasta ulappaa kohti niinkuin hänen sielunsa salaisin kaipaus…
*** END OF THE PROJECT GUTENBERG EBOOK KOHTALON
TUULISSA ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.

You might also like