Giter Club home page Giter Club logo

santander's Introduction

Laurae2 R-package

The sequel to Laurae R-package.

Each function has at least one corresponding vignette to look up for an example using help_me("my_function_name").

Installation

It can be computationally expensive to build vignettes. Build without vignettes using the following:

devtools::install_github("Laurae2/Laurae2")

If you want to build vignettes to get a significantly better help:

devtools::install_github("Laurae2/Laurae2", build_vignettes = TRUE)

Pre-requirement installation:

install.packages("devtools")
install.packages(c("knitr", "rmarkdown", "mlrMBO", "lhs", "smoof", "ParamHelpers", "animation"))

xgboost installation, commit dmlc/xgboost@017acf5 seems best currently as it has gblinear improvements. Make sure to use the right compiler below:

devtools::install_github("Laurae2/xgbdl")

# gcc
xgbdl::xgb.dl(compiler = "gcc", commit = "017acf5", use_avx = FALSE, use_gpu = FALSE)

# Visual Studio 2015, use AVX if you wish to
xgbdl::xgb.dl(compiler = "Visual Studio 14 2015 Win64", commit = "017acf5", use_avx = FALSE, use_gpu = FALSE)

# Visual Studio 2017, use AVX if you wish to
xgbdl::xgb.dl(compiler = "Visual Studio 15 2017 Win64", commit = "017acf5", use_avx = FALSE, use_gpu = FALSE)

What can it do?

What can it do:

  • Bayesian Optimization (time-limited, iteration-limited, initialization-limited)
  • Create data.frame from [R,C] matrix-like format
  • Create data.table from [R,C] matrix-like format

Package requirements:

  • knitr
  • rmarkdown
  • mlrMBO
  • lhs
  • smoof
  • ParamHelpers
  • animation
  • xgboost

santander's People

Contributors

indradenbakker avatar laurae2 avatar parayamelo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

valeman

santander's Issues

Diverse questions relative a cette contribution Kaggle

Bonjour Laurae,

Je m'adresse a toi en français car j'ai vu ton profil kaggle que tu étais en île de France. Moi aussi.
Je suis un nouveau passionné de datascience et j’étudie des codes comme le tien afin d'apprendre.
Merci de partager ainsi votre connaissance. J'ai donc qques questions concernant ton code si tu veux bien y répondre.
Je suis aussi dispo par tout autre moyen de communication que tu souhaiterai.

Question1 --------------------------------------------------------------------------------------

  • Est ce que ton algorithme blend_proba (Stacker.py) prend en compte le cas de la multiclassification ?
  • Au sein de cet algorithme on a ceci a adapter en fonction de la métrique
 for i in range(len(fold_preds)): 
        if fold_preds[i]<0.0: #adapt to metric  
            fold_preds[i] = 0.0 #adapt to metric
        if fold_preds[i]>1.0: #adapt to metric 
            fold_preds[i] = 1.0 #adapt to metric 

N'est ce pas plutôt a adapter en fonction en fonction du fait qu'on fait une classification binaire, multiclassification ou régression ?

Ce que je comprend la c'est que vu que tu va utiliser des "regressor" pour faire une classification binaire, tu corrige les sorties de la classification binaire de cette façon.

Pour moi sur un problème de régression ce ne serait pas nécessaire et que faire sur un problème de multiclassification ?

Il fait la meme chose que le tien mais j'arrive pas a le faire fonctionner sous Python 3.5 : http://stackoverflow.com/questions/39687959/error-when-converting-form-python-2-to-python-3

Question2 --------------------------------------------------------------------------------------

  • As tu des références sur cette technique qui te permet d'utiliser des regressor comme classifier stp ?

Question3 --------------------------------------------------------------------------------------

  • J'ai regardé sur le net pour voir si il existait des stacking de plus de 3 levels et je n'en ai pas trouvé d'ou ma question pourquoi on ne va pas sur plus de 3 niveaux avec du stacking ? des problèmes de sur apprentissage ? Si oui pourquoi ?

Question4 --------------------------------------------------------------------------------------


def log_loss_func(weights):
    ''' scipy minimize will pass the weights as a numpy array '''
    final_prediction = 0
    for weight, prediction in zip(weights, predictions):
            final_prediction += weight*prediction

    return log_loss(Y_testing, final_prediction) 


#the algorithms need a starting value, right not we chose 0.5 for all weights
#its better to choose many random starting points and run minimize a few times
starting_values = np.ones(len(predictions))/(len(predictions))

#adding constraints  and a different solver 
cons = ({'type':'eq','fun':lambda w: 1-sum(w)})

#our weights are bound between 0 and 1
bounds = [(0,1)]*len(predictions)

res = minimize(log_loss_func, starting_values, method='SLSQP', bounds=bounds, constraints=cons)
#res = minimize(log_loss_func, starting_values, method='SLSQP')


print('Ensamble Score: {best_score}'.format(best_score=res['fun']))
print('Best Weights: {weights}'.format(weights=res['x'])) 

Ton bout de code ci dessus permet de calculer les poids en minimisant le log_loss et résoud le problème d'optimisation ci dessous:

op f(x)
    x =[a,b,c,......,n]
    0 <= xi <=1
    sum(x) = 1 

Mon problème concerne le cas ou on veux utiliser le roc_auc_score et donc l'optimiser et non le minimiser. comment traduire le fait qu'on veuille
optimiser et non minimiser

J'ai assayé les options suivantes et ce qui est surprenant j'ai la même sortie en terme de poids:

  • Essai_1
def roc_func(weights):
    ''' scipy minimize will pass the weights as a numpy array '''
    final_prediction = 0
    for weight, prediction in zip(weights, predictions):
            final_prediction += weight*prediction

    return roc_auc_score(Y_testing, final_prediction)
  • Essai_2 (en inversant la fonction précédente et en appliquant minimize, je me dit qu'on fait une maximisation (comme avec hyperopt))
def roc_func(weights):
    ''' scipy minimize will pass the weights as a numpy array '''
    final_prediction = 0
    for weight, prediction in zip(weights, predictions):
            final_prediction += weight*prediction

    return - roc_auc_score(Y_testing, final_prediction)
  • Essai_3
def roc_func(weights):
    ''' scipy minimize will pass the weights as a numpy array '''
    final_prediction = 0
    for weight, prediction in zip(weights, predictions):
            final_prediction += weight*prediction

    return 1 - roc_auc_score(Y_testing, final_prediction)

Diverse questions relative a cette contribution Kaggle

Bonjour Laurae,

Je m'adresse a toi en français car j'ai vu ton profil kaggle que tu étais en île de France. Moi aussi.
Je suis un nouveau passionné de datascience et j’étudie des codes comme le tien afin d'apprendre.
Merci de partager ainsi votre connaissance. J'ai donc qques questions concernant ton code si tu veux bien y répondre.
Je suis aussi dispo par tout autre moyen de communication que tu souhaiterai.

Question1 --------------------------------------------------------------------------------------

  • Est ce que ton algorithme blend_proba (Stacker.py) prend en compte le cas de la multiclassification ?
  • Au sein de cet algorithme on a ceci a adapter en fonction de la métrique
 for i in range(len(fold_preds)): 
        if fold_preds[i]<0.0: #adapt to metric  
            fold_preds[i] = 0.0 #adapt to metric
        if fold_preds[i]>1.0: #adapt to metric 
            fold_preds[i] = 1.0 #adapt to metric 

N'est ce pas plutôt a adapter en fonction en fonction du fait qu'on fait une classification binaire, multiclassification ou régression ?

Ce que je comprend la c'est que vu que tu va utiliser des "regressor" pour faire une classification binaire, tu corrige les sorties de la classification binaire de cette façon.

Pour moi sur un problème de régression ce ne serait pas nécessaire et que faire sur un problème de multiclassification ?

Il fait la meme chose que le tien mais j'arrive pas a le faire fonctionner sous Python 3.5 : http://stackoverflow.com/questions/39687959/error-when-converting-form-python-2-to-python-3

Question2 --------------------------------------------------------------------------------------

  • As tu des références sur cette technique qui te permet d'utiliser des regressor comme classifier stp ?

Question3 --------------------------------------------------------------------------------------

  • J'ai regardé sur le net pour voir si il existait des stacking de plus de 3 levels et je n'en ai pas trouvé d'ou ma question pourquoi on ne va pas sur plus de 3 niveaux avec du stacking ? des problèmes de sur apprentissage ? Si oui pourquoi ?

Question4 --------------------------------------------------------------------------------------


def log_loss_func(weights):
    ''' scipy minimize will pass the weights as a numpy array '''
    final_prediction = 0
    for weight, prediction in zip(weights, predictions):
            final_prediction += weight*prediction

    return log_loss(Y_testing, final_prediction) 


#the algorithms need a starting value, right not we chose 0.5 for all weights
#its better to choose many random starting points and run minimize a few times
starting_values = np.ones(len(predictions))/(len(predictions))

#adding constraints  and a different solver 
cons = ({'type':'eq','fun':lambda w: 1-sum(w)})

#our weights are bound between 0 and 1
bounds = [(0,1)]*len(predictions)

res = minimize(log_loss_func, starting_values, method='SLSQP', bounds=bounds, constraints=cons)
#res = minimize(log_loss_func, starting_values, method='SLSQP')


print('Ensamble Score: {best_score}'.format(best_score=res['fun']))
print('Best Weights: {weights}'.format(weights=res['x'])) 

Ton bout de code ci dessus permet de calculer les poids en minimisant le log_loss et résoud le problème d'optimisation ci dessous:

op f(x)
    x =[a,b,c,......,n]
    0 <= xi <=1
    sum(x) = 1 

Mon problème concerne le cas ou on veux utiliser le roc_auc_score et donc l'optimiser et non le minimiser. comment traduire le fait qu'on veuille
optimiser et non minimiser

J'ai assayé les options suivantes et ce qui est surprenant j'ai la même sortie en terme de poids:

  • Essai_1
def roc_func(weights):
    ''' scipy minimize will pass the weights as a numpy array '''
    final_prediction = 0
    for weight, prediction in zip(weights, predictions):
            final_prediction += weight*prediction

    return roc_auc_score(Y_testing, final_prediction)
  • Essai_2 (en inversant la fonction précédente et en appliquant minimize, je me dit qu'on fait une maximisation (comme avec hyperopt))
def roc_func(weights):
    ''' scipy minimize will pass the weights as a numpy array '''
    final_prediction = 0
    for weight, prediction in zip(weights, predictions):
            final_prediction += weight*prediction

    return - roc_auc_score(Y_testing, final_prediction)
  • Essai_3
def roc_func(weights):
    ''' scipy minimize will pass the weights as a numpy array '''
    final_prediction = 0
    for weight, prediction in zip(weights, predictions):
            final_prediction += weight*prediction

    return 1 - roc_auc_score(Y_testing, final_prediction)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.