Skip to content

Commit

Permalink
docs: infrastructure to include notebooks as documentation (#38)
Browse files Browse the repository at this point in the history
Closes #6.

### Summary of Changes

* Configure `mkdocs-jupyter` to be able to include notebooks in the
documentation
* Add an example notebook but don't include it in the navigation of the
documentation yet
  * Will be done later once we have better data in `safe-ds-examples`
  • Loading branch information
lars-reimann authored Mar 14, 2023
1 parent e1a8d2b commit a1c0d97
Show file tree
Hide file tree
Showing 7 changed files with 484 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ coverage.xml

# mkdocs
/site/
/docs/reference/safeds/
/docs/reference/SUMMARY.md

# MegaLinter
report/
Expand Down
4 changes: 4 additions & 0 deletions docs/reference/generate_reference_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def list_class_and_function_names_in_module(module_name: str) -> list[str]:
# Remove the final "__init__" part
parts = parts[:-1]

# Skip private modules
if any(part.startswith("_") for part in parts):
continue

qualified_name = ".".join(parts)

for name in list_class_and_function_names_in_module(qualified_name):
Expand Down
332 changes: 332 additions & 0 deletions docs/tutorials/data_visualization_notebook.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/tutorials/machine_learning.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Create SupervisedDataset

Here is a short introduction to train and predict with a machine learning model in safe-ds.
Here is a short introduction to train and predict with a machine learning model in Safe-DS.

First we need to create a [SupervisedDataset][safeds.data.SupervisedDataset] from the training data.

Expand All @@ -24,7 +24,7 @@ to_be_predicted_table = Table({
sup_dataset = SupervisedDataset(table, target_column="target")
```

[SupervisedDatasets][safeds.data.SupervisedDataset] are used in safe-DS to train supervised machine learning models
[SupervisedDatasets][safeds.data.SupervisedDataset] are used in Safe-DS to train supervised machine learning models
(e.g. [RandomForest][safeds.ml.classification.RandomForest] for classification and
[LinearRegression][safeds.ml.regression.LinearRegression] as a regression model), because they keep track of the target
vector. A [SupervisedDataset][safeds.data.SupervisedDataset] can be created from a [Table][safeds.data.tabular.Table] and
Expand All @@ -37,7 +37,7 @@ train with (the sum of the rows). The `to_predicted_table` is the table we want
does not contain a target vector.

In order to train the [LinearRegression][safeds.ml.regression.LinearRegression]-model we need to make the following calls
in safe-DS:
in Safe-DS:

```python
linear_reg_model = LinearRegression()
Expand All @@ -46,7 +46,7 @@ linear_reg_model.fit(sup_dataset)

As we can see, a [LinearRegression][safeds.ml.regression.LinearRegression]-object is created.

In safe-DS machine learning models are separated in different classes where the different fit and predictions methods
In Safe-DS machine learning models are separated in different classes where the different fit and predictions methods
are implemented for the given machine learning model.

## Predicting new values
Expand Down
4 changes: 4 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ plugins:
- autorefs
- glightbox
- search
- mkdocs-jupyter:
execute: true
allow_errors: false
include_source: true

watch:
- src
Expand Down
143 changes: 136 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ mkdocs-glightbox = "^0.3.1"
mkdocs-literate-nav = "^0.6.0"
mkdocs-material = "^9.1.2"
mkdocs-section-index = "^0.3.5"
mkdocs-jupyter = "^0.23.0"
safe-ds-examples = "^0.2.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down

0 comments on commit a1c0d97

Please sign in to comment.