scikit-learn-contrib / scikit-learn-extra

scikit-learn contrib estimators
https://scikit-learn-extra.readthedocs.io
BSD 3-Clause "New" or "Revised" License
185 stars 42 forks source link

Support pre-assigned the centriods #136

Closed makcedward closed 2 years ago

makcedward commented 2 years ago

KMeans from sci-kit learn init parameters allows array. Does KMedoids also support it? I can submit pull requests for it

If an array is passed, it should be of shape (n_clusters, n_features) and gives the initial centers.

TimotheeMathieu commented 2 years ago

KMedoids does not support array in init for now, you are welcome to PR for it. Mainly you have to add the code in _initialize_medoids, add docstring and also add a test to verify that it works.

I'm looking forward to your PR.

makcedward commented 2 years ago

@TimotheeMathieu Can you advise how can I run test cases in local env

TimotheeMathieu commented 2 years ago

You have to make some pytest compatible tests (look at examples in the existing tests). Then, to run the tests locally, execute pytest while being in the sklearn-extra directory should run the tests, another possibility is to do the pull request directly and the tests will run automatically in the github checks.

makcedward commented 2 years ago

Here is the PR

PedroMTQ commented 1 year ago

I think this is not working atm: _check_init_args doesn't allow for array like structures: ValueError: init needs to be one of the following: ['random', 'heuristic', 'k-medoids++', 'build']

TimotheeMathieu commented 1 year ago

are you sure that you installed the github version ? This is not released yet, you have to install the git version of scikit-learn-extra for this to work.

PedroMTQ commented 1 year ago

You're right. It works after installing with pip install git+https://github.com/scikit-learn-contrib/scikit-learn-extra

rth commented 1 year ago

@TimotheeMathieu Do you have a PyPI account ? I should add you as a maintainer there, so you can publish a new release if needed.

TimotheeMathieu commented 1 year ago

Yes, my account is TMathieu. Although, I am not sure what is the future of this project as there does not seem to be anyone else contributing, but I can do a release.

rth commented 1 year ago

I sent you the PyPI invite, thanks for your work @TimotheeMathieu !

Well, there are a few PRs and ~300 repos that depend on this package so there is some interest. Sorry myself I stepped down from scikit-learn maintenance including this repo to move to other projects. But if you have a chance you should talk with people at the scikit-learn foundation, to see how to best move forward, particularly since most people involved are at INRIA in France also. I'll follow up on this by email.