Skip to content

[MRG] Changed code example for FAQ#7820

Closed
sillystring13 wants to merge 1 commit intoscikit-learn:masterfrom
sillystring13:sillystring13-patch-1
Closed

[MRG] Changed code example for FAQ#7820
sillystring13 wants to merge 1 commit intoscikit-learn:masterfrom
sillystring13:sillystring13-patch-1

Conversation

@sillystring13
Copy link
Copy Markdown

Reference Issue

Related to: #7669

What does this implement/fix? Explain your changes.

Problem:
The doc/faq example "How do I deal with string data (or trees, graphs...)?" has a chunk of code that doesn't work if you increase the number of samples.

Fix:
The code example needs the parameter 'algorithm=brute' for the the custom distance metric with data indexing to work correctly. Otherwise, for larger datasets the default 'algorithm=auto' will choose an incompatible algorithm which breaks the custom data indexing.

Any other comments?

Here's a notebook with code demonstrating the issue:
https://github.com/sillystring13/cuddly-barnacle/blob/master/Example%20-%20Sklearn%20FAQ%20code%20test.ipynb

The code example needs the parameter 'algorithm=brute' for the the custom distance metric with data indexing to work correctly.  Otherwise, for larger datasets the default 'algorithm=auto' will choose an incompatible algorithm which breaks the custom data indexing.  

notebook with code demonstrating the issue:
https://github.com/sillystring13/cuddly-barnacle/blob/master/Example%20-%20Sklearn%20FAQ%20code%20test.ipynb
@jnothman
Copy link
Copy Markdown
Member

jnothman commented Nov 4, 2016

Please add an explanation that without 'brute', the algorithm may assume that the distance is a function of a real-valued (continuous) feature space.

[1],
[2]])
>>> dbscan(X, metric=lev_metric, eps=5, min_samples=2) # doctest: +SKIP
>>> dbscan(X, metric=lev_metric, eps=5, min_samples=2, algorithm='brute') # doctest: +SKIP
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split into two lines. Max length 79

@amueller
Copy link
Copy Markdown
Member

fixed in #11884

@amueller amueller closed this Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants