ctgk / prml Goto Github PK
View Code? Open in Web Editor NEWPRML algorithms implemented in Python
License: MIT License
PRML algorithms implemented in Python
License: MIT License
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}")
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!
In ridge_regression.py
, wrote w* = argmin |t - X @ w| + alpha * |w|_2^2
.
But according to https://en.wikipedia.org/wiki/Tikhonov_regularization , the loss is in second order.
Did I miss something?
in prml/rv/multivariate_gaussian_mixture.py:124
the origin is :
D_sq = np.sum(np.einsum('nki,kij->nkj', d, self.cov) * d, -1)
should be changed to:
D_sq = np.sum(np.einsum('nki,kij->nkj', d, np.linalg.inv(self.cov)) * d, -1)
Hi there,
thanks a lot for sharing your implementations! In the update formula for the covariance in the variational logistic regression model, I believe that the first part of the sum I / self.alpha
should be the inverse of the prior covariance, i.e., I * self.alpha
, as in Equations 10.158 and 10.176.
Hope this helps!
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'
At the end, how to output the mean and variance of each sub-distribution in the mixed Gaussian and their respective mixing ratios
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)
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
Remote HTTP 404: Not Found error occurs when I try to open notebooks.
I was wondering if you could help me with this problem.
Hi:
How to test one-dimensional data for the variational Gaussian mixture model?
is it possible to support python2?
Hi,
Should it be the inverse of covariance matrix here?
PRML/prml/rv/multivariate_gaussian_mixture.py
Line 124 in 47d9830
D_sq = np.sum(np.einsum('nki,kij->nkj', d, np.linalg.inv(self.cov)) * d, -1)
I can't find the definition of @.
And an error message "SyntaxError: invalid syntax" for @ was occurred.
Please give me an advice
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 install "prml"? Thanks
How can I do it? I have tried pip. nothing works.
Hi,
Thank you for sharing the repository! I've got a problem with bayesian_logistic_regression.py - L39. Why does this line of code need to be + self.w_precision @ (w - self.w_mean)
. Does it use method Iterative reweighted least squares?
I really appreciate your help.
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!
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
but polynomial.py
file show me like that, this polynomial.py
file is located at /site-packages/prml-0.0.1-py3.8.egg
:
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!
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.