Sunday, December 27, 2020

Hands-On Machine Learning with Scikit-Learn and TensorFlowHands-On Machine Learning with Scikit-Learn and TensorFlow by Aurélien Géron
My rating: 5 of 5 stars

"Machine Learning is the science (and art) of programming computers so they can learn from data."

It is December 27th, four days until the end of the year, and I am four books short of my Goodreads 2020 Reading Challenge goal of 60 books. Never abandon hope! I will review two computer science books that were tremendously important to me and my students in 2020, books that helped me return to the field of neural networks and machine learning in general and helped my outstanding research student complete her challenging and advanced research project with extraordinary success.

I worked with neural networks (NN) in the late 1980s and early 1990s and even co-taught a psychology/computer science course on neural network learning. However, in the 1990s it had become clear that the limits of what the then traditional NN architecture can achieve had been reached and the scientific community basically abandoned NNs as the preferred approach to machine learning. Yet beginning in the first decade of the 21st century we witnessed the rebirth of the NN idea, primarily via various multi-level NN models, such as convolutional neural networks (CNNs) developed by Le Cun, Hinton, and others. Currently, CNNs achieve truly spectacular (without exaggeration one can say 'superhuman') results in various areas of artificial intelligence (AI) and machine learning (ML).

The recent explosion of research and commercial interest in ML resulted in an avalanche of books published on the topic, particularly "popular" books (ones that can serve as tutorials of sorts), addressed to computer science practitioners of various level of preparation, from complete novices to advanced. The range of quality of the books is even more vast. I worked with, read, or at least scanned thoroughly over 20 ML books and to me Hands-On Machine Learning is by far the best text, one that can serve for a wide variety of purposes: on one hand, it can serve as an ML textbook, on the other it can be used as a tutorial for particular methods of ML. (I will review the other great ML book, one that focuses purely on NN, the day after tomorrow. By the way, I was amazed how many bad, totally useless ML books have been published. Christmas spirit prevents me from listing their titles.)

Aurélien Géron, the author of Hands-On Machine Learning, comes with impressive industry credentials. He served as the Product Manager of YouTube video classification at Google, and held several senior positions in artificial intelligence engineering in various companies.

The first two chapters of the book, which belong to the first part entitledThe Fundamentals of Machine Learning, are an absolute must read for anyone interested in studying ML. The author presents the 'landscape of machine learning' and shows a typical ML project 'end-to-end', including data preparation and preprocessing as well as selecting, training, and fine-tuning the model.

The next six chapters of Part I focus on specific ML approaches and their mathematical background. We read about the methods of classification, the Support Vector Machines approach, including the 'kernel trick,' decision trees, ensemble learning and random forests. I love the solid yet very accessible presentation of the math background in the chapter on gradient descent, various types of regression, and regularization. Part I closes with a nice chapter about dimensionality reduction, which focuses on the method of Principal Component Analysis.

Part II of the book, titled Neural Networks and Deep Learning, gives a great overview of the so-called 'deep learning' approach: the reader will learn about the 'classical' NN approach, and then will be gradually introduced to the multi-level NN architecture, CNNs, recurrent NNs, and autoencoders.

The author's reliance on the production-ready Scikit-Learn and TensorFlow Python frameworks rather than on developing own toy versions of various algorithms is commendable. Scikit-Learn, a free software library of machine learning tools, is one of the best things developed in computer science in the last 50 years. It is a splendid manifestation of the power of open-source software.

From a teacher's point of view, the book is excellent! I believe Hands-On Machine Learning is great for the students too. It comes with a lot of interesting Python code samples, in the form of Jupyter notebooks. And the code works! The students can learn a lot by rewriting and extending the sample code.

Very, very highly recommended book! And I am going to round up my extremely high rating of

Four-and-a-half stars.

View all my reviews

Wednesday, May 6, 2020

Bad BloodBad Blood by Lorna Sage
My rating: 5 of 5 stars

"Gail had a gift for intentness. She could caress shapeless moments [...] as if she was stroking a puppy, until they wriggled into life and sucked your fingers."

[This review is dedicated to EVK, my outstanding student, who gave me this book.]

Lorna Sage's Bad Blood (2000) is an extraordinary literary work! I could not believe that it is non-fiction. I felt everything was so real as if it were a work of fiction by a great writer. Non-fiction books almost never feel real to me because they do not transcend the particular, the specific, the individual. Their meaning and reach are constrained by the connection to concrete facts, like a balloon that wants to soar high in the sky but is tied to a child's hand. Fiction books are able to much better convey the truth since they allow the reader to focus more on the humanness in general rather than on particular people or concrete events.

Ms. Sage's prose is fabulous! She is an extraordinarily accomplished writer with a wonderful turn of the phrase. Just take this "caressing shapeless moments until they wriggle into life" phrase from the epigraph. Reading this I instantaneously recalled people who had this gift. How many of us, though, would have the talent to describe them in this apparently frivolous yet extremely precise way? A metaphor like that carries more meaning than a faithful and detailed account of real-life behavior.

But wait, there is more: Ms. Sage has written one of three best accounts of childhood and adolescence that I have ever read, along with J. Joyce's and J.M. Coetzee's (which are perhaps more universal and realistic as they are at least in part fictional). Playing doctor in the bushes, the horror of braces, schooling torture and malevolent teachers, like the one in the following, unforgettable passage:
"One day he lined up his class and went down the line saying with gloomy satisfaction 'You'll be a muck-shoveller, you'll be a muck-shoveller...' and so on and on [...]"
Still more: the magnificent account of the first school dance, a momentous event in a schoolchild's life. For me, also the mention of Paul Anka's song Diana! The event must have taken place about 1962. Well, I had my first school dance around that time too, and I also remember the horrors of worrying who, if anyone, I would dance with; and I also counted one, two, three, under my breath while "dancing." And, yes, Paul Anka's Diana was there too! A sort of disclaimer is needed: maybe I like the memoir so much because the author belongs to my generation?

The author's grandparents on her mother's side are the main focus of the memoir. Their hatred towards each other is the dominating motif:
"So married were Grandpa and Grandma that they offended each other by existing and he must have hated the prospect of gratifying her by going first. On the other hand she truly feared death, thus he could score points by hailing it as a deliverance and embracing his fate."
The entire thread of the grandfather's diary is stunningly well constructed and presented. The diary itself and the author's commentary seamlessly move from one to the other.

I could keep enumerating the literary values of the memoir, but the review is already too long. Let me only mention that we get an evocative account of life in deeply provincial Great Britain in the 1950s and 1960s. Oh, and my three favorite sentences:
"[...] it's a good idea to settle for a few loose ends [in a story], because even if everything in your life is connected to everything else, that way madness lies."
And what about
"He too was only fifteen, but he smoked and drank, and was fed up with being so young."
And let's end with the best quote about the ending:
"It's the sense of an ending that's timeless.
Four-and-a-half stars, and I am rounding up. Yay! First maximum rating since February.

View all my reviews

Monday, February 24, 2020

Seven Brief Lessons on PhysicsSeven Brief Lessons on Physics by Carlo Rovelli
My rating: 5 of 5 stars

"Ever since we discovered that Earth is round and turns like a mad spinning-top, we have understood that reality is not as it appears to us: every time we glimpse a new aspect of it, it is a deeply emotional experience. Another veil has fallen."

In Preface, the author of Seven Brief Lessons on Physics, Carlo Rovelli, a renowned theoretical physicist and a philosopher of science, addresses his book to "those who know little or nothing about modern science." Although I am an applied mathematician, an engineer, and have even taught a course on mechanics (a classical part of physics), I know very little - really next to nothing - about modern physics. I have learned a lot from that tiny book (total of 81 pages!) and I absolutely love Dr. Rovelli's amazing way of making some basic tenets of contemporary physics almost understandable by amateurs like myself. This is the best popular science writing I have ever read!

The first lesson deals with "the most beautiful of theories" - Einstein's general theory of relativity. We read wonderful passages like
"[...] the gravitational field is not diffused through space; the gravitational field is that spaceitself."
We then read about curvature of space and that "it isn't only space that curves; time does too." The second lesson focuses on quantum mechanics, which in layman's terms posits that energy is discrete rather than continuous. And it is here that to my delight (and likely to screams of horror of many people) randomness and probability appear! Dr. Rovelli states at the end of the chapter that the equations of quantum mechanics and their consequences "remain mysterious," and suggests an idea that "reality [of the physical world] is only interaction." So cool!

I am omitting two next chapters in my summary, Architecture of the Cosmos and Particles (with its Standard Model, confirmed experimentally in 2013 yet still considered unsatisfactory). The Fifth Lesson focuses on the contradictions between the current form of the two main theories of physics - general relativity and quantum mechanics - and on the current efforts of physicists to combine the two theories. One such effort is the loop quantum gravity theory and Dr. Rovelli, in extreme modesty, neglects to write that he is one of the founders (if not the main founder - that I do not know) of the theory.

Naturally, the lesson titled Probability, Time, and the Heat of Black Holes, is my favorite! Even a mention of the word "probability" makes my heart beat faster and here it becomes a central mechanism of physics. Dr. Rovelli writes
"This bringing of probability to the heart of physics, and using it to explain the bases of the dynamics of heat, was initially considered to be absurd."
And what about the following stunning passage:
"[...] the intimate connection between time and heat. There is a detectable difference between the past and the future only when there is the flow of heat. Heat is linked to probability; and probability in turn is linked to the fact that our interactions with the rest of the world do not register the fine details of reality."
Finally, in the lesson called In Closing, the author writes about "ourselves" - us, the humans. He dwells on the nature of consciousness and the issue of free will. In a passage that unfortunately becomes more and more relevant with each passing year he points out the "incomprehension and distrust of science shown by a significant part of our contemporary culture." He also offers a sobering prediction that "our species will not last long" and alludes to the damage that the species keeps doing.

A beautifully written book about Very Difficult Things.

Five stars.


View all my reviews

Friday, December 20, 2019

The Last LectureThe Last Lecture by Randy Pausch
My rating: 5 of 5 stars

"Time is all you have. And you may find one day that you have less than you think."

The Last Lecture (2008), a New York Times bestseller, is a wonderful book indeed. For once, even such an avowed cynic and elitist as this reviewer agrees with most other readers. The book was written by a professional author, Jeffrey Zaslow, from tapes recorded by Randolph Pausch, a professor of computer science who died of cancer before reaching the age of 48. The book expands on the main topics of the actual last lecture that Dr. Pausch gave at Carnegie Mellon University after he had been given a diagnosis of only a few months to live. Yet The Last Lecture is not about dying, but an upbeat meditation on how to live:
"I lectured about the joy of life, about how much I appreciated life, even with so little of mine left. I talked about honesty, integrity, gratitude, and other things I hold dear."
The leading motif in Dr. Pausch's book is the life-driving importance of striving to achieve one's childhood dreams:
Whatever my accomplishments, all of the things I loved were rooted in the dreams and goals I had as a child... and in the ways I had managed to fulfill almost all of them."
Naturally, there is a lot about teaching in this short book and as a university professor myself I read these passages with great interest. I agree with the author that although
"[i]t is an accepted cliché in education that the number one goal of teachers should be to help students learn how to learn"
a better teaching goal is
"...to help students learn how to judge themselves."
One will find a lot of first-class, non-trivial advice on how to live, where some of the recommendations are real pearls of wisdom. Just take this:
"I'll take an earnest person over a hip person every time, because hip is short-term. Earnest is long term."
And the deepest and most beautiful sentence in the entire book about one of these things that make life worth living:
"It's a thrill to fulfill your own childhood dreams, but as you get older, you may find that enabling the dreams of others is even more fun."
Down-to-earth, simple wisdom is there too, for instance about shortcuts to success
"A lot of people want a shortcut. I find the best shortcut is the long way, which is basically two words: work hard."
Very, very strongly recommended read.
(This review is dedicated to EVK.)

Four-and-a-half stars.

View all my reviews

Wednesday, October 9, 2019

Brain DroppingsBrain Droppings by George Carlin
My rating: 5 of 5 stars

"They say if you outlaw guns, only outlaws and criminals will have guns. Well, shit, those are precisely the people who need them."

Note to myself: Never again read a collection of George Carlin's musing on the trolley, when commuting to work! The trolley was quite crowded, only one available seat which I took, my co-passengers cramped and then I started exploding with laughter. I did everything to contain myself: to no avail! Poor people around me were stiff with fear of this giggling maniac in their midst.

Not everybody will like Mr. Carlin's humor: dark, cynical, deeply disappointed with the human species. George Carlin, famous for his "seven dirty words" routine, is one of the most influential stand-up comics of all time. Extremely opinionated and ruthless in his criticisms of all manifestations of human stupidity, hypocrisy, and evil:
"This species is a dear, hateful, sweet, barbaric, tender, vile, intelligent, confused, virtuous, evil, thoughtful, perverted, generous, greedy species. In short, great entertainment."
I am also opinionated and my opinions coincide with his in almost every aspect of his criticism of the human race. I am just thousand times less funny than he is and also I do not have the courage to express my opinions out loud. Take the epigraph quote about guns: why would any normal, average person need a gun? How would I ever use a gun in my life? I believe that only outlaws and criminals really need guns. I am certainly for outlawing guns for regular people.

Mr. Carlin is merciless particularly about us, the "Americans":
Traditional American values: Genocide, aggression, conformity, emotional repression, hypocrisy, and the worship of comfort and consumer goods."
Also:
"The keys to America: the cross, the brew, the dollar, and the gun."
In addition to making bitter fun of people's fascination with violence, religion, sports, television, etc. the main target of Mr. Carlin's hard-hitting satire is the language. First, he attacks the various language inconsistencies, clichés, oxymorons, and redundancies, like in
"Unique needs no modifier. Very unique, quite unique, more unique, real unique, fairly unique and extremely unique are wrong, and they mark you as dumb. Although certainly not unique."
But it is the critique of euphemisms ("I don't like euphemisms. Euphemisms are a form of lying." Precisely!) and politically correct speech that is the most devastating. I do not have the courage to quote Mr. Carlin's musings in this area. But I certainly agree with him.

The reader will find some bittersweet humor, slightly tinged with melancholy, like in:
"There's an odd feeling you get when someone on the sidewalk moves slightly to avoid walking into you. It proves you exist. Your mere existence caused them to alter their path. It's a nice feeling. After you die, no one has to get out of your way anymore."
and also completely silly yet unbelievably hilarious quotes like
"One time, a few years ago, Oprah had a show about women who fake orgasms. Not to be outdone, Geraldo came right back with a show about men who fake bowel movements."
The reader will also find the famous monologue about "stuff" in its entirety.

George Carlin's Brain Droppings (1997) is the third most hilarious book I have read in my life (after Wstep do imagineskopii (not translated from Polish to English, and most likely untranslatable) and The Third Policeman . I am rounding the rating up. Yay!

Four-and-a-half stars.

View all my reviews

Wednesday, July 10, 2019

Introduction to Probability: Second Revised EditionIntroduction to Probability: Second Revised Edition by Charles M. Grinstead
My rating: 5 of 5 stars

"One may summarize these results by stating that one should not get drunk in more than two dimensions."

The above is the most extraordinary sentence one can find in a university textbook on advanced mathematics! Charles M. Grinstead's and J. Laurie Snell's Introduction to Probability (Second Edition, 1997) is indeed a most remarkable textbook, by far the best text that I have ever used in my almost 40 years of teaching undergraduate mathematics and computer science. Probability was my favorite field of mathematics during my own studies in the early 1970s, but I somehow avoided teaching it, most likely because I had not found a textbook that I really liked. Until Grinstead and Snell.

Standard textbooks heavily focus on the combinatorial aspects of probability, which do not interest me too much. When I teach the upper-division probability course I love to emphasize the calculus-based approach, particularly when it involves multidimensional calculus and its applications to joint probability distributions. Grinstead and Snell's approach is virtually tailor-made for my probability course.

The second factor that makes me love the textbook is the emphasis on random numbers and pseudo-random variables generation. Having worked in the field of mathematical modeling and simulation for over 40 years I believe this is a natural approach to ground the probability course in. Grinstead and Snell's geometry-based problems that use the cumulative distribution functions to find the densities are a wonderful teaching tool: the students can also appreciate the applications of calculus: many of my students seemed to like discovering the connections.

Yet another great feature of the textbook is its emphasis on the moment generating function. Naturally, it is used to prove the Central Limit Theorem, the fundamental theorem of probability and the foundation of statistics. I follow the mathematical argument in class every time I teach the course so that math majors can appreciate a little more elaborate proof than the usual toy ones.

I also love the inclusion of a chapter of random walks (from which the epigraph is taken). When teaching partial differential equations (another of my favorite fields in math) I often discuss the Tour du Wino method of numerically solving the Laplace equation, which uses the random walks approach. The authors provide the famous proof by Pólya, which shows that a random walk must eventually return to the origin in one or two dimensions, but not necessarily for higher dimensions.

Of many other nice features of the textbook I should mention the authors' clear treatment of the Bayes' Theorem and the fascinating Historical Remarks that accompany many chapters. A truly wonderful book! The best textbook I have ever used!

Five stars.


View all my reviews

Sunday, April 28, 2019

The SeaThe Sea by John Banville
My rating: 5 of 5 stars

"What a little vessel of sadness we are, sailing in this muffled silence through the autumn dark."

"The past beats inside me like a second heart."

John Banville's The Sea (2005) offered me one of the most remarkable literary experiences of my life. After just a few pages I knew I was reading a magnificent novel. By mid-book I was absolutely certain this was one of the very best books I had ever read. And I kept reading, very slowly, savoring the masterful prose. And then... Then the ending came, the last few pages where the author suddenly decided to explain things, and some of the extraordinary charm of the novel instantaneously dissipated. Real life turned into a story; human truth turned into a plot. What a disappointing moment!

The Sea is a masterpiece fully deserving its Man Booker Prize; I will naturally round the rating up to five stars, but - to me - it is no longer a novel unique in its greatness, which it had been until the ending. In this inept but heartfelt review I am trying to convey my early feelings about the novel before the very ending broke the spell.

There is no linearity in life; life is not a story. Things in life occur for no reason and for no reason they do not occur either. Life is a jumbled collage of events that had once happened. The present is the accumulation of the past, but they also exist concurrently and one flows through the cracks of the other:
"[...] it all has begun to run together, past and possible future and impossible present."
Max Morden, a retired art historian, is an 11-year-old boy, playing on the beach with the Grace family, his wife Anna is dead, the boy falls in love with Mrs. Grace while Anna is dying "leaning sideways from the hospital bed, vomiting on to the floor," and the boy falls out of love with Mrs. Grace during an erotic experience at the beach, Anna is getting the death sentence from the doctor and the magical moment with Mrs. Grace - the culmination of the boy's love - begins to happen
"[...] in that Edenic moment at what was suddenly the centre of the world [...] and blonde Mrs. Grace offering me an apple [...]"
But the magic of the moment is broken by a hurricane of events. And it all begins and ends with the sea, the great infinity that created us and then absorbs us.

So deeply human the novel is that - although nothing even remotely similar ever happened to me - I feel all these events belong to me as they belong to all people. I feel that my past and everybody else's past merge with Max Morden's past in the universal human past. The truth of the elderly art historian, a grieving widower who is the 11-year-old boy in love with a mature woman is my truth and the truth of all people.

There is so much more in the novel: there is Claire, Max's "ungainly, unpretty daughter," and there are unforgettable Miss Vavasour and the Colonel. The boy's disgust at the mingling of God and sex, and a fragment seemingly taken straight out of another of my favorite authors, Cees Nooteboom:
"We carry the dead with us only until we die too, and then it is we who are borne along for a little while [...]"
There also is the absolutely stunning passage about Max becoming aware of the dichotomy between himself and that what is not-himself:
"In her I had my first experience of the absolute otherness of other people. [...] the world was first manifest for me as an objective entity.
Luminous, breathtaking prose.

Four-and-three-quarter stars.

View all my reviews