Module writepop
[hide private]
[frames] | no frames]

Module writepop

source code

writepop

Contains all classes used to write and extract individuals and populations on the SQLite database.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Author: by Mehdi Khoury

Version: 1.20

Copyright: (c) 2009 Mehdi Khoury under the mit license http://www.opensource.org/licenses/mit-license.html

Contact: mehdi.khoury at gmail.com

Functions [hide private]
 
ClearDBTable(dbname, table)
clear the table of the database
source code
 
WriteInitialPopulation2DB(popsize, root_node, mintreesize, maxtreesize, buildmethod, dbname, tablename)
create a new population of randomly generated trees and write them to a database
source code
 
PrintPopFromDB(dbname, tablename, filename)
print the population of trees with id references, tree depth and fitness scores
source code
 
GetPopStatFromDB(dbname, tablename)
get statistical data about the population
source code
Variables [hide private]
  __package__ = None
Function Details [hide private]

ClearDBTable(dbname, table)

source code 

Function: ClearDBTable

clear the table of the database

Parameters:
  • dbname - path to database e.g. r'D:d_work\pythongp\pySTGP_0.51\src\pop_db'
  • table - name of the database table

WriteInitialPopulation2DB(popsize, root_node, mintreesize, maxtreesize, buildmethod, dbname, tablename)

source code 

Function: WriteInitialPopulation2DB

create a new population of randomly generated trees and write them to a database

Parameters:
  • popsize - size of the population
  • root_node - specify the root node and its arity (nb of children). e.g. (0,2,'root')
  • mintreesize - min tree depth (at the moment only 2 working)
  • maxtreesize - max tree depth (At least 2)
  • buildmethod - which Koza method is used to build the trees (either 'AddHalfNode' or 'AddFullNode' or 'AddGrowNodeMin' respectively for Half, Full, or Ramped Half-n-Half)
  • dbname - path to database e.g. r'D:d_work\pythongp\pySTGP_0.51\src\pop_db'
  • tablename - name of the database table

PrintPopFromDB(dbname, tablename, filename)

source code 

Function: PrintPopFromDB

print the population of trees with id references, tree depth and fitness scores

Parameters:
  • dbname - path to database e.g. r'D:d_work\pythongp\pySTGP_0.51\src\pop_db'
  • tablename - name of the database table

GetPopStatFromDB(dbname, tablename)

source code 

Function: GetPopStatFromDB

get statistical data about the population

Parameters:
  • dbname - path to database e.g. r'D:d_work\pythongp\pySTGP_0.51\src\pop_db'
  • tablename - name of the database table