@@ -81,7 +81,7 @@ def cluster_weights(to_cluster,
81
81
clustering_params = {
82
82
'number_of_clusters': 8,
83
83
'cluster_centroids_init':
84
- cluster_config. CentroidInitialization.DENSITY_BASED
84
+ CentroidInitialization.DENSITY_BASED
85
85
}
86
86
87
87
clustered_model = cluster_weights(original_model, **clustering_params)
@@ -93,7 +93,7 @@ def cluster_weights(to_cluster,
93
93
clustering_params = {
94
94
'number_of_clusters': 8,
95
95
'cluster_centroids_init':
96
- cluster_config. CentroidInitialization.DENSITY_BASED
96
+ CentroidInitialization.DENSITY_BASED
97
97
}
98
98
99
99
model = keras.Sequential([
@@ -108,17 +108,8 @@ def cluster_weights(to_cluster,
108
108
number_of_clusters: the number of cluster centroids to form when
109
109
clustering a layer/model. For example, if number_of_clusters=8 then only
110
110
8 unique values will be used in each weight array.
111
- cluster_centroids_init: enum value that determines how the cluster
112
- centroids will be initialized.
113
- Can have following values:
114
- 1. RANDOM : centroids are sampled using the uniform distribution
115
- between the minimum and maximum weight values in a given layer
116
- 2. DENSITY_BASED : density-based sampling. First, cumulative
117
- distribution function is built for weights, then y-axis is evenly
118
- spaced into number_of_clusters regions. After this the corresponding x
119
- values are obtained and used to initialize clusters centroids.
120
- 3. LINEAR : cluster centroids are evenly spaced between the minimum
121
- and maximum values of a given weight
111
+ cluster_centroids_init: `tfmot.clustering.keras.CentroidInitialization`
112
+ instance that determines how the cluster centroids will be initialized.
122
113
**kwargs: Additional keyword arguments to be passed to the keras layer.
123
114
Ignored when to_cluster is not a keras layer.
124
115
0 commit comments