<commit_before>/**
 * @author <NAME> <<EMAIL>>
 * @date Thu 16 Jan 2014 14:27:40 CET
 *
 * @brief Python bindings to CGLogReg trainer
 *
 * Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
 */

#define XBOB_LEARN_LINEAR_MODULE
#include <xbob.blitz/cppapi.h>
#include <xbob.blitz/cleanup.h>
#include <xbob.learn.linear/api.h>
#include <structmember.h>

/************************************************
 * Implementation of CGLogRegTrainer base class *
 ************************************************/

PyDoc_STRVAR(s_logregtrainer_str, XBOB_EXT_MODULE_PREFIX ".CGLogRegTrainer");

PyDoc_STRVAR(s_logregtrainer_doc,
"CGLogRegTrainer([prior=0.5, [convergence_threshold=1e-5,\n\
                 [max_iterations=10000, [lambda=0.,\n\
                 [mean_std_norm=False]]]]]) -> new CGLogRegTrainer\n\
\n\
CGLogRegTrainer(other) -> new CGLogRegTrainer\n\
\n\
Trains a linear machine to perform Linear Logistic Regression.\n\
\n\
There are two initializers for objects of this class. In the\n\
first variant, the user passes the discrete training parameters,\n\
including the classes prior, convergence threshold and the\n\
maximum number of conjugate gradient (CG) iterations among\n\
other parameters. The second initialization form copy constructs\n\
a new trainer from an existing one.\n\
\n\
The training stage will place the resulting weights (and bias)\n\
in a linear machine with a single output dimension. If the\n\
parameter ``mean_std_norm`` is set to ``True``, then your input\n\
data will be mean/standard-deviation normalized and the\n\
according values will be set as normalization factors to the\n\
resulting machine.\n\
\n\
Keyword parameters:\n\
\n\
prior, float (optional)\n\
  The synthetic prior (should be in range :math:`]0.,1.[`).\n\
\n\
convergence_threshold, float (optional)\n\
  The convergence threshold for the conjugate gradient algorithm\n\
\n\
max_iterations, int (optional)\n\
  The maximum number of iterations for the conjugate gradient\n\
  algorithm\n\
\n\
lambda, float (optional)\n\
  The regularization factor lambda. If you set this to the value of\n\
  ``0.0`` (the default), then the algorithm will apply **no**\n\
  regularization whatsoever.\n\
\n\
mean_std_norm, bool (optional)\n\
  Performs mean and standard-deviation normalization (whitening)\n\
  of the input data before training the (resulting) Machine.\n\
  Setting this to ``True`` is recommended for large data sets with\n\
  significant amplitude variations between dimensions.\n\
\n\
other, CGLogRegTrainer\n\
  If you decide to copy construct from another object of the same\n\
  type, pass it using this parameter.\n\
\n\
References:\n\
\n\
1. A comparison of numerical optimizers for logistic regression,\n\
   T. Minka, (`See Microsoft Research paper\n\
    <http://research.microsoft.com/en-us/um/people/minka/papers/logreg/>`_)\n\
2. FoCal, http://www.dsp.sun.ac.za/~nbrummer/focal/\n\
\n\
");

static int PyBobLearnLinearCGLogRegTrainer_init_parameters
(PyBobLearnLinearCGLogRegTrainerObject* self, PyObject* args, PyObject* kwds) {

  /* Parses input arguments in a single shot */<commit_msg>Fix docstring<commit_after>/**
 * @author <NAME> <<EMAIL>>
 * @date Thu 16 Jan 2014 14:27:40 CET
 *
 * @brief Python bindings to CGLogReg trainer
 *
 * Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
 */

#define XBOB_LEARN_LINEAR_MODULE
#include <xbob.blitz/cppapi.h>
#include <xbob.blitz/cleanup.h>
#include <xbob.learn.linear/api.h>
#include <structmember.h>

/************************************************
 * Implementation of CGLogRegTrainer base class *
 ************************************************/

PyDoc_STRVAR(s_logregtrainer_str, XBOB_EXT_MODULE_PREFIX ".CGLogRegTrainer");

PyDoc_STRVAR(s_logregtrainer_doc,
"CGLogRegTrainer([prior=0.5, [convergence_threshold=1e-5,\n\
                 [max_iterations=10000, [lambda=0.,\n\
                 [mean_std_norm=False]]]]]) -> new CGLogRegTrainer\n\
\n\
CGLogRegTrainer(other) -> new CGLogRegTrainer\n\
\n\
Trains a linear machine to perform Linear Logistic Regression.\n\
\n\
There are two initializers for objects of this class. In the\n\
first variant, the user passes the discrete training parameters,\n\
including the classes prior, convergence threshold and the\n\
maximum number of conjugate gradient (CG) iterations among\n\
other parameters. The second initialization form copy constructs\n\
a new trainer from an existing one.\n\
\n\
The training stage will place the resulting weights (and bias)\n\
in a linear machine with a single output dimension. If the\n\
parameter ``mean_std_norm`` is set to ``True``, then your input\n\
data will be mean/standard-deviation normalized and the\n\
according values will be set as normalization factors to the\n\
resulting machine.\n\
\n\
Keyword parameters:\n\
\n\
prior, float (optional)\n\
  The synthetic prior (should be in range :math:`]0.,1.[`).\n\
\n\
convergence_threshold, float (optional)\n\
  The convergence threshold for the conjugate gradient algorithm\n\
\n\
max_iterations, int (optional)\n\
  The maximum number of iterations for the conjugate gradient\n\
  algorithm\n\
\n\
lambda, float (optional)\n\
  The regularization factor lambda. If you set this to the value of\n\
  ``0.0`` (the default), then the algorithm will apply **no**\n\
  regularization whatsoever.\n\
\n\
mean_std_norm, bool (optional)\n\
  Performs mean and standard-deviation normalization (whitening)\n\
  of the input data before training the (resulting) Machine.\n\
  Setting this to ``True`` is recommended for large data sets with\n\
  significant amplitude variations between dimensions.\n\
\n\
other, CGLogRegTrainer\n\
  If you decide to copy construct from another object of the same\n\
  type, pass it using this parameter.\n\
\n\
References:\n\
\n\
1. A comparison of numerical optimizers for logistic regression,\n\
   <NAME>, (`See Microsoft Research paper\n\
   <http://research.microsoft.com/en-us/um/people/minka/papers/logreg/>`_)\n\
2. FoCal, http://www.dsp.sun.ac.za/~nbrummer/focal/\n\
\n\
");

static int PyBobLearnLinearCGLogRegTrainer_init_parameters
(PyBobLearnLinearCGLogRegTrainerObject* self, PyObject* args, PyObject* kwds) {

  /* Parses input arguments in a single shot */
{'fraction_non_alphanumeric': 0.14007347069158282, 'fraction_numerical': 0.011499760421657882, 'mean_word_length': 4.153909465020576, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3194480', 'n_tokens_mistral': 2066, 'n_tokens_neox': 1950, 'n_words': 660}