-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jaime Sendra
committed
Apr 16, 2020
0 parents
commit fc3477a
Showing
248 changed files
with
29,333 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
### Description | ||
|
||
<!-- | ||
Please insert a brief description of the Pull request here | ||
--> | ||
|
||
### Related issues or pull requests | ||
|
||
<!-- | ||
If applicable, please link related issues/pull request here. E.g., | ||
Fixes #366 | ||
--> | ||
|
||
### Pull Request Checklist | ||
|
||
- [ ] Added a note about the modification or contribution to the `./docs/sources/CHANGELOG.md` file (if applicable) | ||
- [ ] Added appropriate unit test functions in the `./mlearn/*/tests` directories (if applicable) | ||
- [ ] Modify documentation in the corresponding Jupyter Notebook under `mlearn/docs/sources/` (if applicable) | ||
- [ ] Ran `PYTHONPATH='.' pytest ./mlearn -sv` and make sure that all unit tests pass (for small modifications, it might be sufficient to only run the specific test file, e.g., `PYTHONPATH='.' pytest ./mlearn/classifier/tests/xxx.py -sv`) | ||
- [ ] Checked for style issues by running `flake8 ./mlearn` | ||
|
||
|
||
<!--NOTE | ||
Due to the improved GitHub UI, the squashing of commits is no longer necessary. | ||
Please DO NOT SQUASH commits since they help with keeping track of the changes during the discussion). | ||
For more information and instructions, please see http://jaisenbe58r.github.io/mlearn/contributing/ | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Test Suites | ||
.coverage* | ||
.pytest_cache/ | ||
|
||
# Documentation builds | ||
# docs/site/ | ||
# docs/mlearn.pdf | ||
|
||
# Temporary documentation files | ||
# docs/sources/user_guide/*.md | ||
# docs/sources/user_guide/*/*.md | ||
# docs/sources/api_modules/ | ||
# docs/sources/api_subpackages/ | ||
|
||
# PyPI | ||
build/ | ||
dist/ | ||
MANIFEST | ||
|
||
# Temporary files | ||
.coverage | ||
.ipynb_checkpoints | ||
|
||
*.sqlite | ||
gmon.out | ||
__pycache__ | ||
*.pyc | ||
*.o | ||
*.so | ||
*.gcno | ||
*.swp | ||
*.egg-info | ||
*.egg | ||
*~ | ||
build | ||
dist | ||
lib/test | ||
doc/_build | ||
*env | ||
*ENV | ||
.DS_store | ||
.idea | ||
© 2020 GitHub, Inc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
language: python | ||
python: | ||
- "3.4" | ||
- "3.5" | ||
- "3.6" # current default Python on Travis CI | ||
- "3.7" | ||
- "3.8" | ||
- "3.8-dev" # 3.8 development branch | ||
- "nightly" # nightly build | ||
before_install: | ||
- python --version | ||
- pip install -r rquirements.txt | ||
install: | ||
- pip install ".[test]" . # install package + test dependencies | ||
script: pytest # run tests | ||
after_success: | ||
- codecov # submit coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Jaime Sendra Berenguer | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
include *.txt | ||
include *.md | ||
include *.cfg | ||
include *.pkl | ||
recursive-include ./mlextend/* | ||
|
||
include ./requirements.txt | ||
exclude *.log | ||
|
||
recursive-exclude * __pycache__ | ||
recursive-exclude * *.py[co] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
[![DOI](http://joss.theoj.org/papers/10.21105/joss.00638/status.svg)](https://doi.org/10.21105/joss.00638) | ||
[![Build Status](https://travis-ci.org/jaisenbe58r/mlearn.svg?branch=master)](https://travis-ci.org/jaisenbe58r/mlearn) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/7vx20e0h5dxcyla2/branch/master?svg=true)](https://ci.appveyor.com/project/jaisenbe58r/mlearn/branch/master) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2a199e28871c477d9ecf6e200b4977b9)](https://www.codacy.com/manual/jaisenbe58r/mlearn?utm_source=github.com&utm_medium=referral&utm_content=jaisenbe58r/mlearn&utm_campaign=Badge_Grade) | ||
[![Coverage Status](https://coveralls.io/repos/jaisenbe58r/mlearn/badge.svg?branch=master&service=github)](https://coveralls.io/github/jaisenbe58r/mlearn?branch=master) | ||
![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg) | ||
![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg) | ||
![Python 3.7](https://img.shields.io/badge/python-3.8-blue.svg) | ||
![License](https://img.shields.io/badge/license-MIT-ORANGE.svg) | ||
[![Discuss](https://img.shields.io/badge/discuss-DISCORD-PURPLE.svg)](https://discord.gg/yHCCa2) | ||
|
||
![](./docs/sources/img/logo.png) | ||
|
||
|
||
**mlearn (machine learning for data enginnering) is a Python library of useful tools for the day-to-day data science tasks.** | ||
|
||
<br> | ||
|
||
Jaime Sendra - 2020 | ||
|
||
<br> | ||
|
||
## Links | ||
|
||
- **Documentation:** [http://jaisenbe58r.github.io/mlearn](http://jaisenbe58r.github.io/mlearn) | ||
- PyPI: [https://pypi.python.org/pypi/mlearn](https://pypi.python.org/pypi/mlearn) | ||
- Changelog: [http://jaisenbe58r.github.io/mlearn/CHANGELOG](http://jaisenbe58r.github.io/mlearn/CHANGELOG) | ||
- Contributing: [http://jaisenbe58r.github.io/mlearn/CONTRIBUTING](http://jaisenbe58r.github.io/mlearn/CONTRIBUTING) | ||
- Questions? Check out the [Google Groups mailing list](https://groups.google.com/forum/#!forum/mlearn) | ||
|
||
<br> | ||
<br> | ||
|
||
## Installing mlearn | ||
|
||
#### PyPI | ||
|
||
To install mlearn, just execute | ||
|
||
```bash | ||
pip install mlearn | ||
``` | ||
|
||
Alternatively, you could download the package manually from the Python Package Index [https://pypi.python.org/pypi/mlearn](https://pypi.python.org/pypi/mlearn), unzip it, navigate into the package, and use the command: | ||
|
||
```bash | ||
python setup.py install | ||
``` | ||
|
||
#### Conda | ||
If you use conda, to install mlearn just execute | ||
|
||
```bash | ||
conda install -c conda-forge mlearn | ||
``` | ||
|
||
#### Dev Version | ||
|
||
The mlearn version on PyPI may always be one step behind; you can install the latest development version from the GitHub repository by executing | ||
|
||
```bash | ||
pip install git+git://github.com/jaisenbe58r/mlearn.git#egg=mlearn | ||
``` | ||
|
||
Or, you can fork the GitHub repository from https://github.com/jaisenbe58r/MLearn and install mlearn from your local drive via | ||
|
||
```bash | ||
python setup.py install | ||
``` | ||
|
||
<br> | ||
<br> | ||
|
||
|
||
--- | ||
|
||
## License | ||
|
||
|
||
## Contact | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.3 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# IPython Notebook to Markdown conversion script | ||
# | ||
# Jaime Sendra Berenguer | ||
# mlearn Machine Learning Library Extensions | ||
# | ||
# Author: Sebastian Raschka <sebastianraschka.com> | ||
# | ||
# License: BSD 3 clause | ||
import subprocess | ||
import glob | ||
import shutil | ||
import os | ||
import markdown | ||
from markdown.treeprocessors import Treeprocessor | ||
from markdown.extensions import Extension | ||
from nbconvert.exporters import MarkdownExporter | ||
|
||
|
||
class ImgExtractor(Treeprocessor): | ||
def run(self, doc): | ||
self.markdown.images = [] | ||
for image in doc.findall('.//img'): | ||
self.markdown.images.append(image.get('src')) | ||
|
||
|
||
class ImgExtExtension(Extension): | ||
def extendMarkdown(self, md, md_globals): | ||
img_ext = ImgExtractor(md) | ||
md.treeprocessors.add('imgext', img_ext, '>inline') | ||
|
||
|
||
def ipynb_to_md(ipynb_path): | ||
orig_path = os.getcwd() | ||
os.chdir(os.path.dirname(ipynb_path)) | ||
file_name = os.path.basename(ipynb_path) | ||
subprocess.call(['python', '-m', 'nbconvert', | ||
'--to', 'markdown', file_name]) | ||
|
||
new_s = [] | ||
md_name = file_name.replace('.ipynb', '.md') | ||
with open(md_name, 'r') as f: | ||
for line in f: | ||
if line.startswith('#'): | ||
new_s.append(line) | ||
break | ||
for line in f: | ||
if line.startswith(('## API', '# API')): | ||
new_s.append(line) | ||
new_s.append('\n') | ||
break | ||
new_s.append(line) | ||
for line in f: | ||
if line.lstrip().startswith('#'): | ||
break | ||
for line in f: | ||
new_s.append(line[4:]) | ||
|
||
with open(md_name, 'w') as f: | ||
f.write(''.join(new_s)) | ||
os.chdir(orig_path) | ||
|
||
|
||
# md = markdown.Markdown(extensions=[ImgExtExtension()]) | ||
# html = md.convert(data) | ||
# print(md.images) | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
import argparse | ||
parser = argparse.ArgumentParser( | ||
description='Convert docstring into a markdown API documentation.', | ||
formatter_class=argparse.RawTextHelpFormatter) | ||
|
||
parser.add_argument('-i', '--ipynb', | ||
help='Path to the IPython file') | ||
|
||
parser.add_argument('-a', '--all', | ||
help='Path to parse all ipynb recursively') | ||
|
||
parser.add_argument('-v', '--version', | ||
action='version', | ||
version='v. 0.1') | ||
|
||
args = parser.parse_args() | ||
|
||
if args.all and args.ipynb: | ||
raise AttributeError('Conflicting flags --ipynb and --all; choose one') | ||
|
||
if args.ipynb: | ||
ipynb_to_md(ipynb_path=args.ipynb) | ||
else: | ||
tree = os.walk(args.all) | ||
for d in tree: | ||
filenames = glob.glob(os.path.join(d[0], '*')) | ||
for f in filenames: | ||
if f.endswith('.ipynb'): | ||
print(f) | ||
|
||
ipynb_to_md(ipynb_path=f) |
Oops, something went wrong.