Warning Messages in Jupyter Notebook Example Code

You’re working with the downloadable source code from a book like  Algorithms for Dummies, 2nd EditionBeginning Programming with Python For Dummies, 3rd EditionMachine Learning for Dummies, 2nd EditionPython for Data Science for Dummies, or Machine Learning Security Principles and see a warning message like this:

C:\Users\John\anaconda3\lib\site-packages\sklearn\feature_selection\_sequential.py:206: FutureWarning: Leaving `n_features_to_select` to None is deprecated in 1.0 and will become 'auto' in 1.3. To keep the same behaviour as with None (i.e. select half of the features) and avoid this warning, you should manually set `n_features_to_select='auto'` and set tol=None when creating an instance.
  warnings.warn(

Well, that’s pretty confusing looking and if you’re just learning to work with Python may give you the idea that you’ve done something seriously wrong. There are a couple things to note here. First, this is a warning message. In fact, it’s a FutureWarning message, which means the change mentioned in the warning hasn’t actually taken effect yet.

Second, if you’re using the version of Jupyter Notebook and Python mentioned in the book, it’s unlikely that the effects described in the message will become a problem anytime soon, so you can usually ignore them. (This is one reason that I always ask which version of Jupyter Notebook and Python you’re using because a newer version can definitely cause error messages to appear.) Of course, if this warning ever does turn into an error, Luca and I definitely want to hear about it at [email protected].

Third, the message does state a potential fix for the problem. If the fix is simple enough, you can always try to make the required change to see if it works. However, this is a do it at your own risk sort of modification. The point is that the warning isn’t keeping you from using the downloadable source today, so ignoring it is probably the best action to take.

If you really don’t want to see these warnings, you can always add two lines of code the to first cell of the downloadable source. The warning isn’t actually going away, you just won’t see it:

import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

So, what causes these warning messages in the first place? Is the book’s source code faulty? There is nothing wrong with the book’s source code. What you’re seeing is the result of a library upgrade. Python uses a huge number of libraries and a change in any one of them can create a warning message of the sort you’ve seen. Luca and I work hard to ensure that the source code you get with the book is functional (and warning free) on all of the supported platforms at the time of writing, but it would be impossible for us to constantly update the book’s code to keep up with these library changes.

Marriage is Opportunity Disguised

Strife, envy, feelings of injustice misplaced
define the lives of many.
If only they thought
of how good life could be
they’d see the opportunity lost.

The bed is unmade,
the meal is uncooked,
a blanket lies untouched on the couch.
For the person who cares,
these are opportunities discovered.

A bed is prepared,
the mint lies on the pillow in anticipation,
of the person who discovers it there.
No word is said,
nor credit taken,
for the opportunity realized.

Wordless glances of thanks,
the eye’s glint of a compliment,
a smile warmly given.
The thoughts of lovers who know,
the path to growth,
is through the opportunity relished.

A note on the door,
the hug breathlessly exchanged,
words subtly laced with meaning.
Only those in a marriage,
where caring is foremost,
understand the opportunity accepted.

Copyright 2011, John Paul Mueller

Future of Libraries?

This is an update of a post that originally appeared on June 9, 2011.

Despite my leanings toward an entirely new kind of library when I wrote this post nearly twelve years ago, the library today seems much like the library back then, with a few changes. I still don’t actually visit my library to view the stock of books anymore. All I need to do is go to the library’s site online, look for the book I want by anything that comes to mind, and then order the book. I physically go to the library to pick the physical book up later. However, I still see the future, as described by devices such as the Kindle and the serious increase in audiobook usage, as electronic. In fact, I just recently had my first audiobook published, something I thought might never happen. The one thing that has taken me by surprise is the self-checkout library. I imagine that self-checkout has made the librarian’s life a lot easier, but I wonder about the cost of personal contact with patrons. Will we eventually stop talking to each other completely?

I had touched on the topic ebook usage a little in my “Paper or eBook?” post, but didn’t take the discussion to a logical conclusion at that point. What will happen when the library becomes completely electronic? It could happen—probably not within my lifetime, but definitely within the lifetime of the next generation. It could eventually happen that you’ll receive a device that connects to a worldwide library and delivers only electronic media. There are a number of advantages to this arrangement:

  • A book would be at your disposal 24/7 without much effort on your part at all.
  • There is no limit to the number of people who could view a book.
  • Rare or exotic books could be scanned and made available electronically.
  • Reading would become a do anywhere sort of activity that might actually benefit children who don’t currently read nearly enough.
  • Money would no longer define access to knowledge.

This future world has a few problems, of course. The people who put creative talent into materials of all sorts are already under attack today. Many people feel no need to pay for the materials they use—the information should be free in their minds. Barriers still exist to some degree and most people realize that people with creative talent require compensation in order to live, but the library of the future will make such barriers non-existent. How will someone who writes, draws, sings, or does anything else creative survive in a world where free electronic forms of everything exist? (Libraries are allowed to bypass copyright under certain conditions and I don’t see a problem with these exemptions, but there is a balance to maintain.)

I imagine that artists of all sorts will need to find some other means of support in the future. (In fact, my business has changed considerably over the past twelve years for this very reason.) Perhaps the government will step in and provide compensation to artists from library fees or taxes (it seems doubtful here in the US). Certainly, the current system of copyright is breaking down already. I read about copyright issues almost daily online in articles such as this one on ComputerWorld. The problem is that a lot of people talk about copyright, but few do anything about it. However, legislating morality has never worked in the history of the world and I doubt very much it will work now, especially considering what I see happening in government funded agencies such as libraries. Change is inevitable, if not always good. Then again, I can’t see this particular change as necessarily bad (despite not necessarily wanting to live it myself—call me attached to the physical book or simply outdated).

What sorts of changes are you seeing in your local library? Where do you feel these changes will end? How will people of a creative bent be compensated in the future? I’d love to hear your views on any or all of these questions at [email protected].

An Interesting Review of ChatGPT and Other AIs

I’ve written in the past about limitations of AI from a number of perspectives. In Effects of the Mistruths of Data on Model Output I discuss how the data fed to a model must necessary affect its output in a number of ways, including bias and other unwanted effects. Considering the Four Levels of Intelligence Management tells why it’s not possible for an AI to approach human intelligence today. In Fooling Facial Recognition Software I provide a detailed discussion of why it’s so easy to fool certain types of AI-powered applications. And you learn about why some types of occupations are reasonably safe from AI in Automation and the Future of Human Employment. However, I haven’t really done a detailed investigation of AIs like ChatGPT that seem almost human-like in their understanding, but fall remarkably short in many simple areas. On Artifice and Intelligence is one of the more detailed analysis I’ve found to date on the subject and what it reveals will surprise you. There are a lot of simple problems that ChatGPT and other Large Language Models (LLMs) can’t solve.

What I found interesting in the article is that the author, Shlomi Sher, was able to show that one area where an AI should be strong, math, actually isn’t all that strong at all. He talks about Euclid’s proofs. The artifice is that ChatGPT 4 and other AIs can tell you all about prime numbers and even provide seemingly creative output about them. However, depending on how you ask some basic questions, ChatGPT 4 either gets the answer wrong or right, when the answer is pretty much apparent to any human who knows what prime numbers are. What I liked most about the article is that the author takes time to explain why humans can understand the problem, but the AI can’t.

If it seems as if I have a continuing desire to dissuade others from anthropomorphizing AIs, I most certainly do. When it comes to AI, it’s all about the math and nothing more. However, that doesn’t mean that AIs lack functionality and ability as tools to augment human endeavors. It’s likely that the use of AIs will continue to increase over time. In addition, I think that as we better understand precisely how AIs work, we’ll also come to realize that they’re amazing tools, but most definitely not humans in the making. Let me know your thoughts on ChatGPT at [email protected].

Getting the Most from Your Technical Reading Experience

This is an update of a post that originally appeared on July 20, 2011.

There are many ways to work with books. However, in all cases, there is some work involved. No book, no matter how well researched and written, will simply spit out answers without any effort on the reader’s part. It’s true that the author can employ techniques to make the reading experience more pleasurable, productive, or efficient, but in the end, it’s the reader who decides just how much information a book conveys with regard to a specific need.

Of course, the first step is to ensure you get the right book. I’ve already discussed this issue in the Techniques for Choosing a Technical Book post. So, let’s assume that you have possession of a book that’s the best possible match to your needs. It may not be a perfect match, but it offers more than any other book you’ve checked.

Now you have to decide on how to interact with the book. That may seem simple, but many readers fail to discover what they need from a book, even when the book contains the required information in several places. Let’s face it, books are relatively large and it’s easy to lose track of a required bit of information. Without some guideline, the mind wanders and tends not to work very hard.

To obtain the most from a book you need a goal. The goal determines how you approach the book. Someone who is trying to learn a new skill will probably begin at the front of the book and work toward the end. Skipping chapters is akin to skipping classes in college—you can’t expect good results if you don’t obtain all of the information. As a contrast, someone who is trying to fix a specific problem under the watchful eye of a boss, probably doesn’t want to waste any more time than necessary finding the required information. This sort of reader will want to locate the section of the book containing the answer quickly. There are some readers though, who really don’t know what they want to do—they lack a goal and are thwarted when the author can’t guess what the reader wants. So, ask yourself why you’re reading the book and create a goal for that particular session. In some cases, you may very well want to wander through the book randomly looking for something interesting, but few people have the time or need to perform this sort of reading with a technical book.

Depending on your goal, you’ll want to determine where to start. Someone who is learning a skill will start in the Introduction—not in Chapter 1. If you don’t read the Introduction, you’ll discover that your educational experience is going to be less helpful. The Introduction is where the author conveys book goals, knowledge requirements, and required training aids. For example, you might not be able to use the educational version of the product you have to learn a new skill with this particular book—it may be necessary to get the released version of the product instead. Researchers and those who simply need the book for reference would do well to check both the Table of Contents and the Index. A book intended solely for reference may include tables in an appendix that provide additional ways to locate information, so you’ll want to find these tables as well.

You’ve likely heard all of the advice for creating a good study environment before, such as turning off the radio. A good study environment also requires focus on your part and the availability of the required equipment. Simply reading about how to perform a task isn’t nearly as good as actually performing the task. Reinforcing the information by putting it into your own words is helpful as well. Everyone learns differently, so it’s important that you take time to discover how you learn. Whatever it takes for you to create a good study environment, you won’t get much out of a book until you create it.

Everyone seems to be in a hurry today, but being in a hurry won’t help with technical information. Hurrying only creates errors. Take time to actually read and understand the material—read it several times if necessary. Work through the material before you act. Yes, I realize that the boss is ready to pound little knots all over your head, but he’s simply going to have to wait. A good solid answer that produces results often requires a little more time up front to create. The book probably has the information you need, but you have to take time to find it.

One of the most important things to remember is that the author isn’t clairvoyant. You won’t find a precise answer to any given question in any book. It’s possible to find an answer that’s close, but in most cases you’ll have to create a solution based on the information the book provides—quick answers are rare.

I wish it were possible to create some form of instant mental transfer of precise data. Perhaps someday it will become the norm to do so, but I hope I’m not around. Part of the joy of technical reading is obtaining the author’s point of view and then creating your own permutations of that information. Working through problems creatively is a challenge—one that I hope people working in technical areas continue to enjoy. If you have any pointers to getting more from a technical reading experience, let me know at [email protected].

Making Soup

One of the things I do during the winter months is make soup. However, I don’t make just a small amount of soup in a small pot, in a small way. Years ago I bought a large restaurant-quality aluminum soup pot that weighs a ton and holds at least four gallons of soup. Making soup in large batches seems to produce a much better result and the large, thick, heavy soup pot works so well that nothing seems to burn in it. Well, I guess if I tried really hard it would burn, but I don’t try really hard.

Most of my soups start out with meat of some sort (beef, pork, chicken, venison, or lamb), but I normally use soup bones, lots of them. Sometimes I use a whole chicken, a large one. No matter what kind of meat I use, I start out with at least five pounds of it, sometimes more. I start the cooking early in the morning and cook the meat very slowly (never ever boiling it), scooping off the blood that rises to the surface and adding spices and salt afterward. I favor using more spices than salt. In fact, I just barely add salt to taste. I use spices that you normally wouldn’t think of in my soups such as, cinnamon, nutmeg, and cloves, which helps me keep salt to a minimum. You don’t add a lot of these spices, the effect is meant to be subtle. In some cases, such as with beef, I use pickling spice (but make sure to remove the tea ball containing the pickling spice after no more than 20 minutes or it gets bitter). Favorites with chicken include sage, rosemary, and thyme. Sometimes I add orange or lemon peel. A common addition are onions and I sometimes add a bit of fresh garlic (minced fine) as well.

I like my soup to be really nutritious, so I add plenty of vegetables. Most of my soups contain corn, carrots, and potatoes. However, I don’t stop there. The soup I made the other day also contains turnips, Holiday Soup Mix, and celery. I’ve been known to add things like green beans, kohlrabi, rutabagas, turnips, and all sorts of other odd assorted vegetables. In fact, if something in the larder or freezer is getting a bit old, it goes into the soup pot. The point is that the soup is far from plain. It contains good nutritional value from a wide variety of wholesome vegetables.

In addition to all of the vegetables, I sometimes add mushrooms. As with the vegetables, I normally get a better quality mushroom, not those canned kind. My personal favorites are baby portabella, shiitake, and oyster mushrooms, but I’ve used others as well. Even a good quality button mushroom can be a nice addition. I’ve never had much success using morels in soup. Besides, morels were meant for cooking in butter and garlic, with a bit of salt.

To top my soup off I usually add pearled barley. Using pearled barley gives the soup that finishing touch, a kind of nutty flavor that you find in only the best soups. As an alternative, I sometimes use half and half wild and brown rice. I generally don’t add noodles to my soup; they fall apart quickly, don’t have much nutritional value, and tend not to freeze or can well.

Speaking of freezing and canning, there is no way one person can eat four plus gallons of soup before it goes bad and that’s the point. I either can or freeze the excess soup for later. Soups that are a little more broth get canned in one quart containers, while robust soups get frozen in one gallon bags. A word of advice, don’t overfill your gallon bag. I put three quarts of soup at most in my gallon bag and sometimes less depending on the soup. Lay the bags flat in the freezer as they freeze and you’ll find that your bags of soup stack well. If I’m having a really busy time, I simply get out a quart or a bag of soup and I have a nutritious meal I don’t have to cook. Soup is comfort food. Let me know your thoughts about soup at [email protected].

IDE Screenshot Usage in Books

There are cases where it’s very tough to figure out the correct presentation of material in a book, which is made more difficult by some readers preferring one presentation and other readers another. It comes down to how people learn in many cases. Visual learners prefer screenshots, abstract learners prefer text. Of course, there are all sorts of learners between these two extremes. So, what seems like a simple question can become quite complex.

The question at hand is whether to present screenshots of an IDE in a book with the associated example code and its output. The problem is that vendors now assume that developers have very large displays and so have made use of all of that extra screen real estate. In addition, book publishers don’t want books where a single image consumes an entire page. The result is that it’s very hard to get a screenshot where the text is completely readable. It can be done, but the text will generally still be smaller than the print in the book. Older readers complain that they need a magnifying glass to see the text at all.

However, there are benefits to using screenshots. The most important benefit is that, even if the text isn’t completely readable, visual learners can see what their IDE should look like as they follow the progress of procedures in the book. This feedback lets the visual learner know that they are doing things correctly and are getting the correct result. Another benefit is that an example tends to stay in one piece. The graphical output of an example doesn’t end up several pages away from the source code that produces it. Sometimes, textual output is wider than the page will allow using the normal font size. So, the options are to print the output in the book at the normal font size, but in a truncated form, which means that it’s no longer complete. A screenshot can show the complete textual output, but at a smaller font. For beginner readers, the second form, while not optimal, is preferred because truncating the output produces questions in the reader’s mind.

So, how do you feel about IDE screenshots in books? Are they more helpful or more confusing? Part of the reason for posts like this is to get your opinion and discover more about you as a reader. Obviously, a book author wants to use the communication techniques that work best overall for everyone, book space often not allowing for the investigation of every presentation alternative. Let me know your thoughts at [email protected].

Tribute to a Friend

Most of you know that I rely on beta readers to help me hone the content of my books. After all, more eyes and more opinions often means fewer mistakes and a better balance to writing. My friend Eva Beattie has been a beta reader for longer than any other beta reader at over 25 years. That’s right, for the past 25+ years she has reviewed every one of the books I’ve written and never asked for anything more than a thank you, making her one of the most selfless people I’ve ever known.

Over the years we developed a friendship and would send cards and gifts to each other. I visited her with my wife during our 30th anniversary trip to Washington state in 2010. Our weekly emails kept each other informed and we’d often discuss matters too private for others to hear. On the holidays we’d take time out for a long gab session on the phone. So, it was with deep regret that I heard of her passing this past week.

I’m glad that I was able to provide her with a well-deserved dedication in Machine Learning Security Principles and that we did have some nice email exchanges prior to her passing. However, I wanted to take this one last opportunity to present a public thank you to her for all of her hard work over all of those years. She really was quite extraordinary and I’ll greatly miss her.

Jupyter Notebook vs JupyterLite

There seems to be some confusion for readers of   Algorithms for Dummies, 2nd EditionBeginning Programming with Python For Dummies, 3rd Edition, Machine Learning for Dummies, 2nd EditionPython for Data Science for Dummies, and Machine Learning Security Principles lately due to the similarity of names of two Integrated Development Environments (IDEs) available now. Even though I’m sure that JupyterLite is a very good product, even the website states, “Not all the usual features available in JupyterLab and the Classic Notebook will work with JupyterLite, but many already do!” This lack of support becomes a problem when you try to run the downloadable source using JupyterLite. In addition, Luca and I haven’t tested the downloadable source with this product, so we can’t even tell you what will and won’t work.

The two supported IDEs for our books are Google Colab (recommended for those of you who want to use a mobile device) and Jupyter Notebook (recommended for those of you who have a desktop system). It’s actually preferred that you get Jupyter Notebook as part of the Anaconda toolset because Anaconda makes it very easy for you to perform some advanced setup tasks found in some of our books. For example, you gain access to the Anaconda prompt and the associated Conda utility that definitely makes it easier for you to manage some of the machine learning packages found in our books. Using either Google Colab or Jupyter Notebook makes it very much easier for Luca and I to help you with your book-specific questions.

Please let me know if you have any questions or concerns about how to setup your programming environment for our books at [email protected]. Remember to use the version of the products listed in the book for optimal results in working with the downloadable source. In addition, always remember to use the downloadable source to enhance your learning experience.