Skip to content

add visualization of k means clustering as excel format #2104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 19, 2020

Conversation

beqakd
Copy link
Contributor

@beqakd beqakd commented Jun 12, 2020

Describe your change:

Add nice feature to convert Dataframe with clustering number in it to excel style format. It is easily readable and also has a lot of features in it to navigate through data.(like mean, mean_with_zero, median, max, min and etc.)

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.

@TravisBuddy
Copy link

Hey @beqakd,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 9d0eb2c0-acac-11ea-8245-836d9da6cb4c

@TravisBuddy
Copy link

Hey @beqakd,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 640c3620-acc8-11ea-8245-836d9da6cb4c

@TravisBuddy
Copy link

Hey @beqakd,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: e4967240-ace3-11ea-8245-836d9da6cb4c

@beqakd
Copy link
Contributor Author

beqakd commented Jun 12, 2020

Error is not from my PR. Style changes fixed.

@@ -202,3 +204,127 @@ def kmeans(
verbose=True,
)
plot_heterogeneity(heterogeneity, k)


def ReportGenerator(df, ClusteringVariables, FillMissingReport=None):
Copy link
Member

@cclauss cclauss Jun 17, 2020

Choose a reason for hiding this comment

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

Type hints? Doctests? Function and variable names need to be snake_case -- See CONTRIBUTING.md.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typehints okey. but i cant write doctests. It returns pandas dataframe can you suggest me some ideas how i can do it? We can test manually to be sure that it works

Copy link
Member

Choose a reason for hiding this comment

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

Is it impossible to examine various elements of a dataframe to ensure that those elements contain expected values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its not but i wont be able to check all of them, but i will do good testing with different approaches. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Just a few sanity checks will be good enough for our purposes. Thx.

"""
Function generates easy-erading clustering report. It takes 2 arguments as an input:
DataFrame - dataframe with predicted cluester column;
FillMissingReport - dcitionary of rules how we are going to fill missing
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
FillMissingReport - dcitionary of rules how we are going to fill missing
FillMissingReport - dictionary of rules how we are going to fill missing

@TravisBuddy
Copy link

Hey @beqakd,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: ccec7b60-b21c-11ea-b4e4-a33918451e6b

@TravisBuddy
Copy link

Hey @beqakd,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: ba40dc30-b21d-11ea-b4e4-a33918451e6b

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Thanks for your work here!

@cclauss cclauss merged commit d034add into TheAlgorithms:master Jun 19, 2020
@beqakd
Copy link
Contributor Author

beqakd commented Jun 19, 2020

Thanks for your work here!

Thanks a lot!

stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
…s#2104)

* add visualization of kmneas clust as excel format

* style changes

* style changes

* Add doctest and typehint!

* style change

* Update machine_learning/k_means_clust.py

Co-authored-by: Christian Clauss <[email protected]>

* Update machine_learning/k_means_clust.py

Co-authored-by: Christian Clauss <[email protected]>

Co-authored-by: Christian Clauss <[email protected]>
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