Thank you for your interest in contributing to this open-source book! We greatly value feedback and contributions from our community.
Please read through this document before you submit any pull requests or issues. It will help us work together more effectively.
When you submit a pull request, our team is notified and will respond as quickly as we can. We'll do our best to work with you to ensure that your pull request adheres to our style and standards. If we merge your pull request, we might make additional edits later for style or clarity.
The source files on GitHub aren't published directly to the official website. If we merge your pull request, we'll publish your changes to the staging website as soon as we can, but they won't appear immediately or automatically.
We look forward to receiving your pull requests for:
- New content you'd like to contribute (such as new code samples or tutorials)
- Inaccuracies in the content
- Information gaps in the content that need more detail to be complete
- Typos or grammatical errors
- Suggested rewrites that improve clarity and reduce confusion
Note: We all write differently, and you might not like how we've written or organized something currently. We want that feedback. But please be sure that your request for a rewrite is supported by the previous criteria. If it isn't, we might decline to merge it.
To contribute, send us a pull request. For small changes, such as fixing a typo or adding a link, you can use the GitHub Edit Button. For larger changes:
- Fork the repository.
- In your fork, make your change in a new branch (e.g., by
git branch) that's based on this repo's master branch. - Commit the change to your fork, using a clear and descriptive commit message.
- Create a pull request, answering any questions in the pull request form.
Before you send us a pull request, please be sure that:
- You're working from the latest source on the master branch.
- You check existing open, and recently closed, pull requests to be sure that someone else hasn't already addressed the problem.
- You create an issue before working on a contribution that will take a significant amount of your time.
For contributions that will take a significant amount of time, open a new issue to pitch your idea before you get started. Explain the problem and describe the content you want to see added to the documentation. Let us know if you'll write it yourself or if you'd like us to help. We'll discuss your proposal with you and let you know whether we're likely to accept it. We don't want you to spend a lot of time on a contribution that might be outside the scope of the documentation or that's already in the works.
If you'd like to contribute, but don't have a project in mind, look at the open issues in this repository for some ideas. Issues with the help wanted, good first issue or enhancement labels are a great place to start.
In addition to written content, we really appreciate new examples and code samples for our documentation, such as examples for different platforms or environments, and code samples in additional languages.
This section describes the development environment setup and workflow which should be followed when modifying/porting python code and making changes to one of the machine learning frameworks in the book. We follow a set of pre-defined style guidelines for consistent code quality throughout the book and expect the same from our community contributors. You may need to check other chapters from other contributors as well for this step.
All the chapter sections are generated by JupyterBook. Start by cloning the repo.
Clone your repo fork to a local machine.
git clone https://github.com/<UserName>/machine-learning.gitWarning
There will be slight differences on different systems
Before you start, you will need Python and Conda on your computer.
Add the following paths(depending on your OS) to the environment variable `PATH`` if needed. To Windows,
D:\Python\Python310\Scripts\
D:\Python\Python310\
D:\anaconda3\ScriptsFollow the Jupyter Book official guidance to install the latest version.
draw.io is needed for generating draw.io-based diagrams in build time. Install the draw.io desktop application on your local machine. By default, the draw.io execution is correctly located at the platform-appropriate path:
- Windows:
C:\Program Files\draw.io\draw.io.exe(Attention: Don't change the installtion path.) - Linux:
/opt/drawio/drawioor/opt/draw.io/drawio(older versions) - macOS:
/Applications/draw.io.app/Contents/MacOS/draw.io.
Mostly, you don't need to do anything here. The executable will be picked up by sphinxcontrib-drawio automatically.
Clone the source code from remote through your preferred protocol.
# through HTTP
git clone https://github.com/open-academy/machine-learning.gitMove to the working directory.
cd machine-learning/open-machine-learning-jupyter-book/Initialize the Conda env.
# first time setup
conda env create -f environment.yml
# or update
conda env update -f environment.ymlTo Mac,
Warning
You may see below Tensorflow installation failures, especially on the ARM-based M1 Mac.
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none) ERROR: No matching distribution found for tensorflowSolution:
- Comment out Tensorflow in environment.yml.
- Follow Apple's official documentation to install the Tensorflow.
- Run
conda env update -f environment.ymlagain to install the remaining dependencies.- Optional - try to uncomment the Tensorflow in environment.yml.
Warning
You may see below error when you have trouble access GitHub.
error: RPC failed; curl 56 LibreSSL SSL_read: error:02FFF03C:system library:func(4095):Operation timed out, errno 60 fatal: expected flush after ref listingSolution:
Change your network. In order to proceed smoothly later, hope you can solve this problem here.
To Windows,
Warning
You may see below HTTP error first.
An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way.Create
.condarcconda configuration file(This file should):conda config --set show_channel_urls yesThis file is in your user directory by default,for example:
C:\Users\gouha\.gitconfigDelete initial content in
.condarc, the add the following content to.condarc.channels: - defaults show_channel_urls: true default_channels: - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r custom_channels: conda-forge: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud msys2: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud bioconda: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud menpo: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud pytorch: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud simpleitk: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudWarning
You may see below error when you have trouble access GitHub.
error: RPC failed; curl 56 LibreSSL SSL_read: error:02FFF03C:system library:func(4095):Operation timed out, errno 60 fatal: expected flush after ref listingSolution:
Change your network. In order to proceed smoothly later, hope you can solve this problem here.
conda activate open-machine-learning-jupyter-book# official guidance - https://jupyterbook.org/en/stable/start/build.html
# Windows
jupyter-book build .
# Mac
# if you are using bash
bash ./build.sh
# or you can rebuild everything
bash ./build-force-all.shThen you should be able to follow the build success message to view the book locally.
To Mac,
Warning
You may encouter following problem when you program on ARM-based M1 Mac.
OSError: no library called "cairo-2" was found no library called "cairo" was found no library called "libcairo-2" was foundSolution:
- Install Homebrew.
- Fetch Homebrew sources:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ```bash 3. Install the below missing dependencies through Homebrew: ```bash brew install cairo pango gdk-pixbuf libxml2 libxslt libffi
- Find out the path of
cairo,glibandpangoinstallation, and export them to DYLD_LIBRARY_PATH:# for example export DYLD_LIBRARY_PATH=/opt/homebrew/Cellar/cairo/1.16.0_5/lib/:/opt/homebrew/Cellar/pango/1.50.9/lib/:/opt/homebrew/Cellar/glib/2.72.3_1/lib/How to find out above pathes? Here is an example of cairo:
- Run the command
which brew.- If the response is
/opt/homebrew/bin/brew, now we get the Homebrew root path as '/opt/homebrew/'.(The result may depend on your OS!!)- Check if
cairo,glib,pangoare existing in/opt/homebrew/Cellar.- Find out the lib path for above libraries, such as
/opt/homebrew/Cellar/cairo/1.16.0_5/lib.(The result may depend on your OS!! Remind again.)
- Rerun
jupyter-book build .- Run
pip uninstall xcffibif error still exists, and then try again.
To Windows,
Warning
You may encouter following problem when you program.
OSError: no library called "cairo-2" was found no library called "cairo" was found no library called "libcairo-2" was foundSolution:
Download GTK3.
Run the following command.
pip uninstall xcffibRestart the terminal and build again.
The slides are implemented as notebooks in slides/, which is powered by RISE.
If you want to edit or preview the slides locally, you need to use Jupyter Notebook. Once you use Jupyter Notebook/JupyterLab to load the project, the slide will be launched in live mode after you open any corresponding notebook.
# Install javascript and css files
jupyter contrib nbextension install --user
# Enabling extensions
jupyter nbextension enable init_cell/main
# Launch the notebook
jupyter notebookWarning
Please make sure the Jupyter Notebook is running in trusted mode, and the init_cell is configured for the first cell of slide notebook. So that the first cell will be automatically executed to load the CSS.
See the code of conduct for more information.
See the LICENSE file for this project's licensing. We will ask you to confirm the licensing of your contribution. We may ask you to sign a Contributor License Agreement (CLA) for larger changes.