Skip to content

Commit b9489bc

Browse files
Update: added more documentation options for database handling
1 parent 76ee160 commit b9489bc

File tree

7 files changed

+751
-10
lines changed

7 files changed

+751
-10
lines changed

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Installation Guide <source/installation_guide>
4141
Evolutionary Computing Course Documentation <source/ec_course_docs>
4242
GUI <source/GUI>
4343
Your first EA with ARIEL <source/ea_intro/ea_example>
44-
ARIEL Database Handling <source/Db_examples/db_with_pandas>
44+
ARIEL Database Handling <source/Db_examples/index>
4545
MuJoCo Data Variables Documentation <source/Mujoco_docs/mujoco_docs>
4646
```
4747
---

docs/source/Db_examples/db_with_pandas.ipynb

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
},
1919
{
2020
"cell_type": "code",
21-
"execution_count": 1,
21+
"execution_count": null,
2222
"id": "08c2e5da",
2323
"metadata": {},
2424
"outputs": [],
2525
"source": [
26+
"# Import the libraries\n",
2627
"import pandas as pd\n",
2728
"import matplotlib.pyplot as plt\n",
2829
"import sqlite3\n",
@@ -34,7 +35,7 @@
3435
"id": "5f210e72",
3536
"metadata": {},
3637
"source": [
37-
"## How to get data about the experiment\n",
38+
"## 1. How to get data about the experiment\n",
3839
"\n",
3940
"As explained above, ARIEL uses an SQL database to store the data for the individuals. This means that we have a complete file of every individual that existed during the evolution process whether they died or continued to live until the final generation. "
4041
]
@@ -44,7 +45,7 @@
4445
"id": "8d93181b",
4546
"metadata": {},
4647
"source": [
47-
"## Database to pandas dataframe\n",
48+
"## 1.1 Database to pandas dataframe\n",
4849
"\n",
4950
"All data about the individuals is stored in the `individual` table. The following line shows you how to turn the database into a pandas DataFrame, which then allows you to manipulate and use the data however you want."
5051
]
@@ -313,7 +314,7 @@
313314
"id": "ed5d7ad0",
314315
"metadata": {},
315316
"source": [
316-
"### Get population per generation\n",
317+
"### 2. Get population per generation\n",
317318
"\n",
318319
"The way ARIEL keeps track of individuals is not in the form of a list for each generation like it is more usually used in EAs. Normally in EAs, the population is represented as a list holding the \"current alive population\". This means that if you want more detailed data on individuals that did not survive to the end of the evolution loop you do not have that data.\n",
319320
"\n",
@@ -477,7 +478,12 @@
477478
"id": "1ec9d1fa",
478479
"metadata": {},
479480
"source": [
480-
"Now that we have the list of the ids of each individual per generation, we can start querying information from the data to get deeper insights. For this example we will extract the mean and best (min) fitness and standard deviation of the fitness per generation. "
481+
"## 2. Computing fitness statistics per generation\n",
482+
"\n",
483+
"Now that we know which individuals were alive in each generation, we can compute:\n",
484+
"- Mean fitness\n",
485+
"- Standard deviation\n",
486+
"- Best (minimum) fitness"
481487
]
482488
},
483489
{
@@ -703,14 +709,14 @@
703709
"id": "8dba6c51",
704710
"metadata": {},
705711
"source": [
706-
"### Plotting\n",
712+
"## 3. Plotting\n",
707713
"\n",
708714
"Now that we have the mean and best fitness and standard deviation per generation, we can use them to plot the fitness progression "
709715
]
710716
},
711717
{
712718
"cell_type": "code",
713-
"execution_count": 6,
719+
"execution_count": null,
714720
"id": "49ab868e",
715721
"metadata": {},
716722
"outputs": [
@@ -729,9 +735,9 @@
729735
"# Create a copy of dataframe\n",
730736
"df = pop_df.copy()\n",
731737
"\n",
732-
"# Create mast to avoid missing data \n",
738+
"# Create mask to avoid missing data \n",
733739
"# if the evolution process was done correctly this should not change anything.\n",
734-
"# This mask cold be used to get custom data out of the dataframe\n",
740+
"# This mask could be used to get custom data out of the dataframe\n",
735741
"mask = df['fitness_mean'].notna()\n",
736742
"\n",
737743
"# Get data according to the mask\n",

docs/source/Db_examples/db_with_polars.ipynb

Lines changed: 369 additions & 0 deletions
Large diffs are not rendered by default.

docs/source/Db_examples/db_with_sqlite3.ipynb

Lines changed: 320 additions & 0 deletions
Large diffs are not rendered by default.

docs/source/Db_examples/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ARIEL Database Handling
2+
3+
This section discusses methods for storing, loading, and processing ARIEL experiment data using different backends.
4+
5+
```{toctree}
6+
:maxdepth: 2
7+
8+
db_with_pandas
9+
db_with_polars
10+
db_with_sqlite
11+
```

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies = [
2222
"numpy-quaternion>=2023.0.3",
2323
"opencv-python>=4.11.0.86",
2424
"pillow>=11.3.0",
25+
"polars>=1.35.2",
2526
"pydantic>=2.11.9",
2627
"pydantic-settings>=2.10.1",
2728
"rich>=14.1.0",

uv.lock

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)