Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython_plus_experiments
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Julien Jerphanion
cython_plus_experiments
Commits
6bd854ca
Commit
6bd854ca
authored
Apr 06, 2021
by
Julien Jerphanion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt front-end
parent
a041ca77
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
kmeans/kmeans.py
kmeans/kmeans.py
+11
-6
No files found.
kmeans/kmeans.py
View file @
6bd854ca
import
numpy
as
np
from
threadpoolctl
import
threadpool_limits
from
kmeans._kmeans
import
lloyd_iter_chunked_dense
,
_inertia_dense
def
_kmeans_single_lloyd
(
X
,
sample_weight
,
centers_init
,
max_iter
=
300
,
verbose
=
False
,
x_squared_norms
=
None
,
tol
=
1e-4
,
n_threads
=
1
):
...
...
@@ -49,10 +55,9 @@ def _kmeans_single_lloyd(X, sample_weight, centers_init, max_iter=300,
weight_in_clusters
=
np
.
zeros
(
n_clusters
,
dtype
=
X
.
dtype
)
center_shift
=
np
.
zeros
(
n_clusters
,
dtype
=
X
.
dtype
)
if
sp
.
issparse
(
X
):
lloyd_iter
=
lloyd_iter_chunked_sparse
_inertia
=
_inertia_sparse
else
:
# NOTE: We only rely on dense array for those analysis
if
sample_weight
is
None
:
sample_weight
=
np
.
ones
((
X
.
shape
[
0
],),
dtype
=
X
.
dtype
)
lloyd_iter
=
lloyd_iter_chunked_dense
_inertia
=
_inertia_dense
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment