Skip to content

Commit 1dca20c

Browse files
Alexsandrussnapetrov
authored andcommitted
Explicit passing of gamma paramater for kmeans (#1091)
1 parent 0c096ef commit 1dca20c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

daal4py/sklearn/cluster/_k_means_0_22.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,25 @@ def is_string(s, target_str):
104104

105105
def _daal4py_kmeans_compatibility(nClusters, maxIterations, fptype="double",
106106
method="lloydDense", accuracyThreshold=0.0,
107-
resultsToEvaluate="computeCentroids"):
107+
resultsToEvaluate="computeCentroids", gamma=1.0):
108108
kmeans_algo = None
109109
if daal_check_version(((2020, 'P', 2), (2021, 'B', 107))):
110110
kmeans_algo = daal4py.kmeans(nClusters=nClusters,
111111
maxIterations=maxIterations,
112112
fptype=fptype,
113113
resultsToEvaluate=resultsToEvaluate,
114114
accuracyThreshold=accuracyThreshold,
115-
method=method)
115+
method=method,
116+
gamma=gamma)
116117
else:
117118
assigFlag = 'computeAssignments' in resultsToEvaluate
118119
kmeans_algo = daal4py.kmeans(nClusters=nClusters,
119120
maxIterations=maxIterations,
120121
fptype=fptype,
121122
assignFlag=assigFlag,
122123
accuracyThreshold=accuracyThreshold,
123-
method=method)
124+
method=method,
125+
gamma=gamma)
124126
return kmeans_algo
125127

126128

daal4py/sklearn/cluster/_k_means_0_23.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,15 @@ def is_string(s, target_str):
139139

140140
def _daal4py_kmeans_compatibility(nClusters, maxIterations, fptype="double",
141141
method="lloydDense", accuracyThreshold=0.0,
142-
resultsToEvaluate="computeCentroids"):
142+
resultsToEvaluate="computeCentroids", gamma=1.0):
143143
kmeans_algo = daal4py.kmeans(
144144
nClusters=nClusters,
145145
maxIterations=maxIterations,
146146
fptype=fptype,
147147
resultsToEvaluate=resultsToEvaluate,
148148
accuracyThreshold=accuracyThreshold,
149149
method=method,
150+
gamma=gamma
150151
)
151152
return kmeans_algo
152153

0 commit comments

Comments
 (0)