Skip to content
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

Implement the code in C with the same functionality #7

Open
Behrouz-Babaki opened this issue Mar 27, 2017 · 1 comment
Open

Implement the code in C with the same functionality #7

Behrouz-Babaki opened this issue Mar 27, 2017 · 1 comment
Assignees

Comments

@Behrouz-Babaki
Copy link
Owner

Functions closest_cluster and compute_centers might take a lot of time to run. Also the loop of assigning instances to clusters can incur some computational cost.

We should profile the code on a relatively large dataset (e.g. the digits dataset) and identify the critical parts. Then we have to implement those parts in C. To avoid extra dependencies, we are going to use ctypes.

Using C imposes a limit on the available data structures. We need to implement the sorting algorithm ourselves. But for keeping track of constraints while assigning nodes to clusters, it is enough to have k boolean arrays that indicate what instances can not be added to a cluster. This array is updated after assignment of each instance to a cluster.

@Behrouz-Babaki
Copy link
Owner Author

Instead of ctypes, we will use Cython. The advantage is that conversion from python to C can be done incrementally. Unlike ctypes, a rich set of containers are at our disposal. It also provides functionalities for easy installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant