Skip to content

Instantly share code, notes, and snippets.

View alvesvm's full-sized avatar
🚩

Vinicius M. Alves alvesvm

🚩
View GitHub Profile
@alvesvm
alvesvm / logistic_ensemble.py
Created February 8, 2018 20:28 — forked from erogol/logistic_ensemble.py
logistic regression ensembles with feature selection. It requires sklearn python lib
def linear_model_ensemble(X, y, X_test, fold_num, fold_num_sec, grid_search_range, oobe=True, x_val=True ):
'''
X - Train set
y - Train set labels with. Labels are 1 for pos instances and -1 for neg instances
fold_num1 - Fold size for the first step X-validation to set the hyper-params
and feature selectors
#Multi-Class Summary Function
#Based on caret:::twoClassSummary
require(compiler)
multiClassSummary <- cmpfun(function (data, lev = NULL, model = NULL){
#Load Libraries
require(Metrics)
require(caret)
#Check data