Skip to content

[MRG+2] convert to boolean arrays for boolean distances (ex: jaccard) - #6932

Merged
lesteve merged 5 commits into
scikit-learn:masterfrom
TomDLT:jaccard
Jun 29, 2016
Merged

lesteve merged 5 commits into
scikit-learn:masterfrom
TomDLT:jaccard

Conversation

@TomDLT

@TomDLT TomDLT commented Jun 23, 2016 •

Copy link
Copy Markdown
Member

Exact copy of #5460 after git-fu failure.

Closes #4523.

@TomDLT TomDLT added this to the 0.18 milestone Jun 23, 2016


def check_pairwise_arrays(X, Y, precomputed=False):
def check_pairwise_arrays(X, Y, precomputed=False, dtype=None):

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.

no docstring update?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

@TomDLT

TomDLT commented Jun 24, 2016

Copy link
Copy Markdown
Member Author

Appveyor's failure is unrelated

True if X is to be treated as precomputed distances to the samples in
Y.

dtype : string, type, list of types or None (default=None)

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.

Maybe dtype, list of dtypes rather than type, list of types.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I took it from check_array, and I tend to prefer it this way.
I feel what you suggest is somehow a recursive definition, and I don't really know if it's less confusing.

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.

OK fair enough.

For the record, when I hear "type" I am thinking "Python type" so it does sound slightly weird.


# Test converts list to array-like
S = func([[1]], metric='precomputed')
S = func([[1.]], metric='precomputed')

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.

Just out of curiosity, was this change necessary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If I remember correctly, it's removing a warning in the tests

@lesteve

lesteve commented Jun 29, 2016

Copy link
Copy Markdown
Member

LGTM, I'll wait for the CI statuses and merge this one.

# Non-regression test for #4523
# 'brute': uses scipy.spatial.distance through pairwise_distances
# 'ball_tree': uses sklearn.neighbors.dist_metrics
X = np.random.uniform(size=(6, 5))

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.

Should we use a np.random.RandomState here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure

@lesteve

lesteve commented Jun 29, 2016 •

Copy link
Copy Markdown
Member

For the record, looks like the CircleCI is due do some temporary glitch with matplotlib.finance.fetch_historical_yahoo which hit:

HTTPError: HTTP Error 502: Server Hangup

@lesteve

lesteve commented Jun 29, 2016

Copy link
Copy Markdown
Member

So the AppVeyor build is green on the penultimate commit, I'll merge this one since the last commit is just cosmetics.

@lesteve
lesteve merged commit 3f37cb9 into scikit-learn:master Jun 29, 2016
@lesteve

lesteve commented Jun 29, 2016

Copy link
Copy Markdown
Member

Merged, thanks!

@lesteve lesteve mentioned this pull request Jun 29, 2016
@TomDLT

TomDLT commented Jun 29, 2016

Copy link
Copy Markdown
Member Author

Thanks for the review !

@TomDLT
TomDLT deleted the jaccard branch June 29, 2016 16:17
@amueller

Copy link
Copy Markdown
Member

awesome, thanks!

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.

4 participants