Skip to content

Commit

Permalink
Merge pull request #55 from cavalab/island_GA
Browse files Browse the repository at this point in the history
(py)Brush v1.0: islands!
  • Loading branch information
lacava authored Jun 11, 2024
2 parents f54104f + f70d32e commit ee44ac3
Show file tree
Hide file tree
Showing 123 changed files with 9,153 additions and 2,252 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
*.vscode
*.html

# files generated by running the test suite
tests/cpp/__*

tags
build/
operon/
Expand Down
40 changes: 36 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,16 @@ In addition, Brush provides functionality that allows you to feed in more compli
```python
# load data
import pandas as pd

df = pd.read_csv('docs/examples/datasets/d_enc.csv')
X = df.drop(columns='label')
y = df['label']

# import and make a regressor
from brush import BrushRegressor
est = BrushRegressor()
from pybrush import BrushRegressor

# you can set verbosity=1 to see the progress bar
est = BrushRegressor(verbosity=1)

# use like you would a sklearn regressor
est.fit(X,y)
Expand All @@ -118,15 +121,18 @@ print('score:', est.score(X,y))
```python
# load data
import pandas as pd

df = pd.read_csv('docs/examples/datasets/d_analcatdata_aids.csv')
X = df.drop(columns='target')
y = df['target']

# import and make a classifier
from brush import BrushClassifier
est = BrushClassifier()
from pybrush import BrushClassifier
est = BrushClassifier(verbosity=1)

# use like you would a sklearn classifier
est.fit(X,y)

y_pred = est.predict(X)
y_pred_proba = est.predict_proba(X)

Expand Down Expand Up @@ -237,4 +243,30 @@ If you are developing the cpp code and want to build the cpp tests, run the foll
./install tests
```

## Building the docs locally

To build the documentation you will need some additional requirements.
Before proceeding, make sure you have the python wrapper installed, as the documentation have some sample notebooks that will run the code.

First go to the `docs` folder:

```bash
cd docs/
```

Then, install additional python packages in the same environemnt as brush is intalled with:

```bash
conda activate brush
pip install -r requirements.txt
```

Now just run:

```bash
make html
```

The static website is located in `-build/html`

<!-- end development -->
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def configureDoxyfile(input_dir, output_dir):
with open('Doxyfile', 'w') as fp2:
fp2.write(filedata)


## Only trigger readthedocs build if running on readthedocs servers:
# read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'

Expand All @@ -58,7 +57,7 @@ def configureDoxyfile(input_dir, output_dir):
author = 'William La Cava and Joseph D. Romano'

# The full version, including alpha/beta/rc tags
release = '0.1a'
release = '0.1a' # TODO: use versionstr here


# -- General configuration ---------------------------------------------------
Expand Down Expand Up @@ -112,7 +111,8 @@ def configureDoxyfile(input_dir, output_dir):
breathe_default_project = "brush"
breathe_default_members = ('members', 'undoc-members')
breathe_projects_source = {
"brush": ("../src/", list(glob('../src/', recursive=True)))
"brush" : ("../src/", list(glob('../src/', recursive=True)) ),
"pybrush": ("../pybrush/", list(glob('../pybrush/', recursive=True)) ),
}

html_theme_options = {
Expand Down
5 changes: 5 additions & 0 deletions docs/cpp_api/archive.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Archive
=======

.. doxygenstruct:: Brush::Pop::Archive
:members:
9 changes: 9 additions & 0 deletions docs/cpp_api/engine.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Engine (and parameters)
=======================

.. doxygenstruct:: Brush::Parameters
:members:

.. doxygenclass:: Brush::Engine
:members:

8 changes: 8 additions & 0 deletions docs/cpp_api/evaluation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Evaluation
==========

.. doxygenclass:: Brush::Eval::Evaluation
:members:

.. doxygenclass:: Brush::Eval::Scorer
:members:
6 changes: 6 additions & 0 deletions docs/cpp_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@ search_space
program
node
nodetypes
individual
evaluation
population
variation
selection
archive
engine
```
8 changes: 8 additions & 0 deletions docs/cpp_api/individual.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Individual and Fitness
======================

.. doxygenclass:: Brush::Pop::Individual
:members:

.. doxygenstruct:: Brush::Fitness
:members:
5 changes: 5 additions & 0 deletions docs/cpp_api/population.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Population
==========

.. doxygenclass:: Brush::Pop::Population
:members:
14 changes: 14 additions & 0 deletions docs/cpp_api/selection.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Selection
=========

.. doxygenclass:: Brush::Sel::Selection
:members:

.. doxygenclass:: Brush::Sel::SelectionOperator
:members:

.. doxygenclass:: Brush::Sel::NSGA2
:members:

.. doxygenclass:: Brush::Sel::Lexicase
:members:
6 changes: 5 additions & 1 deletion docs/cpp_api/variation.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Variation (Crossover/Mutation)
==============================

.. doxygenfile:: variation.h
.. doxygenclass:: Brush::Var::MutationBase
:members:

.. doxygenclass:: Brush::Var::Variation
:members:
Loading

0 comments on commit ee44ac3

Please sign in to comment.