pmtk3 icon indicating copy to clipboard operation
pmtk3 copied to clipboard

Questions on Contributing Python Demos

Open findmyway opened this issue 11 years ago • 4 comments

Last year I had studied the book Machine Learning: a Probabilistic Perspective. However, with only a little knowledge of Matlab I found it hard to understand the source code. Then I turned to Python, and have written some demos in Python.Below are some questions on contributing Python demos.

  1. How to organize these codes and fig results?
  2. Is there any guidelines in writing demos in Python?
  3. Do I need to write a file like publishDemos( ) to generate nice webpages?

findmyway avatar Feb 25 '14 11:02 findmyway

In my book, most figures have 1 or 2 corresponding matlab scripts; it would be great if you could make python versions of these. The structure is up to you. I don't know of a python equivalent of publishDemos(), but I'm sure there is one.

Kevin

On Tue, Feb 25, 2014 at 3:45 AM, TianJun [email protected] wrote:

Last year I had studied the book Machine Learning: a Probabilistic Perspective http://www.cs.ubc.ca/%7Emurphyk/MLbook/. However, with only a little knowledge of Matlab I found it hard to understand the source code. Then I turned to Python, and have written some demos in Python.Below are some questions on contributing Python demos.

  1. How to organize these codes and fig results?
  2. Is there any guidelines in writing demos in Python?
  3. Do I need to write a file like publishDemos( ) to generate nice webpages?

Reply to this email directly or view it on GitHubhttps://github.com/probml/pmtk3/issues/69 .

murphyk avatar Feb 25 '14 16:02 murphyk

Hello - for publishing figures with Python, you should look into using IPython's Notebook feature, which supports the matplotlib module, and can generate nice-looking web pages. (You could also use matplotlib without an IPy notebook.) Here is an introduction with a video:

http://ipython.org/notebook

ido avatar Feb 27 '14 15:02 ido

Also, you can use http://nbviewer.ipython.org/ to share IPython Notebooks that you store on GitHub (e.g. in this git repository or in a gist) on the web, if you don't want to spend too much time writing publishDemos() for Python.

ido avatar Feb 27 '14 15:02 ido

Thank you for all your suggestions. I decide to use sphinx , which is very popular in python, to gengerate documents.

The structure is as follows.

---python |---build ( contain docs) |---demos ( contain demos seperated in chapters) |------ch01 |-----------ch01.rst ( to generate docs) |-----------.py (demos) |-----------.png (fig results) |------chXX |------......... |---Makefile (to generate docs on linux) |---make.bat (to generate docs on windows) |---conf.py ( settings of sphinx to generate docs) |---index.rst (generate index.html) |---utils.py ( provide a function load_mat(), to read data in /pmtk3/pmtkdataCopy, to make things easy, I just copy the data from pmtkdata, maybe this function need to adjust latter.

I will push most of the demos in ch01 latter. If you have any questions, please let me know. After fixing them I will push some other chapters.

ps: I an new to machine learning and still have lots of confusions. I feel really excited to have your reply :)

findmyway avatar Feb 28 '14 06:02 findmyway