Warning
the use the of a DB Adapter can reduce the performance of the Genetic Algorithm.
Pyevolve have a feature in which you can save the statistics of every generation in a database, file or call an URL with the statistics as param. You can use the database to plot evolution statistics graphs later. In this module, you’ll find the adapters above cited.
See also
DBFileCSV Class - Adapter to dump statistics in CSV format
>>> adapter = DBFileCSV(filename="file.csv", identify="run_01",
frequency = 1, reset = True)
param filename: | the CSV filename |
---|---|
param identify: | the identify of the run |
param frequency: | |
the generational dump frequency | |
param reset: | if is True, the file old data will be overwrite with the new |
Inserts the stats into the CSV file
Parameters: |
|
---|
DBSQLite Class - Adapter to dump data in SQLite3 database format
>>> dbadapter = DBSQLite(identify="test")
When you run some GA for the first time, you need to create the database, for this, you must use the resetDB parameter:
>>> dbadapter = DBSQLite(identify="test", resetDB=True)
This parameter will erase all the database tables and will create the new ones. The resetDB parameter is different from the resetIdentify parameter, the resetIdentify only erases the rows with the same “identify” name.
Parameters: |
|
---|
Create table using the Statistics class structure
Parameter: | stats – the statistics object |
---|
Return a cursor from the pool
Return type: | the cursor |
---|
Inserts the statistics data to database
Parameters: |
|
---|
Deletes de current structure and calls createStructure
Parameter: | stats – the statistics object |
---|
DBURLPost Class - Adapter to call an URL with statistics
>>> dbadapter = DBSQLite(url="http://localhost/post.py", identify="test")
The parameters that will be sent is all the statistics described in the Statistics.Statistics class, and the parameters:
Note
see the Statistics.Statistics documentation.
Parameters: |
|
---|
Sends the data to the URL using POST or GET
Parameters: |
|
---|