Commit Graph

89 Commits

Author SHA1 Message Date
seales 0485ada58b General spelling fixes 2015-12-16 09:46:42 -08:00
TomDLT 9f136ff293 ENH add multinomial SAG solver for LogisticRegression 2015-12-04 18:36:37 +01:00
CJ Carey 219fe1045c BUG: use pre-parsed scipy version
This avoids a failure when using a development install of scipy.
2015-11-05 14:19:34 -06:00
Andreas Mueller bac5e3942f Merge pull request #5626 from ogrisel/fix-osx-logistic-class-weights
[MRG+1] FIX increase tolerance of class weight check for OS X
2015-11-01 17:47:27 -05:00
TomDLT a4f125b552 FIX decrease tolerance in test_logistic for appveyor failure 2015-10-30 18:17:33 +01:00
Olivier Grisel 105326d840 FIX increase tolerance of class weight check for OS X 2015-10-30 16:52:35 +01:00
Raghav R V 3f8743f47b Main Commits - Major
--------------------

* ENH Reogranize classes/fn from grid_search into search.py
* ENH Reogranize classes/fn from cross_validation into split.py
* ENH Reogranize cls/fn from cross_validation/learning_curve into validate.py

* MAINT Merge _check_cv into check_cv inside the model_selection module
* MAINT Update all the imports to point to the model_selection module
* FIX use iter_cv to iterate throught the new style/old style cv objs
* TST Add tests for the new model_selection members
* ENH Wrap the old-style cv obj/iterables instead of using iter_cv

* ENH Use scipy's binomial coefficient function comb for calucation of nCk
* ENH Few enhancements to the split module
* ENH Improve check_cv input validation and docstring
* MAINT _get_test_folds(X, y, labels) --> _get_test_folds(labels)
* TST if 1d arrays for X introduce any errors
* ENH use 1d X arrays for all tests;
* ENH X_10 --> X (global var)

Minor
-----

* ENH _PartitionIterator --> _BaseCrossValidator;
* ENH CVIterator --> CVIterableWrapper
* TST Import the old SKF locally
* FIX/TST Clean up the split module's tests.
* DOC Improve documentation of the cv parameter
* COSMIT consistently hyphenate cross-validation/cross-validator
* TST Calculate n_samples from X
* COSMIT Use separate lines for each import.
* COSMIT cross_validation_generator --> cross_validator

Commits merged manually
-----------------------

* FIX Document the random_state attribute in RandomSearchCV
* MAINT Use check_cv instead of _check_cv
* ENH refactor OVO decision function, use it in SVC for sklearn-like
  decision_function shape
* FIX avoid memory cost when sampling from large parameter grids

ENH Major to Minor incremental enhancements to the model_selection

Squashed commit messages - (For reference)

Major
-----

* ENH p --> n_labels
* FIX *ShuffleSplit: all float/invalid type errors at init and int error at split
* FIX make PredefinedSplit accept test_folds in constructor; Cleanup docstrings
* ENH+TST KFold: make rng to be generated at every split call for reproducibility
* FIX/MAINT KFold: make shuffle a public attr
* FIX Make CVIterableWrapper private.
* FIX reuse len_cv instead of recalculating it
* FIX Prevent adding *SearchCV estimators from the old grid_search module
* re-FIX In all_estimators: the sorting to use only the 1st item (name)
    To avoid collision between the old and the new GridSearch classes.
* FIX test_validate.py: Use 2D X (1D X is being detected as a single sample)
* MAINT validate.py --> validation.py
* MAINT make the submodules private
* MAINT Support old cv/gs/lc until 0.19
* FIX/MAINT n_splits --> get_n_splits
* FIX/TST test_logistic.py/test_ovr_multinomial_iris:
    pass predefined folds as an iterable
* MAINT expose BaseCrossValidator
* Update the model_selection module with changes from master
  - From #5161
  -  - MAINT remove redundant p variable
  -  - Add check for sparse prediction in cross_val_predict
  - From #5201 - DOC improve random_state param doc
  - From #5190 - LabelKFold and test
  - From #4583 - LabelShuffleSplit and tests
  - From #5300 - shuffle the `labels` not the `indxs` in LabelKFold + tests
  - From #5378 - Make the GridSearchCV docs more accurate.
  - From #5458 - Remove shuffle from LabelKFold
  - From #5466(#4270) - Gaussian Process by Jan Metzen
  - From #4826 - Move custom error / warnings into sklearn.exception

Minor
-----

* ENH Make the KFold shuffling test stronger
* FIX/DOC Use the higher level model_selection module as ref
* DOC in check_cv "y : array-like, optional"
* DOC a supervised learning problem --> supervised learning problems
* DOC cross-validators --> cross-validation strategies
* DOC Correct Olivier Grisel's name ;)
* MINOR/FIX cv_indices --> kfold
* FIX/DOC Align the 'See also' section of the new KFold, LeaveOneOut
* TST/FIX imports on separate lines
* FIX use __class__ instead of classmethod
* TST/FIX import directly from model_selection
* COSMIT Relocate the random_state documentation
* COSMIT remove pass
* MAINT Remove deprecation warnings from old tests
* FIX correct import at test_split
* FIX/MAINT Move P_sparse, X, y defns to top; rm unused W_sparse, X_sparse
* FIX random state to avoid doctest failure
* TST n_splits and split wrapping of _CVIterableWrapper
* FIX/MAINT Use multilabel indicator matrix directly
* TST/DOC clarify why we conflate classes 0 and 1
* DOC add comment that this was taken from BaseEstimator
* FIX use of labels is not needed in stratified k fold
* Fix cross_validation reference
* Fix the labels param doc

FIX/DOC/MAINT Addressing the review comments by Arnaud and Andy

COSMIT Sort the members alphabetically
COSMIT len_cv --> n_splits
COSMIT Merge 2 if; FIX Use kwargs
DOC Add my name to the authors :D
DOC make labels parameter consistent
FIX Remove hack for boolean indices; + COSMIT idx --> indices; DOC Add Returns
COSMIT preds --> predictions
DOC Add Returns and neatly arrange X, y, labels
FIX idx(s)/ind(s)--> indice(s)
COSMIT Merge if and else to elif
COSMIT n --> n_samples
COSMIT Use bincount only once
COSMIT cls --> class_i / class_i (ith class indices) -->
perm_indices_class_i

FIX/ENH/TST Addressing the final reviews

COSMIT c --> count
FIX/TST make check_cv raise ValueError for string cv value
TST nested cv (gs inside cross_val_score) works for diff cvs
FIX/ENH Raise ValueError when labels is None for label based cvs;
TST if labels is being passed correctly to the cv and that the
ValueError is being propagated to the cross_val_score/predict and grid
search
FIX pass labels to cross_val_score
FIX use make_classification
DOC Add Returns; COSMIT Remove scaffolding
TST add a test to check the _build_repr helper
REVERT the old GS/RS should also be tested by the common tests.
ENH Add a tuple of all/label based CVS
FIX raise VE even at get_n_splits if labels is None
FIX Fabian's comments
PEP8
2015-10-23 17:28:08 +02:00
MechCoder 41cbfded7c Add check for sample_weights 2015-10-23 00:06:07 -04:00
MechCoder 80e22b3ddf Patch liblinear for sample_weights in LogisticRegression(and CV) 2015-10-23 00:00:31 -04:00
TomDLT d439dc4d9e FIX class_weight in LogisticRegression and LogisticRegressionCV 2015-10-21 17:41:39 +02:00
Raghav R V e3afc0e8c9 MAINT move custom error/warning classes into sklearn.exceptions
ENH NonBLASDotWarning -> EfficiencyWarning; Improve error message
DOC Add exceptions module to modules/classes.rst
MAINT Move ConvergenceWarning, UndefinedMetricWarning et al into exceptions
MAINT Remove ChangedBehaviorWarning from base
DOC/FIX Improve DataConversionWarning's docstring
2015-10-19 22:35:35 +02:00
vstolbunov ebd5dbc68a Fixed syntax and combined two test functions 2015-09-15 12:40:08 -04:00
vstolbunov 942ff5c654 Updated logistic regression tests with sag solver 2015-09-15 12:40:08 -04:00
Valentin Stolbunov 1a15fdc4f5 Added handling of sample weights in logistic.py
* Updated _check_solver_option to include sample_weight check
* Updated all calls to _check_solver_option()
* Updated documentation of class_weight throughout logistic.py
* Added sample_weight parameter to logistic_regression_path.
* Added handling of sample weights to logistic_regression_path.
* Added sample_weight parameter to _log_reg_scoring_path.
* Added handling of sample weights to _log_reg_scoring_path.
* Added sample_weight parameter to fit() in the LogisticRegression class.
* Added handling of sample sample weights in LogisticRegression.fit()
* Added sample_weight parameter to fit() in the LogisticRegressionCV class.
* Added handling of sample weights in LogisticRegressionCV.fit()
* Added test_logistic_regressioncv_sample_weights, which:
  * tests that a ValueError is raised if liblinear is used with
    sample weights
  * tests that passing sample weights as np.ones(y.shape[0]) is
    the same as not passing them (default None)
  * tests that using both lbfgs and newton-cg solvers with
    sample weights yields the same results
  * tests that passing class weights to scale one class is the
    same as passing sample weights for the training data of just
    that class
* Fixed bug with *= in logistic_regression_path.
* Fixed bug in test_logistic_regressioncv_sample_weights where
  no data was created prior to fitting.
* Changes to accepted sample_weight type.
* Fixed bug in naming of sample_weight when passed from
  _log_reg_scoring_path to logistic_regression_path.
* Fixed issue of sample_weight=None being converted to np.array()
  and then not being reconigzed as None.
* Added tests for LogisticRegression
* Attempting to fix same issue as 9d3becf by instead implementing
  if statement in bagging.py.
* Added TODO to eliminate check for liblinear w/ sample weights
  in bagging.py
2015-09-15 12:40:08 -04:00
TomDLT 94eb61960a ENH add sag solver in LogisticRegression and Ridge 2015-09-10 13:28:02 -04:00
MechCoder c85f2ad596 Add non regression test 2015-08-30 11:44:58 -04:00
MechCoder c3cfebe4d6 [BUG] predict_proba should use the softmax function in the multinomial case 2015-08-28 17:06:20 -04:00
MechCoder 1886f2bc43 [MRG] [BUG] Pass penaly to the final logistic regression fit 2015-06-24 13:18:25 +05:30
Andreas Mueller eedc1cddab Use more natural class_weight="auto" heuristic 2015-06-01 12:49:53 -04:00
TomDLT fc9d7befe1 FIX use random_state in LogisticRegression 2015-05-27 16:59:12 +02:00
TomDLT 355dc7c8f1 ENH improve parameter check in LogisticRegression 2015-05-27 10:16:36 +02:00
TomDLT 922d71aafe FIX check parameter in LogisticRegression 2015-05-21 13:04:47 +02:00
TomDLT c51f067652 ENH change func_grad_hess into grad_hess
FIX correct testing

FIX xrange to range for python 3
2015-05-19 16:21:12 +02:00
Raghav R V cd2ee7e454 MAINT docstring --> comments to prevent nose from using doc in verbose mode 2015-03-21 11:16:49 +05:30
Vinayak Mehta a4f8f083a5 Specified original intercept_scaling value 2015-03-19 20:27:11 +05:30
Vinayak Mehta 5f44a8e2a3 Raising an error when intercept_scaling is zero
Added test for intercept_scaling

Fixed silly mistake

Added assert_raise_message

added test for logistic regression

removed None

added more tests
2015-03-17 23:23:39 +05:30
Andreas Mueller f1b8283c95 catch some warnings, be less verbose in testing. 2015-03-02 14:40:35 -05:00
Alexandre Gramfort 6744be298a Merge pull request #3646 from s8wu/multinomial_newtoncg
[MRG+2] Multinomial newtoncg
2014-10-16 09:04:18 +02:00
swu 862d82111e Modified hessp function in _multinomial_loss_grad_hess to compute r_yhat
in place.
Simplied conditional statements that branches based on solver +
multi_class input combinations.
Extended tests on multinomial LogisticRegression to include newton-cg
solver case.
Updated doc string of LogisticRegression to include newton-cg solver in
multinomial case.
2014-09-20 15:11:31 -04:00
MechCoder 74857521ac FIX: Make sure LogRegCV with solver=liblinear works with sparse matrices 2014-09-18 19:00:19 +02:00
swu af4df3345f Adding test cases for multinomial LogisticRegression using newton-cg
solver.
2014-09-13 22:02:25 -04:00
MechCoder 891839cd8d DOC: Explain prediction when decision_function is zero
LogisticRegression and liblinear's predictions differ when the
decision function is zero. Explain why and what to do in that case.

Fixes #3600 (by documenting the won't fix status).
2014-09-05 13:46:44 +02:00
MechCoder a7ccbb8096 MAINT: Made the following changes
1. Use a single loop for both ovr and multinomial conditions
2. Better warning messages for penalty and loss conditions
3. Convergence warnings print only if verbose > 0
4. Used check_X_y instead of check_X
2014-08-30 12:26:40 +02:00
MechCoder a92cd805af FIX: PEP8 Errors and unused imports 2014-08-21 17:37:38 +02:00
MechCoder d80ef50b11 DOC: Improved documentation and error messages 2014-08-21 17:37:38 +02:00
MechCoder 89226b69b4 COSMIT: Made the following changes
1. Removed true from 'true multinomial loss'
2. Replaced OvA with OvR
3. Update whatsnew.rst
2014-08-21 17:37:38 +02:00
MechCoder b2e0e6e982 TST: Tests for multinomial logistic regression 2014-08-21 17:37:38 +02:00
MechCoder 4cd177758f ENH: Merge MultinomialLR into LR with multi_class='multinomial' 2014-08-21 17:37:37 +02:00
MechCoder d5ceb89ed5 ENH: Add support for class weights 2014-08-21 17:37:37 +02:00
Lars Buitinck 13ca2b2859 ENH multinomial logistic regression using L-BFGS 2014-08-21 17:37:37 +02:00
MechCoder ad5773cfca TST: Added test to check ConvergenceWarning 2014-08-01 12:15:57 +02:00
Olivier Grisel 11d396542c FIX numerically unstable test_logistic.py 2014-07-25 00:21:42 +02:00
MechCoder 2374a09246 FIX: Increase testing accuracy 2014-07-23 16:04:30 +02:00
MechCoder 4de4849e8a FIX: Fixes for the cross_validation failure 2014-07-23 13:24:41 +02:00
MechCoder 2ea804e61f Update whats new! 2014-07-22 18:29:51 +02:00
MechCoder 67585f6e6f MAINT: Improve documentation and coverage 2014-07-22 17:28:16 +02:00
MechCoder c8540df986 FIX: Add DataConversionWarning 2014-07-22 16:57:41 +02:00
MechCoder 86dab1ea86 ENH: Added warnings for convergence, added support for l1 penalty if solver is liblinear 2014-07-22 16:57:41 +02:00
MechCoder 10a411fe66 ENH: Logistic Regression now supports newton-cg and lbfgs 2014-07-22 16:57:41 +02:00
MechCoder 7b3bfefaa0 Made the following changes
1. Fixed random state
2. Object dtype support
3. Remove outdated "don't test multiclass" tests
2014-07-22 16:57:41 +02:00