100% found this document useful (4 votes)
453 views

Instant ebooks textbook Neural Network Programming with Java Second Edition Fabio M. Soares download all chapters

Java

Uploaded by

thineaytor6
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
100% found this document useful (4 votes)
453 views

Instant ebooks textbook Neural Network Programming with Java Second Edition Fabio M. Soares download all chapters

Java

Uploaded by

thineaytor6
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/ 40

Get ebook downloads in full at ebookmeta.

com

Neural Network Programming with Java Second


Edition Fabio M. Soares

https://ebookmeta.com/product/neural-network-programming-
with-java-second-edition-fabio-m-soares/

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 Network Programming with Java 1st Edition Richard


M Reese

https://ebookmeta.com/product/learning-network-programming-with-
java-1st-edition-richard-m-reese/

ebookmeta.com

Learning Network Programming with Java 1st Edition Richard


M Reese

https://ebookmeta.com/product/learning-network-programming-with-
java-1st-edition-richard-m-reese-2/

ebookmeta.com

Artificial Neural Networks with Java: Tools for Building


Neural Network Applications, 2nd Edition Igor Livshin

https://ebookmeta.com/product/artificial-neural-networks-with-java-
tools-for-building-neural-network-applications-2nd-edition-igor-
livshin/
ebookmeta.com

Time Tamed 1st Edition Foulkes Nicholas

https://ebookmeta.com/product/time-tamed-1st-edition-foulkes-nicholas/

ebookmeta.com
Basics of 3D Printing 1st Edition Josef Prusa

https://ebookmeta.com/product/basics-of-3d-printing-1st-edition-josef-
prusa/

ebookmeta.com

Female Erogenous Blueprint 1st Edition School Of Squirt

https://ebookmeta.com/product/female-erogenous-blueprint-1st-edition-
school-of-squirt/

ebookmeta.com

Blood Fire Saga, Hades and Persephone 03.0 - Debauched 1st


Edition Bella Klaus

https://ebookmeta.com/product/blood-fire-saga-hades-and-
persephone-03-0-debauched-1st-edition-bella-klaus/

ebookmeta.com

Multiscale Dynamics Simulations Nano and Nano bio Systems


in Complex Environments 1st Edition Salahub

https://ebookmeta.com/product/multiscale-dynamics-simulations-nano-
and-nano-bio-systems-in-complex-environments-1st-edition-salahub/

ebookmeta.com

The Knights Templar An Enthralling History of the Rise and


Fall of the Most Influential Catholic Military Order Billy
Wellman
https://ebookmeta.com/product/the-knights-templar-an-enthralling-
history-of-the-rise-and-fall-of-the-most-influential-catholic-
military-order-billy-wellman/
ebookmeta.com
Dan the Barbarian A Gamelit Fantasy Adventure Gold Girls
and Glory Book 1 1st Edition Hondo Jinx

https://ebookmeta.com/product/dan-the-barbarian-a-gamelit-fantasy-
adventure-gold-girls-and-glory-book-1-1st-edition-hondo-jinx/

ebookmeta.com
Neural Network Programming
with Java
Second Edition

Create and unleash the power of neural networks


by implementing professional Java code

Fabio M. Soares
Alan M. F. Souza

BIRMINGHAM - MUMBAI
Neural Network Programming with Java
Second Edition

Copyright © 2017Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the authors, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.

First published: January 2016

Second edition: March 2017

Production reference:1080317

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham B3 2PB, UK.

ISBN 978-1-78712-605-3

www.packtpub.com
Credits

Authors Project Coordinator


Fabio M. Soares Kinjal Bari
Alan M. F. Souza
Proofreader
Reviewer Safis Editing
Charles Griffiths
Indexer
Commissioning Editor Mariammal Chettiyar
Vedika Naik
Graphics
Acquisition Editor Kirk D'Penha
Rahul Nair
Production Coordinator
Content Development Editor Aparna Bhagat
Trusha Shriyan
Cover Work
Technical Editor Aparna Bhagat
Naveenkumar Jain

Copy Editor
Safis Editing
About the Authors

Fábio M. Soares is currently a PhD candidate at the Federal University of Pará


(Universidade Federal do Pará - UFPA), in northern Brazil. He is very passionate
about technology in almost all fields, and designs neural network solutions since
2004 and has applied this technique in several fields like telecommunications,
industrial process control and modeling, hydroelectric power generation, financial
applications, retail customer analysis and so on. His research topics cover supervised
learning for data-driven modeling. As of 2017, he is currently carrying on research
projects with chemical process modeling and control in the aluminum smelting and
ferronickel processing industries, and has worked as a lecturer teaching subjects
involving computer programming and artificial intelligence paradigms. As an active
researcher, he has also a number of articles published in English language in many
conferences and journals, including four book chapters.

Alan M. F. Souza is computer engineer from Instituto de Estudos Superiores


da Amazonia (IESAM). He holds a post-graduate degree in project management
software and a master's degree in industrial processes (applied computing)
from Universidade Federal do Para (UFPA). He has been working with neural
networks since 2009 and has worked with Brazilian IT companies developing
in Java, PHP, SQL, and other programming languages since 2006. He is passionate
about programming and computational intelligence. Currently, he is a professor
at Universidade da Amazonia (UNAMA) and a PhD candidate at UFPA.
About the Reviewer

Charles Griffiths is a software engineer and college professor interested in


technology, medicine, economics, and nutrition. He publishes source code on
GitHub and the Unity Asset Store.

I'd like to thank my friends for pointing the way forward, and their
constant support no matter where I ended up going.
www.PacktPub.com

eBooks, discount offers, and more


Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.com
and as a print book customer, you are entitled to a discount on the eBook copy. Get in
touch with us at customercare@packtpub.com for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.

https://www.packtpub.com/mapt

Get the most in-demand software skills with Mapt. Mapt gives you full access to all
Packt books and video courses, as well as industry-leading tools to help you plan
your personal development and advance your career.

Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
Customer Feedback
Thank you for purchasing this Packt book. We take our commitment to improving
our content and products to meet your needs seriously—that's why your feedback
is so valuable. Whatever your feelings about your purchase, please consider leaving
a review on this book's Amazon page (https://www.amazon.com/
dp/1787126056). Not only will this help us, more importantly it will also help
others in the community to make an informed decision about the resources that
they invest in to learn.

You can also review for us on a regular basis by joining our reviewers' club. If you're
interested in joining, or would like to learn more about the benefits we offer, please
contact us: customerreviews@packtpub.com.
Table of Contents
Preface vii
Chapter 1: Getting Started with Neural Networks 1
Discovering neural networks 1
Why artificial neural networks? 2
How neural networks are arranged 4
The very basic element – artificial neuron 4
Giving life to neurons – activation function 5
The flexible values – weights 6
An extra parameter – bias 6
The parts forming the whole – layers 7
Learning about neural network architectures 8
Monolayer networks 8
Multilayer networks 9
Feedforward networks 9
Feedback networks 10
From ignorance to knowledge – learning process 10
Let the coding begin! Neural networks in practice 11
The neuron class 13
The NeuralLayer class 15
The ActivationFunction interface 16
The neural network class 17
Time to play! 19
Summary 21
Chapter 2: Getting Neural Networks to Learn 23
Learning ability in neural networks 24
How learning helps solving problems 24

[i]
Table of Contents

Learning paradigms 25
Supervised learning 25
Unsupervised learning 26
The learning process 27
The cost function finding the way down to the optimum 28
Learning in progress - weight update 29
Calculating the cost function 29
General error and overall error 30
Can the neural network learn forever? When is it good to stop? 31
Examples of learning algorithms 31
The delta rule 33
The learning rate 34
Implementing the delta rule 35
The core of the delta rule learning - train and calcNewWeight methods 36
Another learning algorithm - Hebbian learning 39
Adaline 41
Time to see the learning in practice! 42
Teaching the neural network – the training dataset 43
Amazing, it learned! Or, did it really? A further step – testing 47
Overfitting and overtraining 48
Summary 49
Chapter 3: Perceptrons and Supervised Learning 51
Supervised learning – teaching the neural net 52
Classification – finding the appropriate class 52
Regression – mapping real inputs to outputs 54
A basic neural architecture – perceptrons 56
Applications and limitations 56
Linear separation 57
The XOR case 58
Multi-layer perceptrons 60
MLP properties 61
MLP weights 62
Recurrent MLP 63
Coding an MLP 64
Learning in MLPs 65
Backpropagation algorithm 66
The momentum 68
Coding the backpropagation 68
Levenberg-Marquardt algorithm 72

[ ii ]
Table of Contents

Coding the Levenberg-Marquardt with matrix algebra 74


Extreme learning machines 77
Practical example 1 – the XOR case with delta rule and
backpropagation 80
Practical example 2 – predicting enrolment status 83
Summary 86
Chapter 4: Self-Organizing Maps 87
Neural networks unsupervised learning 87
Unsupervised learning algorithms 88
Competitive learning 89
Competitive layer 92
Kohonen self-organizing maps 93
Extending the neural network code to Kohonen 94
Zero-dimensional SOM 95
One-dimensional SOM 96
Two-dimensional SOM 98
2D competitive layer 100
SOM learning algorithm 102
Effect of neighboring neurons – the neighborhood function 104
The learning rate 106
A new class for competitive learning 106
Visualizing the SOMs 109
Plotting 2D training datasets and neuron weights 112
Testing Kohonen learning 113
Summary 119
Chapter 5: Forecasting Weather 121
Neural networks for regression problems 121
Loading/selecting data 123
Building auxiliary classes 123
Getting a dataset from a CSV file 126
Building time series 127
Dropping NaNs 129
Getting weather data 129
Weather variables 130
Choosing input and output variables 130
Preprocessing 132
Normalization 133
Adapting NeuralDataSet to handle normalization 137
Adapting the learning algorithm to normalization 138

[ iii ]
Table of Contents

Java implementation of weather forecasting 139


Collecting weather data 139
Delaying variables 142
Loading the data and beginning to play! 142
Let's perform a correlation analysis 144
Creating neural networks 148
Training and test 148
Training the neural network 149
Plotting the error 150
Viewing the neural network output 150
Empirical design of neural networks 151
Designing experiments 151
Results and simulations 152
Summary 155
Chapter 6: Classifying Disease Diagnosis 157
Foundations of classification problems 158
Categorical data 159
Working with categorical data 160
Logistic regression 160
Multiple classes versus binary classes 162
Confusion matrix 162
Sensitivity and specificity 163
Implementing a confusion matrix 164
Neural networks for classification 166
Disease diagnosis with neural networks 166
Breast cancer 166
Diabetes 170
Summary 173
Chapter 7: Clustering Customer Profiles 175
Clustering tasks 176
Cluster analysis 177
Cluster evaluation and validation 178
Implementation 178
External validation 179
Applied unsupervised learning 180
Kohonen neural network 180
Profiling 181
Pre-processing 181
Implementation in Java 182

[ iv ]
Table of Contents

Card – credit analysis for customer profiling 182


Product profiling 187
How many clusters? 188
Summary 189
Chapter 8: Text Recognition 191
Pattern recognition 192
Defined classes 192
Undefined classes 194
Neural networks in pattern recognition 194
Data pre-processing 195
Text recognition (optical character recognition) 196
Digit recognition 196
Digit representation 196
Implementation in Java 197
Generating data 197
Neural architecture 198
Experiments 198
Results 200
Summary 204
Chapter 9: Optimizing and Adapting Neural Networks 205
Common issues in neural network implementations 206
Input selection 207
Data correlation 207
Transforming data 208
Dimensionality reduction 208
Data filtering 210
Cross-validation 211
Structure selection 213
Online retraining 215
Stochastic online learning 216
Implementation 217
Application 217
Adaptive neural networks 220
Adaptive resonance theory 220
Implementation 220
Summary 222

[v]
Other documents randomly have
different content
As yet Russia’s mobilization was but partial.
This consummation the Berlin authorities, and still more those of
Vienna and Budapest, were straining every nerve to prevent. Even at
this twelfth hour, when every lever had been moved in vain to
eliminate Russia, a last expedient suggested itself to the resourceful
minds of the plotters. Could not Great Britain be induced to throw her
weight in the scale of the “peacemakers,” or, at any rate, to withdraw
it from the scale of the would-be belligerents? All she had to do was
to make a formal declaration without further delay that, pipe how the
allies might, she would refuse to take part in the war-dance. The
London Foreign Office has peace and war in its hands, they urged. If
Sir Edward Grey’s professions are sincere, now is the moment to act
up to them. Let him declare that he will not support Russia or France
if these Powers persist in forcing Germany and Austria into war, and
the situation will be eased at once. We here in Germany and Austria
know that Britain will keep aloof, but Russia and particularly France
think differently. If they were warned in time, all might yet be right
and the war would be localized. And various original expedients
were discussed for having the matter brought before his Majesty’s
Secretary of State for Foreign Affairs. I, too, was asked for my
opinion and suggestions. I uttered the former in words which I at
once made public. I stated that the British Government was sincerely
anxious to see peace speedily re-established in the Balkans and
safeguarded throughout Europe; that his Majesty’s Government had
done and still were engaged in doing everything calculated to
achieve these ends; that their hands were perfectly free and would
remain free so long as they could continue to discharge the functions
of peace-maker; and that if, contrary to their hope and expectation,
that task should become impossible, their action would be
determined by eventualities upon which, as they still lay in the region
of conjecture, it would be premature to speculate.
That neutrality was and would remain Great Britain’s card was
for long taken for granted. It was the last illusion to vanish.
It is worth noting that the pressure which Germany and Austria
sought to exert on the British Government in order to elicit a
declaration of neutrality, less as a policy—that being taken for
granted—than as a means of influencing Russia and France,
seemed equally desirable to the Tsar’s Government for the purpose
of obtaining a promise of naval and military support, and thus
deterring the two military States from their subversive designs. Thus
M. Sazonoff urged our Government to show their hand in this way.
But Sir George Buchanan replied that it would be a mistake to think
“that the cause of peace could be promoted by our telling the
German Government that they would have to deal with us as well as
with Russia and France if they supported Austria by force of arms.
Their attitude would merely be stiffened by such a menace, and we
could only induce her to use her influence at Vienna to avert war by
approaching her in the capacity of a friend who was anxious to
preserve peace. His Excellency must not, if our efforts were to be
successful, do anything to precipitate a conflict. In these
circumstances I trusted that the Russian Government would defer
the mobilization ukase as long as possible, and that troops would not
23
be allowed to cross the frontier even when it was issued.”
That was a statesmanlike view, and, coupled with the earnest
request made by our Government to M. Sazonoff that he would have
mobilization delayed as long as possible, it affords signal proof that
Great Britain marched perseveringly and with steadfast tread along
the road that led to peace, and strenuously exerted herself to draw
all other Powers after her. That is the answer to the allegations now
made by the German Government and its organs that Great Britain
provoked the war. Sir Edward Grey’s exertions to hinder the collision
were strenuous and persistent. They failed, and could not but fail,
seeing that Austria and Germany had bound themselves to carry out
a set aggressive plan, and were not open either to argument or
suasion. The sole difference between the two was that Austria-
Hungary relied upon Russia’s quiescence and was willing to
reconsider her attitude if that condition were not realized, whereas
Germany, while also acting on the same assumption, had made
ample provision for error, and was not to be turned from her scheme
even if Russia entered the lists. “The conviction had been expressed
to me by the German Ambassador on July 24th,” writes Sir M. de
Bunsen from Vienna, “that Russia would stand aside. This feeling,
which was also held at the Ballplatz, influenced, no doubt, the course
of events.”
Adopting the moderating counsel tendered by the British
Government, Russia at first proceeded only to partial mobilization.
But as even that legitimate measure of self-defence had been
prohibited—there is no more fitting term to suit the mode in which the
veto had been uttered—by Germany, the Russian Ambassador, as
soon as he heard of it, packed up his belongings and prepared to
quit Vienna. He then learned, however, to his surprise, that the
resources of diplomacy were not yet deemed to be exhausted, and
he resumed conversations with Count Berchtold and Baron Macchio.
On the same day I was apprized that certain Russian lighthouses on
the Black Sea had been ordered to put out their lights, and that the
Stock Exchange was closed for three days.
France’s behaviour during this rising tide of Teutonic aggression
testified to her settled resolve to avoid every measure of precaution
which might supply Germany with a pretext for diplomatic protest or
military aggression. Nor did she hesitate to sacrifice those initial
advantages which might be secured by such preliminary steps as all
nations menaced by war are wont to adopt. The War Office withdrew
their advance-posts to a distance of ten kilometres from the frontier,
and the local population were thus abandoned to the attack of the
German army. To my mind this is one of the most conclusive proofs
of the self-containment and pacific mood of the Entente Powers.
Great Britain sternly refusing to offer the slenderest encouragement
to either of her friends, and straining their forbearance to its
uttermost limits by demanding heavy strategical sacrifices of each in
the cause of conciliation; Russia holding her hand, contented to
follow Germany’s moves feebly and at intervals, and falling in with
every suggestion made in the interests of peace, however it might jar
with her sentiments or clash with her general policy; and France
drawing away her troops from the threatened frontiers while
Germany was mobilizing—these eloquent facts supply the most
complete answer to the questions who wanted and who began the
war.
“The Government,” M. Viviani explained, “wishes to make it clear
that in no case will France be the aggressor.” And the Government of
the Republic made this abundantly clear.
Germany took a different view of her rights and duties. On July
30th her advance-posts were moved forward to the French frontiers.
The 16th Corps from Metz and part of another corps from Treves
and Cologne occupied the frontier at Metz. Reservists were on their
way to Germany by tens of thousands, yet France abstained from
summoning a single recruit. The next move was also made by Berlin:
all Germany was proclaimed to be in a “state of war,” the Crown
Prince was appointed Commander of the First Division of the
Guards. Then, and only then, did Russia issue the order for general
mobilization. But even then she mollified the effect of this precaution
by announcing that it was not a signal for war, but merely an
intimation that her voice, too, must be heard in deciding the fate of
Servia. At the same time passenger traffic on the railways was
reduced, goods traffic suspended altogether, and Finland and the
province of Petersburg were declared in a state of siege.
This news came to Vienna, in a distorted form, through the
Prussian capital. It was affirmed that the Tsar and also M. Sazonoff
had broken their solemn promise not to mobilize during the
endeavours which the Kaiser was making to coax Austria into a
more pliant mood. This statement was, like so many others that
emanated from the same source, at variance with facts and intended
to mislead. Without the knowledge of those facts I at once recorded
my absolute conviction that this was a venomous calumny against
M. Sazonoff and his sovereign. We now know that what the Tsar
actually wrote to the Kaiser was this:

It is technically impossible to discontinue our military


operations, which are rendered necessary by Austria’s
mobilization. We are far from wishing for war, and so long as the
negociations with Austria regarding Servia continue, my troops
will not undertake any provocative action. I give thee my word
upon it.
That is a very different thing from an undertaking not to mobilize.
And as for the Kaiser coaxing his ally into a compliant mood, he and
his Ministers were stiffening her obstinacy, and when she did finally
give way, far from welcoming her decision, he quashed it himself by
his ultimatums to Russia and France. Neither France nor Russia had
at any moment during these stirring days kept step with Austria and
Germany in their military preparations. They deliberately and
ostentatiously lagged behind at the cost of precious time and
strategic advantages, and in the delusive belief that they were
dealing with two peace-loving States, whereas they were being
circumvented by two banded conspirators whose one aim was to
execute their plot at the lowest possible cost, and one of whom was
determined to execute it in any and every event.
I endeavoured to make this aspect of the collision as clear as the
restrictions of censorship would allow. No one capable of reading
and grasping the meaning of a cautiously worded warning could
mistake the import of the following passage of a message which I
sent to the Daily Telegraph on July 26th, fully a week before the die
had been cast. I wrote:

As I have explained, the assassination of the Archduke and


the greater or lesser degree of indirect responsibility for this
crime which may be ascribed to Servia’s public men are matters
which touch but the fringe of the question. The real issue lies
much deeper than the events of the last few weeks. It is of long
standing, and has been submitted time and again to the Servian
Government and people, who are therefore deemed to be in
possession of all the requisite data for coming to a definite
decision. Hence the probable refusal with which the Austrian
Ministers will meet such requests by one or all of the Entente
Powers. The German Government was kept accurately and fully
posted well in advance by reason of the far-reaching practical
decisions which the sequel of this action might suddenly and
peremptorily oblige her to take.
All the deliberation, therefore, on the Note and the
contingent necessity of following it up in ways unwelcome to
both allies, but unavoidable in certain circumstances, took place
beforehand, and, together with it, the requisite diplomatic and
military measures were adopted by the statesmen of Vienna and
Budapest before any overt action was undertaken. Vigilant
attention was paid to the choice of a propitious moment.
It was a moment when the sympathies of Europe were with
the Austro-Hungarian people, whose Soveriegn-designate was
cruelly slain by political assassins from Servia at the instigation
of men who occupied posts as public servants there. It was a
moment when the French nation, impressed by revelations
made in the Senate respecting its inadequate preparedness for
war, appears less than ever minded to take any diplomatic action
which might lead to a breach of the peace. It was a moment
when the cares of the British Government are absorbed in
forecasting and preparing for the fateful consequences of its
internal policy, which may, it is apprehended, culminate in civil
war. It was a moment when the President and Foreign Secretary
of the French Republic were absent in Russia, drinking toasts to
the peace of Europe and celebrating the concord and
brotherhood of the French and Russian peoples. It was a
moment when Russia herself is confronted with a problem of
revolutionary strikes, which, it is assumed, would set in with
oceanic violence if that Empire were to embark in war with the
Central European Powers.
Finally, it was the moment after Servia’s friend and mentor,
M. de Hartwig, the Russian Minister in Belgrade, had been
called to his last account, and King Peter’s Ministers were
obliged to come to a decision on the merits of the case alone,
without M. de Hartwig’s counsel, and without being able to
reckon with confidence upon any backing, military or even
diplomatic.
To imagine, therefore, that the Austro-Hungarian statesmen
would deliberately throw away any of the advantages offered by
this complex of favourable conditions would be to credit them
with a degree of naïveté uncommon among public men. The
object which the Austrian Emperor’s Ministers had in view when
presenting the Note was precisely to elicit a refusal, or
acceptance, pure and simple, not to wrangle about the wording
of conditions or diplomatic formulas. The average man in the
Dual Monarchy was afraid that the reply might be an
acquiescence, and he said so. His hope, which never hardened
into belief, was that Baron Giesl would receive a non possumus
for his answer.

To the British public this was as clear an exposé of the actual


situation and its bearings upon the peace of Europe as could well be
given.
All Europe, and in particular the British Foreign Office, was now
beginning to see that the open and secret moves of this fateful
chess-match were determined by Germany, who was the real player
throughout. Hence the redoubling of the efforts made to get Berlin to
utter the word which would have dispelled the storm-clouds. If the
Kaiser’s Government had intimated to Vienna their desire to see the
demands of the ultimatum modified, as they could have done, there
is no doubt that the answer would have been compliance. That this
step ought to have been taken, not only for peace’ sake, but also on
the merits of the case, can be shown from the announcement made
by the German Secretary of State himself. Sir Edward Grey wrote on
July 27th: “The German Secretary of State has himself said that
there were some things in the Austrian Note that Servia could hardly
be expected to accept.” Why, then, one may pertinently ask, did the
German Government not take exception to them? To this the only
rational answer is, because it approved, nay inspired, the policy of
asking for the impossible in order to elicit a refusal. If those
impossible demands had been withdrawn, Russia was ready to give
Austria a free hand. And Austria finally agreed to withdraw them, but
Germany vetoed her sudden moderation by presenting ultimatums to
Russia and France.
It was Germany, therefore, who plunged Europe into war.
For lest there should remain the shadow of a doubt as to the
leading part played by the Kaiser and his Ministers in picking the
quarrel with Servia and Russia, Sir Edward Grey left it to Berlin to
make any suggestions it cared to offer with a view to compromising
the differences.

I urged (he writes) that the German Government should


suggest any method by which the influence of the four Powers
could be used together to prevent war between Austria and
Russia. France agreed. Italy agreed. The whole idea of
mediation or mediating influence was ready to be put in
operation by any method that Germany could suggest, if mine
was not acceptable. In fact, mediation was ready to come into
operation by any method that Germany thought possible if only
24
Germany would “press the button” in the interests of peace.

This offer needs no comment. It laid the entire responsibility for


non-acceptance on the shoulders of the Kaiser and his advisers. It
was with Germany’s sabre that the statesmen of Vienna and
Budapest were endeavouring to frighten the Slavs. She had the right
and the duty to withhold her military support from an ally whose
cause was not just. And she owned in words that Austria’s cause
answered to this description. Yet she not only upheld that cause, but
took the initiative in furthering it, her motive being that Russia,
according to her information, was crippled and powerless, and could
now be discredited in the eyes of her protégées and humbled in the
dust. This was an opportunity that might not recur, and should,
therefore, be utilized to the fullest. Accordingly, Germany would
confront Russia with the choice between a diplomatic or a military
defeat.
That, in brief, was the Kaiser’s line of action.
And here we reach the parting of the ways of Austria and
Germany. The statesmen of Vienna dreaded war with Russia, and as
soon as it faced them drew back and lowered their tone. On July
27th Sir Edward Grey was informed by our Ambassador in Vienna
that the conversations between the Tsar’s Foreign Minister in St.
Petersburg and the Austrian Ambassador had been proceeding, and
the two negociators had made perceptible headway. “The former had
agreed that much of the Austro-Hungarian Note to Servia was
perfectly reasonable, and, in fact, they had practically reached an
understanding as to the guarantees which Servia might reasonably
be asked to give to Austria-Hungary for her future good behaviour.”
In other words, the main difficulty seemed to have been overcome.
But the German Ambassador in Vienna had still to be reckoned with.
This advocatus diaboli was determined that Russia should quaff the
cup of humiliation to the dregs. And he succeeded.
The very next day Count Berchtold, in answer to a request from
the Russian Ambassador in Vienna that the conversations in St.
Petersburg should be continued and that the Austrian Ambassador
there should be invested with full powers for the purpose, stated that
25
he was unable to comply with the request. On this same day
Russia ordered a partial mobilization, and declared that it connoted
no aggressive intention against Germany.
It was meant only as an admonition to Austria that, while anxious
to settle all differences in a friendly way, Russia was not quite so
incapacitated for military action as her neighbour imagined. It was a
perfectly legitimate reply to Austria’s partial mobilization and
declaration of war against Servia. Nobody was taken by surprise by
it except the two States which had set Russia down as militarily
powerless. And of these Austria was the more painfully impressed,
and showed this by a sudden infusion of the spirit of compromise
into her diplomatic methods. Two days later she reconsidered her
refusal to allow the conversations in St. Petersburg to be continued.
Count Berchtold received the Russian Ambassador in a friendly
manner, and apprized him that his request would be complied with,
and the negociations with M. Sazonoff would be resumed. And they
were resumed and worked out to what was rightly considered
success.
But Germany again stepped in—not, however, as mediator, but
as a marplot.
CHAPTER VIII
THE EARTHQUAKE

Austria-Hungary, sobered down by the tremendous consequences


of her obstinacy, which now loomed large, displayed a conciliatory
frame of mind. Her Ambassador in the Russian capital, implicitly
confessing that the ultimatum to Servia was an act of provocation,
wisely yielded on the crucial difference between the two
Governments, and assured M. Sazonoff that Austria would submit to
mediation the demands in the ultimatum which appeared destructive
of Servia’s independence. In other words, she gave way, and the
long-sought issue out of the deadlock was found, and found without
Germany’s assistance. What was wanted now was no longer
Germany’s active co-operation, but only her abstention from
mischief-making.
But the moment Austria became conciliatory Germany assumed
an attitude of sheer aggression which at once took the matter out the
diplomatic sphere and left no room for compromise.
On July 31st the earthquake came. Germany presented her
ultimatum to Russia, allowing her only twelve hours to issue the
order for demobilization. Twelve hours! It is impossible not to
recognize the same Hohenzollern touch in this document and that
other one which had been presented shortly before to Servia. They
both bear the impress of the monarch who once publicly said: “There
26
is but one will, and that is mine.” Contemptuous silence was the
only answer vouchsafed to this arrogant demand, which was
intended to cow the Tsar and his Ministers before they could consult
with their foreign friends. On August 1st the sheepish-looking
diplomatist who represented the mighty Kaiser in St. Petersburg
proceeded to the Foreign Office to deliver his last and fatal message
there, and, according to the papers, he transformed the awful
tragism of the moment into an incident worthy of an opéra bouffe by
handing to the Foreign Minister a paper one side of which contained
a declaration of war, while the other was a statement prepared for
the eventuality of Russia’s acquiescence. And with this claim to be
remembered in the history of involuntary humour Count Pourtalès
made his exit from public life.
In this odd way new actors were introduced into a drama which
had been originally composed only for three. The result was
exceedingly distasteful to the statesmen of Vienna, and Budapest. It
was recognized as a source of complications and difficulties which
had indeed been provided for, but which it would have been more
advantageous to separate and cope with in detail. All that now
remained for German diplomacy was to make absolutely sure of the
neutrality of Great Britain.
It may not be amiss, however, to lay before the reader the
instructive account of the final stages of diplomatic effort as sketched
by the British ex-Ambassador to the Court of Vienna in his
supplementary dispatch, dated London, September 1st:—

The delivery at Belgrade on July 23rd of the Austrian note to


Servia was preceded by a period of absolute silence at the
Ballplatz. Except Herr von Tschirschky, who must have been
aware of the tenour if not of the actual words of the note, none of
my colleagues was allowed to see through the veil. On July 22nd
and 23rd M. Dumaine, French Ambassador, had long interviews
with Baron Macchio, one of the Under Secretaries of State for
Foreign Affairs, by whom he was left under the impression that
the words of warning he had been instructed to speak to the
Austro-Hungarian Government had not been unavailing, and that
the note which was being drawn up would be found to contain
nothing with which a self-respecting State need hesitate to
comply. At the second of these interviews he was not even
informed that the note was at that very moment being presented
at Belgrade, or that it would be published in Vienna on the
following morning. Count Forgach, the other Under Secretary of
State, had indeed been good enough to confide to me on the
same day the true character of the note, and the fact of its
presentation about the time we were speaking.

The Bolt from the Blue.


So little had the Russian Ambassador been made aware of
what was preparing that he actually left Vienna on a fortnight’s
leave of absence about July 20th. He had only been absent a
few days when events compelled him to return. It might have
been supposed that Duc Avarna, Ambassador of the allied
Italian Kingdom, which was bound to be so closely affected by
fresh complications in the Balkans, would have been taken fully
into the confidence of Count Berchtold during this critical time. In
point of fact, his Excellency was left completely in the dark. As
for myself, no indication was given me by Count Berchtold of the
impending storm, and it was from a private source that I received
on July 15th the forecast of what was about to happen, which I
telegraphed to you the following day. It is true that during all this
time the Neue Freie Presse and other leading Viennese
newspapers were using language which pointed unmistakably to
war with Servia. The official Fremdenblatt, however, was more
cautious, and till the note was published the prevailing opinion
among my colleagues was that Austria would shrink from
courses calculated to involve her in grave European
complications.
On July 24th the note was published in the newspapers. By
common consent it was at once styled an ultimatum. Its integral
acceptance by Servia was neither expected nor desired; and
when, on the following afternoon, it was at first rumoured in
Vienna that it had been unconditionally accepted, there was a
moment of keen disappointment. The mistake was quickly
corrected, and as soon as it was known later in the evening that
the Servian reply had been rejected and that Baron Giesl had
broken off relations at Belgrade, Vienna burst into a frenzy of
delight, vast crowds parading the streets and singing patriotic
songs till the small hours of the morning.

War Against Servia Only.


The demonstrations were perfectly orderly, consisting for the
most part of organized processions through the principal streets,
ending up at the Ministry of War. One or two attempts to make
hostile manifestations against the Russian Embassy were
frustrated by the strong guard of police which held the
approaches to the principal Embassies during those days. The
demeanour of the people at Vienna, and, as I was informed, in
many other principal cities of the Monarchy, showed plainly the
popularity of the idea of war with Servia, and there can be no
doubt that the small body of Austrian and Hungarian statesmen
by whom this momentous step was adopted gauged rightly the
sense, and it may even be said the determination, of the people,
except presumably in portions of the provinces inhabited by the
Slav races. There had been much disappointment in many
quarters at the avoidance of war with Servia during the
annexation crisis in 1908 and again in connection with the recent
Balkan War. Count Berchtold’s peace policy had met with little
sympathy in the Delegation. Now the floodgates were opened,
and the entire people and Press clamoured impatiently for
immediate and condign punishment of the hated Servian race.
The country certainly believed that it had before it only the
alternative of subduing Servia or of submitting sooner or later to
mutilation at her hands. But a peaceful solution should first have
been attempted. Few seemed to reflect that the forcible
intervention of a Great Power in the Balkans must inevitably call
other Great Powers into the field. So just was the cause of
Austria held to be, that it seemed to her people inconceivable
that any country should place itself in her path, or that questions
of mere policy or prestige should be regarded anywhere as
superseding the necessity which had arisen to exact summary
vengeance for the crime of Sarajevo. The conviction had been
expressed to me by the German Ambassador on July 24th that
Russia would stand aside. This feeling, which was also held at
the Ballplatz, influenced, no doubt, the course of events, and it is
deplorable that no effort should have been made to secure by
means of diplomatic negociations the acquiescence of Russia
and Europe as a whole in some peaceful compromise of the
Servian question by which Austrian fears of Servian aggression
and intrigue might have been removed for the future. Instead of
adopting this course, the Austro-Hungarian Government
resolved upon war. The inevitable consequence ensued. Russia
replied to a partial Austrian mobilization and declaration of war
against Servia by a partial Russian mobilization against Austria.
Austria met this move by completing her own mobilization, and
Russia again responded with results which have passed into
history.

Russia had no Right to Intervene.


On July 28th I saw Count Berchtold and urged as strongly as
I could that the scheme of mediation mentioned in your speech
in the House of Commons on the previous day should be
accepted as offering an honourable and peaceful settlement of
the question at issue. His Excellency himself read to me a
telegraphic report of the speech, but added that matters had
gone too far; Austria was that day declaring war on Servia, and
she could never accept the conference which you had
suggested should take place between the less interested
Powers on the basis of the Servian reply. This was a matter
which must be settled directly between the two parties
immediately concerned. I said his Majesty’s Government would
hear with regret that hostilities could not be arrested, as you
feared they would lead to European complications. I disclaimed
any British lack of sympathy with Austria in the matter of her
legitimate grievances against Servia, and pointed out that,
whereas Austria seemed to be making these the starting-point of
her policy, his Majesty’s Government were bound to look at the
question primarily from the point of view of the maintenance of
the peace of Europe. In this way the two countries might easily
drift apart.
His Excellency said that he, too, was keeping the European
aspect of the question in sight. He thought, however, that Russia
would have no right to intervene after receiving his assurance
that Austria sought no territorial aggrandisement. His Excellency
remarked to me in the course of his conversation that, though he
had been glad to co-operate towards bringing about the
settlement which had resulted from the ambassadorial
conferences in London during the Balkan crisis, he had never
had much belief in the permanency of that settlement, which was
necessarily of a highly artificial character, inasmuch as the
interests which it sought to harmonize were in themselves
profoundly divergent. His Excellency maintained a most friendly
demeanour throughout the interview, but left no doubt in my
mind as to the determination of the Austro-Hungarian
Government to proceed with the invasion of Servia.

Austria Yields at Last.


The German Government claim to have persevered to the
end in the endeavour to support at Vienna your successive
proposals in the interest of peace. Herr von Tschirschky
abstained from inviting my co-operation or that of the French and
Russian Ambassadors in carrying out his instructions to that
effect, and I had no means of knowing what response he was
receiving from the Austro-Hungarian Government. I was,
however, kept fully informed by M. Schebeko, the Russian
Ambassador, of his own direct negociations with Count
Berchtold. M. Schebeko endeavoured on July 28th to persuade
the Austro-Hungarian Government to furnish Count Szapary with
full powers to continue at St. Petersburg the hopeful
conversations which had there been taking place between the
latter and M. Sazonoff. Count Berchtold refused at the time, but
two days later (July 30th), though in the meantime Russia had
partially mobilized against Austria, he received M. Schebeko
again, in a perfectly friendly manner, and gave his consent to the
continuance of the conversations in St. Petersburg. From now
onwards the tension between Russia and Germany was much
greater than between Russia and Austria. As between the latter
an arrangement seemed almost in sight, and on August 1st I
was informed by M. Schebeko that Count Szapary had at last
conceded the main point at issue by announcing to M. Sazonoff
that Austria would consent to submit to mediation the points in
the Note to Servia which seemed incompatible with the
maintenance of Servian independence. M. Sazonoff, M.
Schebeko added, had accepted this proposal on condition that
Austria would refrain from the actual invasion of Servia. Austria,
in fact, had finally yielded, and that she herself had at this point
good hopes of a peaceful issue is shown by the communication
made to you on August 1st by Count Mensdorff, to the effect that
Austria had neither “banged the door” on compromise nor cut off
the conversations. M. Schebeko to the end was working hard for
peace. He was holding the most conciliatory language to Count
Berchtold, and he informed me that the latter, as well as Count
Forgach, had responded in the same spirit. Certainly it was too
much for Russia to expect that Austria would hold back her
armies, but this matter could probably have been settled by
negociation, and M. Schebeko repeatedly told me he was
prepared to accept any reasonable compromise.

Germany Enters the Lists.


Unfortunately, these conversations at St. Petersburg and
Vienna were cut short by the transfer of the dispute to the more
dangerous ground of a direct conflict between Germany and
Russia. Germany intervened on July 31st by means of her
double ultimatums to St. Petersburg and Paris. The ultimatums
were of a kind to which only one answer is possible, and
Germany declared war on Russia on August 1st, and on France
on August 3rd. A few days’ delay might in all probability have
saved Europe from one of the greatest calamities in history.
Russia still abstained from attacking Austria, and M.
Schebeko had been instructed to remain at his post till war
should actually be declared against her by the Austro-Hungarian
Government. This only happened on August 6th, when Count
Berchtold informed the foreign missions at Vienna that “the
Austro-Hungarian Ambassador at St. Petersburg had been
instructed to notify the Russian Government that, in view of the
menacing attitude of Russia in the Austro-Servian conflict, and
the fact that Russia had commenced hostilities against
Germany, Austria-Hungary considered herself also at war with
Russia.”

The Ambassadors Make their Exit.


M. Schebeko left quietly in a special train provided by the
Austro-Hungarian Government on August 7th. He had urgently
requested to be conveyed to the Rumanian frontier, so that he
might be able to proceed to his own country, but was taken
instead to the Swiss frontier, and ten days later I found him at
Berne.
M. Dumaine, French Ambassador, stayed on till August 12th.
On the previous day he had been instructed to demand his
passport on the ground that Austrian troops were being
employed against France. This point was not fully cleared up
when I left Vienna. On August 9th M. Dumaine had received
from Count Berchtold the categorical declaration that no Austrian
troops were being moved to Alsace. The next day this statement
was supplemented by a further one, in writing, giving Count
Berchtold’s assurance that not only had no Austrian troops been
moved actually to the French frontier, but that none were moving
from Austria in a westerly direction into Germany in such a way
that they might replace German troops employed at the front.
These two statements were made by Count Berchtold in reply to
precise questions put to him by M. Dumaine, under instructions
from his Government. The French Ambassador’s departure was
not attended by any hostile demonstration, but his Excellency
before leaving had been justly offended by a harangue made by
the Chief Burgomaster of Vienna to the crowd assembled before
the steps of the Town Hall, in which he assured the people that
Paris was in the throes of a revolution and that the President of
the Republic had been assassinated.
The British declaration of war on Germany was made known
in Vienna by special editions of the newspapers about midday
on August 5th. An abstract of your speeches in the House of
Commons, and also of the German Chancellor’s speech in the
Reichstag of August 4th, appeared the same day, as well as the
text of the German ultimatum to Belgium. Otherwise few details
of the great events of these days transpired. The Neue Freie
Presse was violently insulting towards England. The
Fremdenblatt was not offensive, but little or nothing was said in
the columns of any Vienna paper to explain that the violation of
Belgian neutrality had left his Majesty’s Government no
alternative but to take part in the war.
The declaration of Italian neutrality was bitterly felt in Vienna,
but scarcely mentioned in the newspapers.
On August 5th I had the honour to receive your instruction of
the previous day preparing me for the immediate outbreak of war
with Germany, but adding that, Austria being understood to be
not yet at that date at war with Russia and France, you did not
desire me to ask for my passport or to make any particular
communication to the Austro-Hungarian Government. You stated
at the same time that his Majesty’s Government of course
expected Austria not to commit any act of war against us without
the notice required by diplomatic usage.
On Thursday morning, August 13th, I had the honour to
receive your telegram of the 12th, stating that you had been
compelled to inform Count Mensdorff, at the request of the
French Government, that a complete rupture had occurred
between France and Austria, on the ground that Austria had
declared war on Russia, who was already fighting on the side of
France, and that Austria had sent troops to the German frontier
under conditions that were a direct menace to France. The
rupture having been brought about with France in this way, I was
to ask for my passport, and your telegram stated, in conclusion,
that you had informed Count Mensdorff that a state of war would
exist between the two countries from midnight of August 12th.

Traditional Austrian Courtesy.


After seeing Mr. Penfield, the United States Ambassador,
who accepted immediately in the most friendly spirit my request
that his Excellency would take charge provisionally of British
interests in Austria-Hungary during the unfortunate interruption
of relations, I proceeded, with Mr. Theo Russell, Counsellor of
his Majesty’s Embassy, to the Ballplatz. Count Berchtold
received me at midday. I delivered my message, for which his
Excellency did not seem to be unprepared, although he told me
that a long telegram from Count Mensdorff had just come in, but
had not yet been brought to him. His Excellency received my
communication with the courtesy which never leaves him. He
deplored the unhappy complications which were drawing such
good friends as Austria and England into war. In point of fact, he
added, Austria did not consider herself then at war with France,
though diplomatic relations with that country had been broken
off. I explained in a few words how circumstances had forced
this unwelcome conflict upon us. We both avoided useless
argument. Then I ventured to recommend to his Excellency’s
consideration the case of the numerous stranded British subjects
at Carlsbad, Vienna, and other places throughout the country. I
had already had some correspondence with him on the subject,
and his Excellency took a note of what I said, and promised to
see what could be done to get them away when the stress of
mobilization should be over. Count Berchtold agreed to, Mr.
Phillpotts, till then British Consul at Vienna under Consul-
General Sir Frederick Duncan, being left by me at the Embassy
in the capacity of Chargé des Archives. He presumed a similar
privilege would not be refused in England if desired on behalf of
the Austro-Hungarian Government. I took leave of Count
Berchtold with sincere regret, having received from the day of
my arrival in Vienna, not quite nine months before, many marks
of friendship and consideration from his Excellency. As I left I
begged his Excellency to present my profound respects to the
Emperor Francis Joseph, together with an expression of my
hope that his Majesty would pass through these sad times with
unimpaired health and strength. Count Berchtold was pleased to
say he would deliver my message.
Count Walterskirchen, of the Austro-Hungarian Foreign
Office, was deputed the following morning to bring me my
passport and to acquaint me with the arrangements made for my
departure that evening (August 14th). In the course of the day
Countess Berchtold and other ladies of Vienna society called to
take leave of Lady de Bunsen at the Embassy. We left the
railway station by special train for the Swiss frontier at 7 p.m. No
disagreeable incidents occurred. Count Walterskirchen was
present at the station on behalf of Count Berchtold. The journey
was necessarily slow, owing to the encumbered state of the line.
We reached Buchs, on the Swiss frontier, early in the morning of
August 17th. At the first halting place there had been some
hooting and stone throwing on the part of the entraining troops
and station officials, but no inconvenience was caused, and at
the other large stations on our route we found that ample
measures had been taken to preserve us from molestation as
well as to provide us with food. I was left in no doubt that the

You might also like