Giter Club home page Giter Club logo

prml's Introduction

PRML

Python codes implementing algorithms described in Bishop's book "Pattern Recognition and Machine Learning"

Required Packages

  • python 3
  • numpy
  • scipy
  • jupyter (optional: to run jupyter notebooks)
  • matplotlib (optional: to plot results in the notebooks)
  • sklearn (optional: to fetch data)

Notebooks

The notebooks in this repository can be viewed with nbviewer or other tools, or you can use Amazon SageMaker Studio Lab, a free computing environment on AWS (prior registration with an email address is required. Please refer to this document for usage).

From the table below, you can open the notebooks for each chapter in each of these environments.

nbviewer Amazon SageMaker Studio Lab
ch1. Introduction Open in SageMaker Studio Lab
ch2. Probability Distributions Open in SageMaker Studio Lab
ch3. Linear Models for Regression Open in SageMaker Studio Lab
ch4. Linear Models for Classification Open in SageMaker Studio Lab
ch5. Neural Networks Open in SageMaker Studio Lab
ch6. Kernel Methods Open in SageMaker Studio Lab
ch7. Sparse Kernel Machines Open in SageMaker Studio Lab
ch8. Graphical Models Open in SageMaker Studio Lab
ch9. Mixture Models and EM Open in SageMaker Studio Lab
ch10. Approximate Inference Open in SageMaker Studio Lab
ch11. Sampling Methods Open in SageMaker Studio Lab
ch12. Continuous Latent Variables Open in SageMaker Studio Lab
ch13. Sequential Data Open in SageMaker Studio Lab

If you use the SageMaker Studio Lab, open a terminal and execute the following commands to install the required libraries.

conda env create -f environment.yaml  # might be optional
conda activate prml
python setup.py install

prml's People

Contributors

ctgk avatar jazcarretao avatar kmotohas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prml's Issues

Remote HTTP 404: Not Found

Remote HTTP 404: Not Found error occurs when I try to open notebooks.
I was wondering if you could help me with this problem.

ch05_Neural_Networks

plt.scatter(x_train[:, 0], x_train[:, 1], c = y_train)
cause error:
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in _to_rgba_no_colorcycle(c, alpha)
188 if len(c) not in [3, 4]:
--> 189 raise ValueError("RGBA sequence should have length 3 or 4")
190 if len(c) == 3 and alpha is None:

ValueError: RGBA sequence should have length 3 or 4

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)
in ()
----> 1 plt.scatter(x_train[:, 0], x_train[:, 1], c = y_train)

whta is @

I can't find the definition of @.

And an error message "SyntaxError: invalid syntax" for @ was occurred.

Please give me an advice

question about BayesianRegression

why self.w_cov = np.linalg.inv(self.w_precision) in fit function?
what's the meaning of w_cov?
why y_var = 1 / self.beta + np.sum(x @ self.w_cov * x, axis=1) in predict function ?

Can anybody give me a clue or some knowledge about this? Thanks

No module named 'prml'

I HAVE RUN Python setup.py build
and python setup.py install
then use jupyter to open ch03_Linear_Models_for_Regression.ipynb.
BUT still report ---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
in ()
4 get_ipython().run_line_magic('matplotlib', 'inline')
5
----> 6 from prml.features import GaussianFeatures, PolynomialFeatures, SigmoidalFeatures
7 from prml.linear import (
8 BayesianRegressor,

ModuleNotFoundError: No module named 'prml'

so how can i do to fix this?

No module named 'prml.random'

Thanks for sharing the implementation!

I am trying to run the notebook for chapter 13 but I came across the error:
ModuleNotFoundError: No module named 'prml.random'

Is there no such module? Thank you for your help!

draw() in Bernoulli distribution

the line in the draw should change from self.mu.n_ones / (self.mu.n_ones + self.mu.n_zeros) to

(self.mu.n_ones - 1) / (self.mu.n_ones + self.mu.n_zeros -2)

How to step into the source code like polynomial.py in prml folder when debugging?

I tried to debug ch01_Introduction.ipynb, set a breakpoint at X_train = feature.transform(x_train), then press F11 to enter the souce code function

image

but polynomial.py file show me like that, this polynomial.py file is located at /site-packages/prml-0.0.1-py3.8.egg :

image

I know that .egg file is a zip file for py source code, but is there any way to step into the right-readble source code in my project folder?

Thanks!

cannot import name 'logsumexp' from 'scipy.misc' (/opt/anaconda/lib/python3.7/site-packages/scipy/misc/__init__.py)

When I run "ch01_Introduction.ipynb", get the error:
cannot import name 'logsumexp' from 'scipy.misc' (/opt/anaconda/lib/python3.7/site-packages/scipy/misc/init.py) .

So, I replace "from scipy.misc import logsumexp" with "from scipy.special import logsumexp" in this three files:
prml/nn/loss/softmax_cross_entropy.py
prml/rv/bernoulli_mixture.py
prml/rv/variational_gaussian_mixture.py
Then it wokrs!

Missing `f` prefix on f-strings

Some strings looks like they're meant to be f-strings but are missing the f prefix meaning variable interpolation won't happen.

"{X.size} is not equal to {n_zeros} plus {n_ones}"

I found this issue automatically. I'm a bot. Beep Boop ๐ŸฆŠ. See other issues I found in your repo here

ImportError: No module named 'prml'


ImportError Traceback (most recent call last)
in ()
4 get_ipython().run_line_magic('matplotlib', 'inline')
5
----> 6 from prml.rv import (
7 Bernoulli,
8 Beta,

ImportError: No module named 'prml'

Weird "f" letters randomly added in code

Hi.
Thanks so much for writing this code, very useful for learning and teaching.

One weird issue is there are these places where the letter 'f' was prefixed to some strings. Python2 crashes so I deleted them all.

Do you know what those are?

Thanks.

Here's an example from this file: /PRML/prml/rv/multivariate_gaussian_mixture.py

raise ValueError(f"sum of coef must be equal to 1 {coef}")

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.