GeneticFS is a library for feature selection in Machine Learning using a Genetic Algorithm as an optimisation method. More about the development and tests related to the package are explained HERE
- Replaced accuracy score for classification models with F1 score
- Added hyperparameter descriptions to improve ease of use
GeneticFS uses a number of open source projects to work properly:
- Sci-Kit Learn
- Numpy
- Matplotlib
And of course GeneticFS itself is open source with a public repository on GitHub.
Install the dependencies
$ pip install numpy
$ pip install matplotlib
$ pip install sklearn
Install the package
$ pip install geneticfs
Regression Model:
from geneticfs import GeneticFS
from sklearn.linear_model import LinearRegression
lin_model = LinearRegression()
gfs = GeneticFS()
# fit the optimizer
gfs.fit(model=lin_model, _type='regression', X=X, y=y) # regression model
# get results output
binary_output_of_optimal_variables, indicies_of_optimal_variables = gfs.results()
# plot results of progress
gfs.plot_progress()
Classification Model:
from geneticfs import GeneticFS
from sklearn.linear_model import LogisticRegression
log_model = LogisticRegression()
gfs = GeneticFS()
# fit the optimizer
gfs.fit(model=log_model, _type='classification', X=X, y=y) # classification model
# get results output
binary_output_of_optimal_variables, indicies_of_optimal_variables = gfs.results()
# plot results of progress
gfs.plot_progress()
- Write more Tests
- Add more flexibility in use
MIT