Code Monkey home page Code Monkey logo

jermwatt / machine_learning_refined Goto Github PK

View Code? Open in Web Editor NEW
1.6K 76.0 590.0 919.21 MB

Notes, examples, and Python demos for the 2nd edition of the textbook "Machine Learning Refined" (published by Cambridge University Press).

License: Other

Python 99.92% MATLAB 0.08% Rich Text Format 0.01% Dockerfile 0.01%
machine-learning deep-learning artificial-intelligence data-science jupyter-notebook numpy autograd machine-learning-algorithms lecture-notes slides

machine_learning_refined's Issues

Problems with the electronic version on Amazon

Two major issues with the electronic version of the book on Amazon.

  1. The electronic version is a PDF file, not MOBI. In other words, it has not been adapted to Amazon Kindle.
    In particular, links in the text don't work, from Kindle. And the contents menu is static, not hypertext.

  2. Some of the materials on the HTML pages / notebooks just don't exist in the Amazon PDF version. The opposite of what I expected! (because each of your HTML pages / notebooks contains this insert: "The following is part of an early draft of the second edition of Machine Learning Refined. The published text (with revised material) is now available on Amazon"). For example, sections 6.2 and 6.3 in the HTML pages contain appendixes with proofs. These appendixes do not exist in the Amazon PDF version.

Can these problems be fixed? TIA

Question about decision trees being universal function approximators.

Hi,

I hope this is the right place to post a question about the HTML materials! I was reviewing this and am having some trouble understanding why a decision tree or regression tree would be a universal function approximator. Would you be able to provide some clarification for why a regression tree would be a universal function approximator? If there is a pointer to a chapter within Machine Learning Refined that goes deeply into this, I would greatly appreciate a reference!

Thanks,

Error in Example 3.5

There is an error in the number of runs to reach the minimum using the coordinate descent algorithm for this equation:

g(w1, w2) = 2w1² + 2w² + 2w1w2

The minimum is not reached in just two iterations.

The problem is that you call the algorithm with integer values ​​for the initial estimate of the w vector.

But if you use float values instead:

w = np.array([3.0,4.0])
max_its = 5
weight_history,cost_history = coordinate_descent_for_quadratic(g,w,max_its,a,b,C)

You get the correct values:

[array([3., 4.]), array([-2.,  4.]), array([-2.,  1.]), array([-0.5,  1. ]), array([-0.5 ,  0.25]), array([-0.125,  0.25 ]), array([-0.125 ,  0.0625]), array([-0.03125,  0.0625 ]), array([-0.03125 ,  0.015625]), array([-0.0078125,  0.015625 ]), array([-0.0078125 ,  0.00390625])]```

Example 3.3 Galileo and uniform acceleration

Hello sir,

i was trying to solve Exercice 3.4: Reproduce Galileo's Example, which meant reproducing the graph of Example 3.3, and got w=0.0196, which should be the earth gravity: g=9.81 m/s^2. Since i was able reproduce the requested graphs, i suppose that w is correct, but was wondering why it doesn't match g. What are the units of the input values?

Thank you.

Supplementary videos

I have enjoyed working through the 2nd edition of the book, and I commend you for creating a machine learning book with such a good balance of intuition and rigor. I wondered if it would be viable down the road to include supplementary videos of the sections of the book? Something alongside the excellent videos by Caltech, which I will link below. Thanks again for the hard work!

https://home.work.caltech.edu/lectures.html

pip install error-exist no requirements.txt: Mac Version 10.13.2

I followed the instructions from readme.md and tried to install required packages as follows:

  git clone https://github.com/jermwatt/mlrefined
  cd mlrefined
  pip install -r requirements.txt

and Error showed saying that

Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'

And I couldn't find requirements.txt using search as well.

Chapter 3.0 page links to Chapter 6.0

Hey Professors,

The Chapter 3 Section 0 link on the index.html file leads to a page titled "6.0 Introduction". However, the contents of that page make sense for the introduction of Chapter 3. I think it could be that the title is incorrect whereas the contents are correct

Solutions to exercises on Cambridge Resources site missing

Dear authors,
Thanks for a very nice book, which we are adopting for a new class starting in Feb'21. It seems the Solutions at the Instructor Resources on the Cambridge Higher Education site are missing. There is a directory with zip files, but they contain the jpg images of the book (duplicate of the Figures directory).

Text errors/typos in chapter 6, 2nd edition

Some suspected errors/typos to report:

p.131. In example 6.3, "Here a of run normalized gradient descent ..." should be "Here a run of normalized gradient descent ...".
p.136. Equation 6.18 is not consistent with how tanh is usually defined. The consistent one should be "tanh(x) = 2 sigma(2x) - 1".
p.145. The inequality "exp(-yxCw) = exp(-C)exp(-yxw) < exp(-yxw)" is incorrect. It should be "exp(-yxCw) = (exp(-yxw))^C < exp(-yxw)"
p.158. The encoding in equation 6.62 does not make equation 6.66 and equation 6.67 equivalent to each other. Instead, the encoding should be done reversely: encode the label 1 into the vector [1 0]. (If consistency with section 7.5.4 is intended, then some other contents, instead of the encoding, need modification.)
p.168. "Section 6.24" is mentioned, but there is no such section.

I'm not confident that these are all errors/typos indeed. Hope they help.
Besides, this is a great machine learning book for beginners. I do understand what's going on in the text. Deep appreciation for the effort.

solution to exercises?

Hello there! This is a really great book! However I am not able to find the solution to the mathematical exercises... Where are they?

Thanks!

Exercise 2.1 - Uniform sampling

I couldn't find any reference in the errata, hence may be it is not an error - but how does someone sample $K$ points from $[-1,1]^N$ when $K$ is not $N-th$ power? From reading the text and general knowledge, I thought that uniform sampling meant creating a $N$ dimensional grid of evenly spaced points - but this is obviously not possible when the dimension is not $1$ or $2$ when $N=100$. Does it mean something else? If it does - could it be specified explicitly in the errata?

conda build failed with matplotlib pinned to v3.1.0 (why OLD version)? Will attempt to float all dependencies to latest...

the conda build method did not work using the requirements.txt file

conda create python=3.8 --name mlr2 --file requirements.txt

The latest version of matplotlib is 3.5.2.
v3.1.0 is obsolete has a dependency on some outdated package.

Is there some reason that matplotlib is pinned to 3.1.0 and all the other package dependencies are allowed to float to the latest versions?

Below is my conda output. Initially I tried it using the command on the githut package, but conda failed with a lot of incompatiblity conflicts.

Then I tried conda install for all packages EXCEPT the pinned matplotlib=3.1.0 and everything worked. Next, I tried to install matplotlib=3.1.0 and got the output below.

(mlr2) C:\Users\richadmin\Desktop\00_PythonWIP_2022\02-Borhani-ML-Refined-2021>conda install matplotlib==3.1.0
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.  
Solving environment: - Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - matplotlib==3.1.0 -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']

Your python: python=3.8

If python is on the left-most side of the chain, that's the version you've asked for.  When python appears to the right, that indicates that the thing on the left is somehow not available for the python version you are constrained to. Note that conda will not change your python version to a different minor version unless you explicitly specify that.

I just installed into the conda environment with everything the latest version (Python 3.8 and all other packages in the requirements.txt file) and then matplotlib (floating to the LATEST VERSION) and it worked. I will try running the code examples and see if there are any bugs or errors due to the later version of matplotlib.

I will report back after I have gone through many of the notebooks.

Missing initialization in Exercise 6.5 MATLAB wrapper

In the MATLAB wrapper for Exercise 6.5, the parameters b, w, c, and V used in the tanh_softmax function are not initialized. The code will not successfully run then even if grad_b, grad_w, grad_c, and grad_V are written correctly.

ModuleNotFoundError: No module named 'autograd.misc'

I run this code at the terminal: pip install autograd
but when I run the the below cell:
import sys
sys.path.append('../../')
import matplotlib.pyplot as plt
from mlrefined_libraries import basics_library as baslib
from mlrefined_libraries import linear_algebra_library as linlib

Then I got the below error:

ModuleNotFoundError Traceback (most recent call last)
in ()
4 sys.path.append('../../')
5 import matplotlib.pyplot as plt
----> 6 from mlrefined_libraries import basics_library as baslib
7 from mlrefined_libraries import linear_algebra_library as linlib

/Volumes/DATA/projects/private/ml/mlrefined/mlrefined_libraries/init.py in ()
7 prefix=name+'.',
8 onerror=(lambda x: None)):
----> 9 import(modname)
10

/Volumes/DATA/projects/private/ml/mlrefined/mlrefined_libraries/convnets_library/convnet_lib/optimizers.py in ()
2 from autograd import value_and_grad
3 from autograd import hessian
----> 4 from autograd.misc.flatten import flatten_func
5 from IPython.display import clear_output
6 from timeit import default_timer as timer

ModuleNotFoundError: No module named 'autograd.misc'

I am using Anaconda with Python 3.6, I have no idea how to fix this issue. Can you check?

Great work!

Your work build a bridge between machine learning and math, and provide a good intuition for machine learning. So when will your second book come out?

Missing 2-4 chapters' exercise folders for 2nd edition

Hello!

I have just started to read the book and wanted to try out some exercises. But there is only information about execrises starting from chapter 5 in here. So, I just wanted to ask, if they were supposed to be there originally, or not.

Which version of matplotlib was used?

Nice book and repo. I was running through some of the examples in the 2_5_Random.ipynb. Some of the plots render OK, but then others don't (e.g., static_plotter.two_input_surface_contour_plot) and for those I get a long series of the following errors/warnings (matplotlib: 3.5.1).

*c* argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with *x* & *y*.  Please use the *color* keyword-argument or provide a 2D array with a single row if you intend to specify the same RGB or RGBA value for all points.

I was wondering whether you had a requirements.txt that specified the version of the libraries used for creating the notebooks.

It might be something else than what the message says. I would have thought that warnings wouldn’t stop the plot from being run. But a requirements.txt might help identify the culprit.

git lfs pull not working

When I try git lfs pull, I get:

batch response: This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access.
error: failed to fetch some objects from 'https://github.com/jermwatt/machine_learning_refined.git/info/lfs'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.