Skip to content

Instantly share code, notes, and snippets.

View fmder's full-sized avatar

François-Michel De Rainville fmder

  • Québec, Canada
View GitHub Profile
anonymous
anonymous / gp_symbreg_bloatControl.py
Created October 27, 2011 04:58
A complete example of how to implement static (fixed) depth limits and double tournament in GP with DEAP on the symbolic regression problem
# This file is part of EAP.
#
# EAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# EAP is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ramhiser
ramhiser / one-hot.py
Last active April 7, 2021 06:44
Apply one-hot encoding to a pandas DataFrame
import pandas as pd
import numpy as np
from sklearn.feature_extraction import DictVectorizer
def encode_onehot(df, cols):
"""
One-hot encoding is applied to columns specified in a pandas DataFrame.
Modified from: https://gist.github.com/kljensen/5452382