Skip to content

Cannot set k = 1 for Kmediods  #68

Description

@justin5927

Cannot set k = 1 for Kmediods

clustering.py line 134 and line 905 has tmp = np.partition(d, 1)

creates traceback (shown below)

File "/opt/conda/envs/frostbite_introspection/lib/python3.9/site-packages/gam/clustering.py", line 329, in fit
centers, members, _, _, _ = self.kmedoids_run_split(
File "/opt/conda/envs/frostbite_introspection/lib/python3.9/site-packages/gam/clustering.py", line 429, in kmedoids_run_split
centers = _swap_pam(X, init_ids, dist_func, max_iter, tol, verbose)
File "/opt/conda/envs/frostbite_introspection/lib/python3.9/site-packages/gam/clustering.py", line 134, in _swap_pam
tmp = np.partition(d, 1)
File "<array_function internals>", line 180, in partition
File "/opt/conda/envs/frostbite_introspection/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 758, in partition
a.partition(kth, axis=axis, kind=kind, order=order)
ValueError: kth(=1) out of bounds (1)

If statement is needed to deal with k=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions