|
| 1 | + |
| 2 | +Contributing code |
| 3 | +================= |
| 4 | + |
| 5 | +This guide is adapted from (scikit-learn)[https://github.com/viisar/brew/blob/master/CONTRIBUTING.rst] |
| 6 | + |
| 7 | +How to contribute |
| 8 | +----------------- |
| 9 | + |
| 10 | +The preferred way to contribute to imbalanced-learn is to fork the |
| 11 | +[main repository](https://github.com/fmfn/UnbalancedDataset) on |
| 12 | +GitHub: |
| 13 | + |
| 14 | +1. Fork the [project repository](https://github.com/fmfn/UnbalancedDataset): |
| 15 | + click on the 'Fork' button near the top of the page. This creates |
| 16 | + a copy of the code under your account on the GitHub server. |
| 17 | + |
| 18 | +2. Clone this copy to your local disk: |
| 19 | + |
| 20 | + $ git clone [email protected]:YourLogin/UnbalancedDataset.git |
| 21 | + $ cd UnbalancedDataset |
| 22 | + |
| 23 | +3. Create a branch to hold your changes: |
| 24 | + |
| 25 | + $ git checkout -b my-feature |
| 26 | + |
| 27 | + and start making changes. Never work in the ``master`` branch! |
| 28 | + |
| 29 | +4. Work on this copy on your computer using Git to do the version |
| 30 | + control. When you're done editing, do: |
| 31 | + |
| 32 | + $ git add modified_files |
| 33 | + $ git commit |
| 34 | + |
| 35 | + to record your changes in Git, then push them to GitHub with: |
| 36 | + |
| 37 | + $ git push -u origin my-feature |
| 38 | + |
| 39 | +Finally, go to the web page of your fork of the imbalanced-learn repo, |
| 40 | +and click 'Pull request' to send your changes to the maintainers for |
| 41 | +review. This will send an email to the committers. |
| 42 | + |
| 43 | +(If any of the above seems like magic to you, then look up the |
| 44 | +[Git documentation](http://git-scm.com/documentation) on the web.) |
| 45 | + |
| 46 | +Contributing Pull Requests |
| 47 | +-------------------------- |
| 48 | + |
| 49 | +It is recommended to check that your contribution complies with the |
| 50 | +following rules before submitting a pull request: |
| 51 | + |
| 52 | +- Follow the |
| 53 | + [coding-guidelines](http://scikit-learn.org/dev/developers/contributing.html#coding-guidelines) |
| 54 | + as for scikit-learn. |
| 55 | + |
| 56 | +- When applicable, use the validation tools and other code in the |
| 57 | + `sklearn.utils` submodule. A list of utility routines available |
| 58 | + for developers can be found in the |
| 59 | + [Utilities for Developers](http://scikit-learn.org/dev/developers/utilities.html#developers-utils) |
| 60 | + page. |
| 61 | + |
| 62 | +- If your pull request addresses an issue, please use the title to describe |
| 63 | + the issue and mention the issue number in the pull request description to |
| 64 | + ensure a link is created to the original issue. |
| 65 | + |
| 66 | +- All public methods should have informative docstrings with sample |
| 67 | + usage presented as doctests when appropriate. |
| 68 | + |
| 69 | +- Please prefix the title of your pull request with `[MRG]` if the |
| 70 | + contribution is complete and should be subjected to a detailed review. |
| 71 | + Incomplete contributions should be prefixed `[WIP]` to indicate a work |
| 72 | + in progress (and changed to `[MRG]` when it matures). WIPs may be useful |
| 73 | + to: indicate you are working on something to avoid duplicated work, |
| 74 | + request broad review of functionality or API, or seek collaborators. |
| 75 | + WIPs often benefit from the inclusion of a |
| 76 | + [task list](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments) |
| 77 | + in the PR description. |
| 78 | + |
| 79 | +- All other tests pass when everything is rebuilt from scratch. On |
| 80 | + Unix-like systems, check with (from the toplevel source folder): |
| 81 | + |
| 82 | + $ make |
| 83 | + |
| 84 | +- When adding additional functionality, provide at least one |
| 85 | + example script in the ``examples/`` folder. Have a look at other |
| 86 | + examples for reference. Examples should demonstrate why the new |
| 87 | + functionality is useful in practice and, if possible, compare it |
| 88 | + to other methods available in scikit-learn. |
| 89 | + |
| 90 | +- Documentation and high-coverage tests are necessary for enhancements |
| 91 | + to be accepted. |
| 92 | + |
| 93 | +- At least one paragraph of narrative documentation with links to |
| 94 | + references in the literature (with PDF links when possible) and |
| 95 | + the example. |
| 96 | + |
| 97 | +You can also check for common programming errors with the following |
| 98 | +tools: |
| 99 | + |
| 100 | +- Code with good unittest coverage (at least 80%), check with: |
| 101 | + |
| 102 | + $ pip install nose coverage |
| 103 | + $ nosetests --with-coverage path/to/tests_for_package |
| 104 | + |
| 105 | +- No pyflakes warnings, check with: |
| 106 | + |
| 107 | + $ pip install pyflakes |
| 108 | + $ pyflakes path/to/module.py |
| 109 | + |
| 110 | +- No PEP8 warnings, check with: |
| 111 | + |
| 112 | + $ pip install pep8 |
| 113 | + $ pep8 path/to/module.py |
| 114 | + |
| 115 | +- AutoPEP8 can help you fix some of the easy redundant errors: |
| 116 | + |
| 117 | + $ pip install autopep8 |
| 118 | + $ autopep8 path/to/pep8.py |
| 119 | + |
| 120 | +Filing bugs |
| 121 | +----------- |
| 122 | +We use Github issues to track all bugs and feature requests; feel free to |
| 123 | +open an issue if you have found a bug or wish to see a feature implemented. |
| 124 | + |
| 125 | +It is recommended to check that your issue complies with the |
| 126 | +following rules before submitting: |
| 127 | + |
| 128 | +- Verify that your issue is not being currently addressed by other |
| 129 | + [issues](https://github.com/fmfn/UnbalancedDataset/issues?q=) |
| 130 | + or [pull requests](https://github.com/fmfn/UnbalancedDataset/pulls?q=). |
| 131 | + |
| 132 | +- Please ensure all code snippets and error messages are formatted in |
| 133 | + appropriate code blocks. |
| 134 | + See [Creating and highlighting code blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks). |
| 135 | + |
| 136 | +- Please include your operating system type and version number, as well |
| 137 | + as your Python, scikit-learn, numpy, and scipy versions. This information |
| 138 | + can be found by runnning the following code snippet: |
| 139 | + |
| 140 | + ```python |
| 141 | + import platform; print(platform.platform()) |
| 142 | + import sys; print("Python", sys.version) |
| 143 | + import numpy; print("NumPy", numpy.__version__) |
| 144 | + import scipy; print("SciPy", scipy.__version__) |
| 145 | + import sklearn; print("Scikit-Learn", sklearn.__version__) |
| 146 | + ``` |
| 147 | + |
| 148 | +- Please be specific about what estimators and/or functions are involved |
| 149 | + and the shape of the data, as appropriate; please include a |
| 150 | + [reproducible](http://stackoverflow.com/help/mcve) code snippet |
| 151 | + or link to a [gist](https://gist.github.com). If an exception is raised, |
| 152 | + please provide the traceback. |
| 153 | + |
| 154 | +Documentation |
| 155 | +------------- |
| 156 | + |
| 157 | +We are glad to accept any sort of documentation: function docstrings, |
| 158 | +reStructuredText documents (like this one), tutorials, etc. |
| 159 | +reStructuredText documents live in the source code repository under the |
| 160 | +doc/ directory. |
| 161 | + |
| 162 | +You can edit the documentation using any text editor and then generate |
| 163 | +the HTML output by typing ``make html`` from the doc/ directory. |
| 164 | +Alternatively, ``make`` can be used to quickly generate the |
| 165 | +documentation without the example gallery. The resulting HTML files will |
| 166 | +be placed in _build/html/ and are viewable in a web browser. See the |
| 167 | +README file in the doc/ directory for more information. |
| 168 | + |
| 169 | +For building the documentation, you will need |
| 170 | +[sphinx](http://sphinx.pocoo.org/), |
| 171 | +[matplotlib](http://matplotlib.sourceforge.net/), and |
| 172 | +[pillow](http://pillow.readthedocs.org/en/latest/). |
| 173 | + |
| 174 | +When you are writing documentation, it is important to keep a good |
| 175 | +compromise between mathematical and algorithmic details, and give |
| 176 | +intuition to the reader on what the algorithm does. It is best to always |
| 177 | +start with a small paragraph with a hand-waving explanation of what the |
| 178 | +method does to the data and a figure (coming from an example) |
| 179 | +illustrating it. |
0 commit comments