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].