Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regression, tests and refactor into base class #5

Merged
merged 6 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
python-version: 3.9
- run: python -m pip install --upgrade pip
- run: pip install mkdocs-material mkdocstrings docstring-parser
- run: pip install -e .
- run: pip install mkdocs-material mkdocstrings docstring-parser
- run: mkdocs gh-deploy --force
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
python-version: 3.9
- run: python -m pip install --upgrade pip
- run: pip install black
- run: black --check groot/
Expand All @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
python-version: 3.9
- run: python -m pip install --upgrade pip
- run: pip install -e .
- run: pip install pytest
Expand Down
18 changes: 16 additions & 2 deletions docs/reference/models/groot_forest.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
The `GrootRandomForest` class uses bootstrap aggregation and partially random feature selection to train an ensemble of `GrootTree`s. On datasets with many features, a `GrootRandomForest` might perform better than a `GrootTree` as it is not limited in the number of features it can use by a maximum size.
The `GrootRandomForestClassifier` class uses bootstrap aggregation and partially random feature selection to train an ensemble of `GrootTreeClassifier`s. On datasets with many features, a `GrootRandomForestClassifier` might perform better than a `GrootTreeClassifier` as it is not limited in the number of features it can use by a maximum size.

::: groot.model:GrootRandomForest
**Example:**
```python
from sklearn.datasets import make_moons
X, y = make_moons(random_state=1)

from groot.model import GrootRandomForestClassifier
forest = GrootRandomForestClassifier(attack_model=[0.1, 0.1], random_state=1)
forest.fit(X, y)
print(forest.score(X, y))
```
```
1.0
```

::: groot.model:GrootRandomForestClassifier
18 changes: 16 additions & 2 deletions docs/reference/models/groot_tree.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
The main class in the GROOT repository is the `GrootTree`, this class implements GROOT as a Scikit-learn compatible classifier. That means you initialize it with all important hyperparameters, then fit it using `.fit(X, y)` and predict with `.predict(X)` or `.predict_proba(X)`. The `GrootTree` is also used within the `GrootRandomForest`.
The main class in the GROOT repository is the `GrootTreeClassifier`, this class implements GROOT as a Scikit-learn compatible classifier. That means you initialize it with all important hyperparameters, then fit it using `.fit(X, y)` and predict with `.predict(X)` or `.predict_proba(X)`. The `GrootTreeClassifier` is also used within the `GrootRandomForestClassifier`.

::: groot.model:GrootTree
**Example:**
```python
from sklearn.datasets import make_moons
X, y = make_moons(random_state=1)

from groot.model import GrootTreeClassifier
tree = GrootTreeClassifier(max_depth=3, attack_model=[0.1, 0.1])
tree.fit(X, y)
print(tree.score(X, y))
```
```
0.9
```

::: groot.model:GrootTreeClassifier