79698929

Date: 2025-07-12 00:27:31
Score: 2.5
Natty:
Report link

So I was able to answer my own question after learning Python. This answer will assume you have zero knowledge of coding and have just installed Python properly and are using a Windows operating system. This book, Machine Learning for Everyone by Mark E. Fenner is aimed at beginners (quite literally in the title) and I suspect that many may be having the same issue and finding what I wrote.

Additionally here is my setup:

Operating System: Windows 10

Coding Environment: Jupyter Notebook within VSCode

Answer:

Ultimately the error that I am experiencing is that the code in the text:

from mlwpy import *
%matplotlib inline

is trying to pull everything (that is what the asterisk * means in context) from the library mlwpy . This library does not exist when you install Python initially. Python is an open sourced language, meaning that anyone can contribute to it, and because of that there are many libraries out there, if Python were to install all the libraries it could create a mess, so generally this is where pip install comes in. pip install allows us to manually install libraries that we need. Libraries are basically prebuilt code that other people have developed that make life easier.

However for our case, we cannot use pip install because this is a custom built library that the author created and not something recognized as official by the Python community.

What this means is that we have to find the code ourselves, in our text in Appendix A there is the code written out, this will be very tedious to write this out by hand. Fortunately our instructor has a GitHub. GitHub is a global repository for code. Anyone can add their code to GitHub and depending on the settings, anyone else can see that code too, contribute it, download it, modify it, etc. The GitHub link is here.

Here are the steps:

  1. Download the GitHub code, this will be in your Downloads Directory.

  2. Locate where Python is within your operating system. For me, it is in this directory:

    C:\Users\Gabriel\AppData\Local\Programs\Python\Python311\

    Yours will be different depending on where you installed Python (and your Windows username). To find the file path hit the following keyboard commands: WindowsKey + R this will pop up a small window called Run. In there, there is a small search bar, type in cmd this will open the command prompt which will look like a black window with white text. Once you have done that type into cmd the following: where python this will return your Python's file location. If you had trouble installing Python and there are multiple locations, type in path this will show you which Python location is actually connected to the path variable, your python will not run unless it is connected to the path variable, so the one that shows up, that's the one you want.

  3. Type in the filepath that was given in step two into your Windows FileExplorer. There you need to find the folder Lib and then navigate to the directory site-packages . So from step two my directory now looks like:

    C:\Users\Gabriel\AppData\Local\Programs\Python\Python311\Lib\site-packages

  4. In a separate FileExplorer window, navigate to your Downloads and find the mlwpy.py file and cut and paste it into the directory we have opened in the other Windows FileExplorer from step 3.

  5. You have now put in this code in the correct space, so now you can treat it like a regular library.

Everything Past this Point is Additional

  1. First Bonus: For the code in the book to work you need to install the libraries: matplotlib, numpy, pandas, seaborn, and scikit-learn. These libraries are much easier and generally are going to follow the same format, you open up your cmd and type in the appropriate command according to these libraries' documentation, so for example for numpy it will be pip install numpy use a search engine such as Google to locate the appropriate documentation.

  2. Second Bonus: For VSCode you will need to setup your environment to run Python. Thankfully they have excellent documentation detailing on what to do found here.

  3. Third Bonus: For machine learning you want to run your python in what is called a Jupyter Notebook, to open a Jupyter Notebook in VSCode press Ctrl + Shift + P this will show a search menu at the top, currently, if you type in Create: New Jupyter Notebook this will indeed create a new Jupyter notebook, however in the future this could change, so always look at official documentation from VSCode to see how to create a new Jupyter Notebook.

  4. Fourth Bonus: In your Jupyter Notebook it will ask you what kernel of python to use when you try to run a cell, so you will need to specify the path that you installed python. If you accidentally installed Python in multiple locations, now would be a great time to remove the additional python installations that are not connected to your path variable.

  5. Fifth Bonus: Take your time and do not get frustrated, learning to code and machine learning in general has a huge uphill knowledge-base for beginners, this book despite its title should be for those that have a little more savvy on how to code some basic python prior to use. I highly encourage you to keep learning how to code in general while also trying to follow this book. You are not a fool if this seems like a lot, take it slow and remember to have fun!



St

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): having the same issue
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Gabriel Garcia