Commit Graph

480 Commits

Author SHA1 Message Date
Hanmin Qin c1c20971e3 DOC Move datasets.mldata_filename to deprecated section in classes.rst 2019-01-25 11:27:02 +08:00
Christos Aridas d2a77d7e78 DOC Add an example of inductive clustering (#10852) 2019-01-17 22:16:22 +11:00
Thomas Fan a7b8b9e9e1 MAINT Removes total_seconds completely in benchmarks (#12969) 2019-01-13 16:41:28 +01:00
Nicolas Hug 55a98ab7e3 [MRG+1] Deprecated logistic_regression_path (#12821)
<!--
Thanks for contributing a pull request! Please ensure you have taken a look at
the contribution guidelines: https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md#pull-request-checklist
-->

#### Reference Issues/PRs
<!--
Example: Fixes #1234. See also #3456.
Please use keywords (e.g., Fixes) to create link to the issues or pull requests
you resolved, so that they will automatically be closed when your pull request
is merged. See https://github.com/blog/1506-closing-issues-via-pull-requests
-->

Closes #12798 

#### What does this implement/fix? Explain your changes.

This PR deprecates the use of `logistic_regression_path` and makes it private.

#### Any other comments?


<!--
Please be aware that we are a loose team of volunteers so patience is
necessary; assistance handling other issues is very welcome. We value
all user contributions, no matter how minor they are. If we are slow to
review, either the pull request needs some benchmarking, tinkering,
convincing, etc. or more likely the reviewers are simply busy. In either
case, we ask for your understanding during the review process.
For more information, see our FAQ on this topic:
http://scikit-learn.org/dev/faq.html#why-is-my-pull-request-not-getting-any-attention.

Thanks for contributing!
-->
2018-12-19 16:52:54 -05:00
Thomas Moreau d25da1be20 FIX make joblib utils private, and remove mentions of externals.joblib (#12345) 2018-11-20 10:53:52 +11:00
Andreas Mueller 54de1896f5 DOC (0.21) Make sure plot_tree docs are generated and fix link in whatsnew (#12533) 2018-11-07 10:25:57 +08:00
Shangwu Yao 65556317c9 FEA (0.21) multilabel confusion matrix (#11179) 2018-10-30 19:26:37 +08:00
Lisa Sarah Thomas dc883c7d9e ENH Corrected spelling of Harabasz score. (#12211) 2018-10-24 15:38:39 +08:00
Andreas Mueller 0f94f2962b
MNT simple deprecations and removals for 0.21 (#12238)
Part of #11992.
These were all the things that seemed pretty straight-forward. It's actually a bit bulky but should still be easy to review, hopefully.
2018-10-11 14:56:37 -04:00
Krishna Sangeeth 831c760ccf ENH (0.21) Add max_error to the existing set of metrics for regression (#12232) 2018-10-11 15:33:06 +08:00
Joel Nothman fc56da504d Deprecate fetch_mldata (#11466)
* API Deprecate fetch_mldata and update examples
* Use pytest's filterwarnings
* Rm unused import
* Remove broken doctest
* Refer user to openml URL
* DOC whatsnew tweak
2018-08-18 19:27:48 +03:00
janvanrijn ab82f5739f [MRG] Openml data loader (#11419) 2018-08-15 17:21:20 +10:00
Alexandre Boucaud b21f9b4f98 MNT Add sklearn show_versions() method (#11596) 2018-08-01 09:12:51 +10:00
Joris Van den Bossche f819704880 MAINT: Revert ChainedImputer (#11600) 2018-07-17 21:45:36 +02:00
Joel Nothman 14e7c328df Restructure access to vendored/site Joblib (#11471)
In order to fix #11408, this swaps `joblib` and `_joblib`. It however, allows users to access joblib's `Memory` or `Parallel` functionality without accessing `sklearn.externals._joblib` by importing `Memory`, `Parallel`, etc. into `sklearn.utils`.
2018-07-17 18:02:11 +02:00
Maniteja Nandana 726fa36f25 [MRG+1] MissingIndicator transformer (#8075)
MissingIndicator transformer for the missing values indicator mask.
see #6556 

#### What does this implement/fix? Explain your changes.
The current implementation returns a indicator mask for the missing values.

#### Any other comments?
It is a very initial attempt and currently no tests are present. Please do have a look and give suggestions on the design. Thanks !

- [X] Implementation
- [x] Documentation
- [x] Tests
2018-07-16 14:22:13 -05:00
Gael Varoquaux 7d745eeed3
OPTICS (#11547)
* OPTICS clustering algorithm

Equivalent results to DBSCAN, but allows execution on arbitrarily large datasets. After initial construction, allows multiple 'scans' to quickly extract DBSCAN clusters at variable epsilon distances

* Create plot_optics

Shows example usage of OPTICS to extract clustering structure

* pep8 fixes

Mainly issues in long lines, long comments

* fixed conditional to be pep8

* updated to match sklearn API

OPTICS object, with fit method. Documentation updates.
extract method

* removed extra files

* plotting example updated, small changes

new plot example that matches the updated API
updated n_cluster attribute with reruns of extract
removed scaling factor on first ‘fit’ run

* updated OPTICS.labels to OPTICS.labels_

should pass unit test now?

* additional labels_ changes

* added stability warning

Scales eps to give stable results from first input distance. Extraction
above scaled eps is not allowed; extraction below scaled eps but
greater than input distance prints stability warning but still will run
clustering extraction. All distances below initial input distance are
stable; no warning printed

* Noise fix; updated example plot

Fixed noise points from being initialized as type ‘core point’
Fixed initialization for first ‘fit’ call
Decoupled eps and eps_prime (deep copy)

Matched plot example to same random state as dbscan
Added second plot to show ‘extract’ usage

* Changed to match Sklearn API

eps is not modified in init; kwargs fix

* Forcing 2 parameters

Why do I have to do this?

* Conforming to API

Fit now returns self; test fix for unit test fail in ball tree (asarray
problem)

* Fixing plot example

labels to labels_

* Fixed issue with sparse matrices

* Another attempt at fixing the sparse matrix error

Temporary fix until balltree can be updated to deal with sparse
matrices.

* Better checking of sparse arrays

Using ‘check_array’

* General cleanup

Removed extraneous lines and comments (old commented out code has been
removed)

*  Added unit tests for extract function

Added the unit tests in test_optics for fit, extract, and declaration.
Should bring coverage to ~100%. Additionally, fixed a small bug that
cropped up in the extract function during testing.

* Attempting for near 100% coverage

Removed unused imports, added to get warning.

* Fixed error in unit tests

* Trimmed extraneous 'if-else' check

see title

* forcing to check for a warning.

Result should be 100% coverage

* Updates to doc strings

All public methods now have doc strings; forcing a rebuild of OPTICS so
that build tests pass (last round failed due to external module)

* Style / pep8 changes

99% pep8 now… line 138 isn’t, but reads better with the long variable
names

* Added Narrative Documentation

Includes general description, discussion of algorithm output, and
comparison with DBSCAN. References and implementation notes are included

* Vectorized nneighbors lookups

Following suggestion from jnothman for doing nneighbors queries enmass.
Added OPTICS to cluster init

* fixing init build error

* reverting init

* All code now vectorized

…at least all code that can be ;)

Some general pruning and cleanup as well

* Style changes

Now 100% pep8

* Changing parameter style

matching DBSCAN

* Extraction change; Authors update

—initialize all points as ‘not core’ (fixes bug when plotting at
epsPrime larger than eps)
—added Sean Freeman to authors list

* Changed eps scaling to 5x instead of 10x

10x scaling is too conservative…eps scaling at 5x is perfectly stable,
and much faster as well.

* Fixing unit test

Should be ‘None’ for this; initialization previously at 1 for ‘is_core’
was incorrect

* Actually fixing unit test

Null comparison doesn’t work, using size

* Making ordering_ and other attributes public

renamed core_samples to core_sample_indices_ (as in DBSCAN). Used
attribute naming conventions (trailing _ character), and made
ordering_, reachability_, and core_dists_ public.

* Updates for Documentation

includes attribute strings for now public attributes

* Pep8 cleanup

Minor pep8 and pyflakes fixes

* updating plot example to match new attribute name

* CamelCase fixes

conforming to sklearn API on CamelCase

* adding hierarchical extraction function

Added hierarchical extraction from #2043

#2043 is BSD licensed and hasn’t had any activity for 10 months, so
this seems pretty kosher; authors are cited in the code

* added hierarchical switch to extract

Additional style and documentation changes as well

* cluster order bug fix

ensured that ordered list is always same length as input data

* removed hierarchical cluster extraction

Code from FredrikAppelros is totally unable to handle noise— as
currently written every point is assigned to a cluster, except the
first point of that cluster. May include later as a third method

* initial import of automatic cluster extraction code

Adding the excellent (and working) automatic cluster extraction code
from Amy X. Zhang. Some minor formatting changes on import to conform
to pep8

* wrapper for 'auto' extraction

additional fixes to style (camelCase, etc.), comments; made all helper
functions private

* test and example updates

Much better example data to showcase ‘auto’ extraction. Unit tests now
test both extraction methods. Set ‘auto’ as default, as it doesn’t
require any parameters and gives a better result. Pruned references to
hierarchical clustering

* fixing unit coverage; pruning unused functions

probably could still get a better unit test for ‘auto’ clustering…

* Added 'filter' fuction

Allows density-based filtering. Useful for cases where only a
‘noise’/‘no noise’ classification is desired. Function does not require
fitting prior to running, although it can be run after a fit if desired

* Vectorizing auto_cluster

generalizes input to multiple dimensions as well…

* updated filter function

* fixing test error

setting minPts to < data size returns None (with error message)

* removing exception handling in favor of conditional check

* Updated unit tests

Coverage to 90%. PEP8 fixes

* Additional unit test

Now at 94%; auto extract method is very hard to test… this new unit
test adds a more robust dataset to trigger more branches for testing.
Some of the remaining conditionals are pretty rare … :-/

* Fix unit test bug / python 3 compat

None type comparison problem…

* Fixed annoying deprecation warning for 1d array in BallTree

PEP8 Fixes

* More PEP8 and remove print statements fromt est

* 70 to 80% faster, fixed distance metrics

Modified to remove extraneous sorts, nneighbors query, and reduced
pairwise distance calculations to the upper triangle of a distance
matrix (instead of the full matrix). It appears that in ‘full’ scans
(i.e., when epsilon is set to inf, or the width of the data set),
OPTICS now actually outperforms DBSCAN… also, should be easy to run
distance calculations in parallel now for large datasets, with proper
heuristics.

* Fixing unit test failure

* Exposed auto_cluster parameters as public

documentation and API update so that users can tweek the auto method

* Fixed def with missing ':'

* Fix bugs from api change...

make sure that arguments are being called correctly with the new
extract_auto() method

* pep8 / pyflakes changes

* Updated example / plot

Correctly generates figure with subplots for DBSCAN / OPTICS comparison

* Tuning plot example / pep8 change

* Bug fix for commit 0b4cbdd (enforce stable sort)

the returned index from “sp.argmin(setofobjects.reachability_[n_pr])”
assumes that entires are stably sorted by distance from query point
(i.e., that ties in the argmin return the closest point to the input
point).

Still overall faster compared to the pre 0b4cbdd version, since we’re
filtering processed points before sorting by distance… and also only
calculating distances for non-processed points, instead of all within
the epsilon query.

* Code review fixes (style)

Fixes coding style (test comments, camel case, author list, relative
imports, etc). Included a new unit test and .npy file to explicitly
test reachability distances (test coverage at 99%).

* fixing new unit test

can’t import reach_values.npy in current directory….just placed testing
values in script directly (~200 lines for 1500 testing values)

* refactored min_heap to c extension

reduced optics file by about 100 lines of code… new c extension for
speedup (needs further optimization…6-10X speedup still possible)

* minor fixes..

* small cython optimizations

* cython fixes

* Add foo.txt

* Remove foo.txt

* fix compilation error

* last optimizations cython/numpy

MinHeap is only called once…so it’s faster to do a simple linear scan
here. The np.argmin() function does *almost* the exact same thing, but
the custom quick scan function is needed for cases where reachability
distances are tied (and the next point is selected based on which of
the points tied in reachability are closest to the querying point).
OPTICS is now faster than DBSCAN for medium-to-large number of input
points, and has better worst case run time (eps=inf).

* fix pyflakes errors; change default eps value

* _

* API changes from agramfort

Removed ‘filter method’, changed print statements to exceptions and
warnings as needed, remove ‘processed’ flag and replaced with fit_check
method, changed array copies to parameters, updated unit tests, changed
inline documentation to match proper doc string formatting, made
private class private. Probably some other changes too…

* fixed core samples bug

* added fit_predict

conforming to scipy api

* updates to variable names; update plot

* refactor to remove balltree specific code

* major refactor

finished decoupling balltree; lots of changes

* fixed bugs; test all pass again

:-)

* fixed weird cython bug

…not at all sure why pairwise_distances doesn’t automatically return
np.float arrays. Makes no sense to me. I could understand cases in
which the metric call returns int’s (i.e., city block)… but why it
would return float.32 instead of float.64 seems super odd.

* major refactor

deleted extract and auto_extract methods; added optics function; added
extract_dbscan method; added extract_dbscan and extract_optics
functions; updated unit tests; renamed `eps` to `max_bounds`; flake8
corrections; added types: int —> labels, bool —> is_core, enforced X to
be ‘float’ (fixes cython type errors)

* Updated Documentation!

Updated plot with reachability plot, as well as documentation :)

* fix flake8 error

* added optics to cluster comparison

Don't like the figure since it doesn't use black for noise, but added OPTICS for consistency

* Updated comparison plot to transpose

...kinda kludgy fix for the transpose

* small fix

* flake8 error

* reverting transpose of cluster comparison (seperate PR #9739)

* fixes from agramfort's review

public/private changes, numpydocstring fixes, a few pep8 fixes that flake8 didn't flag for some reason...

* fix for error message

unit test should pass now

* force cluster_id's to start at 0

* Fix sp. error and flake8 warning(s)

* Updated documentation

responses to reviews

* Removed extraneous files

also fixed small typo

* fixing lgtm alert

* changes from jnothman

small fixes for docs, plots, and tests

* Fixes from jnothman's review

Reorded parameters, updated documentation, removed unneeded else statement, changes to varible names.

* Fixing flake8 error

* Removed neighbors / balltree inheritance

Also decouples n_jobs -- can set n_jobs for just the kneighbors lookup, while keeping pairwise lookups to single job

* Made nbrs private and moved initiation to fit()

also renamed core_dists to core_distances.

* fixed non-standard characters

* Response to TomDLT review

narrative changes to tests. Normalized reachability distances for significant_min parameter. Cleaned up plots; small changes to documentation with optics_.py

* Fixed labeling bug

also minor documentation updates

* update unit test

since labels are 0 indexed, max of labels is (1 - total number of clusters). We can't take len(set(clusters)) because of noise (will be 4, not 3).

* Simple fixes per jnothman

Fixed float division, condensed variable names to be shorter, renamed bools to True and False, removed un-needed code block. Still need to add tests for cluster tree extraction :-(

* Auto-cluster tests

coverage should be complete now; fixed minor bug; removed un-needed check.

* fixing test error

* removed python loop

also fixed documentation link

* Fixing test error

* Fix typo in unit test

entry was supposed to be '1.0' not '10'; the test is supposed to posit 3 clusters, 2 of which are too small and are merged. Old version posited 4 clusters, two of which were merged as intended, and two of which were discarded (cluster merging requires one of the clusters to be large enough to be an independent cluster; with 4 instead of three, this case did not happen for either of the first two clusters).

* documentation updates

* Post-merge doctest fix

merge conflict in clustering.rst in previous commit; this push updates the doctest values to current correct values, and resolves the conflict

* DBSCAN / OPTICS invariant test

Restructured documentation. Small unit test fixes. Added test to ensure clustering metrics between OPTICS dbscan_extract and DBSCAN are within 2% of each other.

* Update _auto_cluster docstring

renamed reachability_ordering --> ordering for consistency

* changes fro jnothman

changes unit tests to check for specific error message (instead of 'a' error); minor updates to documentation. This also fixes a bug in the extract_dbscan function whereby some core points were erroneously marked as periphery... this is fixed by reverting to a previous extraction code block that initalizes all points as core and then demotes noise and periphery points during the extract scan. Parameterized unit test.

* fix spelling error in tests

* contingency_matrix test

New invarient test between optics and dbscan

* small unit test updates per jnothman

* unit test typo fix

* extract dbscan updates

Vectorized extract dbscan function to see if would improve performance of periphery point labeling; it did not, but the function is vectorized. Changed unit test with min_samples=1 to min_samples=3, as at min_samples=1 the test isn't meaningful (no noise is possible, all points are marked core). Parameterized parity test. Changed parity test to assert ~5% or better mismatch, instead of 5 points (this is needed for larger clusters, as the starting point mismatch effect scales with cluster size).

* updated documentation comparing OPTICS/DBSCAN

* DOC: phrasing and whats_new

* MISC: small mem footprint in OPTICS
2018-07-16 13:10:42 +02:00
Joel Nothman 40d1f00c82 Merge branch 'master' into discrete 2018-07-10 09:46:03 +10:00
Andreas Mueller eec7649236 MAINT Complete 0.20 deprecations (#9570) 2018-06-24 23:06:26 +10:00
Sergey Feldman 93382cc41f Rename `MICEImputer` to `ChainedImputer` (#11314) 2018-06-22 10:01:39 +02:00
Joris Van den Bossche 007aa710bd FEA Refactor CategoricalEncoder into OneHotEncoder and OrdinalEncoder (#10523)
Deprecated some OneHotEncoder behaviour
2018-06-21 19:27:41 +10:00
Guillaume Lemaitre fa07fc2cb9
Update classes.rst 2018-06-04 15:33:54 +02:00
Hanmin Qin fd7c217410 Merge branch 'master' into discrete 2018-06-04 19:46:02 +08:00
Joel Nothman b225ceb4be DOC fix several references in what's new
This was done at the same time as Qin's clean up... but here are a few
extra changes.
2018-05-31 07:16:18 +10:00
Joel Nothman f737fe6af3
Merge branch 'master' into discrete 2018-05-30 12:56:45 +10:00
Joris Van den Bossche 0b6308c270 FEA Add ColumnTransformer for heterogeneous data (#9012) 2018-05-30 07:49:21 +10:00
Joel Nothman ef8d22af7c
ENH Add working_memory global config for chunked operations (#10280) 2018-05-25 12:04:05 +10:00
Luis Osa 680c36b475 [MRG+1] Add Davies-Bouldin index (#10827) 2018-05-18 13:52:48 +02:00
Hanmin Qin 18cdaa69c1 DOC Move lasso_stability_path to deprecated section 2018-05-09 23:08:26 +08:00
Sergey Feldman b97eda5d2a [MRG+2] FEA Basic version of MICE Imputation (#8478) 2018-04-16 18:18:29 +10:00
Hanmin Qin a887882099 DOC Move datasets.load_mlcomp to recently deprecated section
Resolve the Circle error. Sorry for the mess.
2018-03-22 17:17:00 +08:00
Hanmin Qin cffeeddae7 DOC Move datasets.load_mlcomp to recently deprecated section 2018-03-22 16:26:01 +08:00
Joel Nothman b43fce5a49 MNT Add sklearn.compose and move TransformedTargetRegressor to it (#10719) 2018-03-16 21:27:03 +08:00
Joel Nothman 26ecc42d73 DOC Remove Imputer from preprocessing 2018-02-25 06:39:13 +11:00
Chady Kamar 5c98de1a59 DOC: fix links to reference API in utilities.rst (#10683) 2018-02-24 19:42:44 +01:00
Artiem K 63a2f0a02b MAINT Rename GraphLasso to GraphicalLasso (#10078) 2018-02-20 11:59:52 +11:00
Kumar Ashutosh 71b29acbfb [MRG+2] Moves Imputation out of Preprocessing (#10483) 2018-02-15 06:47:06 +11:00
Joel Nothman 205275b5ad DOC Remove repeated function listing 2018-02-11 00:40:50 +11:00
Joel Nothman 840f632e8f DOC A glossary of concepts and API elements (#9517)
Skeleton for a glossary of concepts and API elements.

This responds to at least three issues:

* Many aspects of scikit-learn API for users and developers are known
  tacitly by core contributors (and the stack overflow crowd), but are
  not written down in a consistent place.
* What is written is in an ad-hoc narrative style which may be useful
  for introduction, but is difficult to refer to and to maintain.
* Parameters such as `n_jobs` and methods like `decision_function` are
  described repeatedly in documentation giving sometimes more sometimes
  less information. This glossary allows us to use "See :term:`the
  glossary <n_jobs>`." so that parameter descriptions in the
  API reference can remain brief (just as not every numpy operation
  needs to describe broadcasting).
2018-01-02 10:14:07 +01:00
Guillaume Lemaitre 4f710cdd08 FEA TransformedTargetRegressor (#9041)
Add a new meta-regressor which transforms y for training.
2017-12-14 09:31:03 +11:00
Kumar Ashutosh 87759c1924 FEA Add a new class RegressorChain similar to ClassifierChain (#9257) 2017-12-12 09:00:57 +11:00
Gaurav Dhingra 3a704b1ad3 [MRG+1] Contingency matrix doc (#10220)
* Update example to clarify difference with Confusion Matrix, added link to Confusion Matrix documentation

* fixed 80 character limit issue

* changed indentation for automated test

* fixed formatting

* fixed formatting

* fixed formatting

* address requested changes in Contingency Matrix docs

* basic formatting

* use less technical and correct definition of contingency matrix

* arrange in alphabetical order

* add 'advantages' and 'disadvantages' of contingency matrix

* use better 'str' labels for example

* address the language of documentation

* add `ref` in documentation

* add a better 'advantage'

* fix

* address review

* small change

* add full stop.
2017-12-07 19:37:57 -05:00
Hanmin Qin ef57c34919
Merge branch 'master' into discrete 2017-12-06 14:21:49 +08:00
Eric Chang 62e9bb8def Feature: Implement PowerTransformer (#10210) 2017-12-06 08:29:10 +11:00
Tom Dupré la Tour 0a91bce8ee Merge branch 'master' into discrete
Conflicts:
	doc/modules/preprocessing.rst
2017-11-23 13:53:24 +01:00
Joris Van den Bossche a2ebb8cfd2 ENH: new CategoricalEncoder class (#9151) 2017-11-21 20:03:41 +11:00
Vinit 4a5cea28d3 [MRG] Added base.is_classifier/is_regressor in docs (#10062) 2017-11-03 08:31:46 +11:00
Hanmin Qin 45d1dd2e99 DOC Add missing class (#9955) 2017-10-19 18:28:58 +11:00
Aman Dalmia 8daad062f1 [MRG+1] Adding support for balanced accuracy (#8066)
* add function computing balanced accuracy

* documentation for the balanced_accuracy_score

* apply common tests to balanced_accuracy_score

* constrained to binary classification problems only

* add balanced_accuracy_score for CLF test

* add scorer for balanced_accuracy

* reorder the place of importing balanced_accuracy_score to be consistent with others

* eliminate an accidentally added non-ascii character

* remove balanced_accuracy_score from METRICS_WITH_LABELS

* eliminate all non-ascii charaters in the doc of balanced_accuracy_score

* fix doctest for nonexistent scoring function

* fix documentation, clarify linkages to recall and auc

* FIX: added changes as per last review See #6752, fixes #6747

* FIX: fix typo

* FIX: remove flake8 errors

* DOC: merge fixes

* DOC: remove unwanted files

* DOC update what's new
2017-10-17 11:12:27 -04:00
Joel Nothman f05a95b103 [MRG] FIX Revert the addition of ndcg_score and dcg_score (#9932) 2017-10-17 09:34:25 +11:00