Module qsarmodelingpy.ga
Variable selection with Genetic Algorithm.
Functions
def checkLen(min, max)
def initIndividual(icls, imin, imax, size)
def returnIndices(individual)
Classes
class Ga (X: pandas.core.frame.DataFrame, y: pandas.core.frame.DataFrame, nLV: int = None, scale: bool = True, min_size: int = 5, max_size: int = 25, size_population: int = 200, mig_rate: float = 0.2, cxpb: float = 0.5, mutpb: float = 0.2, ngen: int = 120)
-
Variable selection with Genetic Algorithm.
Args
X
:DataFrame
- The matrix with descriptors.
y
:DataFrame, list, array
- The dependent variable vector.
nLV
:int
, optional- Number of Latent Variables. Defaults to None.
scale
:bool
, optional- Defaults to True.
min_size
:int
, optional- Minimum number of variables in the model. Defaults to 5.
max_size
:int
, optional- Maximum number of variables in the model. Defaults to 25.
size_population
:int
, optional- Size of the population in each generation. Defaults to 200.
mig_rate
:float
, optional- Migration rate. Defaults to 0.2.
cxpb
:float
, optional- Crossover rate. Defaults to 0.5.
mutpb
:float
, optional- Mutation rate. Defaults to 0.2.
ngen
:int
, optional- Number of generations. Defaults to 120.
Methods
def evaluate(self, individual)
-
Do some hard computing on the individual
def run(self)
def savePop(self, file)
-
Saves population to
file
.Args
file (str path, file-like,
io
): The filename to save population output. def saveQ2(self, file)
-
Saves Q² output to
file
.Args
file (str path, file-like,
io
): The filename to save Q² output.