-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: Big documentation cleanup
- Loading branch information
Showing
40 changed files
with
915 additions
and
428 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 |
---|---|---|
|
@@ -36,15 +36,22 @@ In addition to the common features offered by traditional HPO and NAS libraries, | |
## Getting Started | ||
|
||
### 1. Installation | ||
NePS requires Python 3.8 or higher. You can install it via pip or from source. | ||
|
||
Using pip: | ||
|
||
```bash | ||
pip install neural-pipeline-search | ||
``` | ||
|
||
> Note: As indicated with the `v0.x.x` version number, NePS is early stage code and APIs might change in the future. | ||
You can install from source by cloning the repository and running: | ||
```bash | ||
git clone [email protected]:automl/neps.git | ||
cd neps | ||
poetry install | ||
``` | ||
|
||
### 2. Basic Usage | ||
|
||
Using `neps` always follows the same pattern: | ||
|
@@ -111,7 +118,7 @@ if __name__ == "__main__": | |
## Examples | ||
|
||
Discover how NePS works through these practical examples: | ||
* **[Pipeline Space via YAML](neps_examples/basic_usage/defining_search_space)**: Explore how to define the `pipeline_space` using a | ||
* **[Pipeline Space via YAML](neps_examples/basic_usage/hpo_usage_example.py)**: Explore how to define the `pipeline_space` using a | ||
YAML file instead of a dictionary. | ||
|
||
* **[Hyperparameter Optimization (HPO)](neps_examples/basic_usage/hyperparameters.py)**: Learn the essentials of hyperparameter optimization with NePS. | ||
|
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,48 @@ | ||
"""Generate the code reference pages and navigation. | ||
# https://mkdocstrings.github.io/recipes/ | ||
""" | ||
from __future__ import annotations | ||
|
||
import logging | ||
from pathlib import Path | ||
|
||
import mkdocs_gen_files | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
# Modules whose members should not include inherited attributes or methods | ||
NO_INHERITS = tuple() | ||
|
||
SRCDIR = Path("neps").absolute().resolve() | ||
ROOT = SRCDIR.parent | ||
TAB = " " | ||
|
||
|
||
if not SRCDIR.exists(): | ||
raise FileNotFoundError( | ||
f"{SRCDIR} does not exist, make sure you are running this from the root of the repository." | ||
) | ||
|
||
for path in sorted(SRCDIR.rglob("*.py")): | ||
module_path = path.relative_to(ROOT).with_suffix("") | ||
doc_path = path.relative_to(ROOT).with_suffix(".md") | ||
full_doc_path = Path("api", doc_path) | ||
|
||
parts = tuple(module_path.parts) | ||
|
||
if parts[-1] in ("__main__", "__version__", "__init__"): | ||
continue | ||
|
||
if any(part.startswith("_") for part in parts): | ||
continue | ||
|
||
with mkdocs_gen_files.open(full_doc_path, "w") as fd: | ||
ident = ".".join(parts) | ||
fd.write(f"::: {ident}") | ||
|
||
if ident.endswith(NO_INHERITS): | ||
fd.write(f"\n{TAB}options:") | ||
fd.write(f"\n{TAB}{TAB}inherited_members: false") | ||
|
||
mkdocs_gen_files.set_edit_path(full_doc_path, path) |
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,76 @@ | ||
"""Generate the code reference pages and navigation. | ||
# https://mkdocstrings.github.io/recipes/ | ||
""" | ||
from __future__ import annotations | ||
|
||
import logging | ||
from pathlib import Path | ||
|
||
import mkdocs_gen_files | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
SRCDIR = Path("neps").absolute().resolve() | ||
ROOT = SRCDIR.parent | ||
EXAMPLE_FOLDER = ROOT / "neps_examples" | ||
TAB = " " | ||
|
||
|
||
if not SRCDIR.exists(): | ||
raise FileNotFoundError( | ||
f"{SRCDIR} does not exist, make sure you are running this from the root of the repository." | ||
) | ||
|
||
# Write the index page of the examples | ||
EXAMPLE_INDEX = EXAMPLE_FOLDER / "README.md" | ||
if not EXAMPLE_INDEX.exists(): | ||
raise FileNotFoundError( | ||
f"{EXAMPLE_INDEX} does not exist, make sure you are running this from the root of the repository." | ||
) | ||
|
||
with EXAMPLE_INDEX.open() as fd: | ||
example_index_contents = fd.read() | ||
|
||
DOCS_EXAMPLE_INDEX = Path("examples", "index.md") | ||
|
||
with mkdocs_gen_files.open(DOCS_EXAMPLE_INDEX, "w") as fd: | ||
fd.write(example_index_contents) | ||
|
||
mkdocs_gen_files.set_edit_path(DOCS_EXAMPLE_INDEX, EXAMPLE_INDEX) | ||
|
||
# Now Iterate through each example folder | ||
for example_dir in EXAMPLE_FOLDER.iterdir(): | ||
if not example_dir.is_dir(): | ||
continue | ||
|
||
readme = next((p for p in example_dir.iterdir() if p.name == "README.md"), None) | ||
doc_example_dir = Path("examples", example_dir.name) | ||
|
||
# Copy the README.md file to the docs/<example_dir>/index.md | ||
if readme is not None: | ||
doc_example_index = doc_example_dir / "index.md" | ||
with readme.open() as fd: | ||
contents = fd.read() | ||
|
||
with mkdocs_gen_files.open(doc_example_index, "w") as fd: | ||
fd.write(contents) | ||
|
||
mkdocs_gen_files.set_edit_path(doc_example_index, readme) | ||
|
||
# Copy the contents of all of the examples to the docs/<example_dir>/examples/<example_name>.md | ||
for path in example_dir.iterdir(): | ||
if path.suffix != ".py": | ||
continue | ||
|
||
with path.open() as fd: | ||
contents = fd.readlines() | ||
|
||
# NOTE: We use quad backticks to escape the code blocks that are present in some of the examples | ||
escaped_contents = "".join(["````python\n", *contents, "\n````"]) | ||
|
||
markdown_example_path = doc_example_dir / f"{path.stem}.md" | ||
with mkdocs_gen_files.open(markdown_example_path, "w") as fd: | ||
fd.write(escaped_contents) | ||
|
||
mkdocs_gen_files.set_edit_path(markdown_example_path, path) |
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
# API | ||
Use the tree to navigate the API documentation. |
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.