From bc4d0aa435aac78628fa7771dbf8333f1fe5a971 Mon Sep 17 00:00:00 2001 From: Ralph Gasser Date: Wed, 14 Aug 2024 15:28:53 +0200 Subject: [PATCH] PQ seed is now also used for KMeansClustering. --- .../org/vitrivr/cottontail/dbms/index/pq/PQIndexConfig.kt | 5 ++--- .../dbms/index/pq/quantizer/MultiStageQuantizer.kt | 2 +- .../dbms/index/pq/quantizer/SingleStageQuantizer.kt | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/index/pq/PQIndexConfig.kt b/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/index/pq/PQIndexConfig.kt index 190a79ce1..e850f9fe1 100644 --- a/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/index/pq/PQIndexConfig.kt +++ b/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/index/pq/PQIndexConfig.kt @@ -12,14 +12,13 @@ import java.io.ByteArrayInputStream /** * Configuration class for [PQIndex]. * - * @author Gabriel Zihlmann & Ralph Gasser + * @author Gabriel Zihlmann + * @author Ralph Gasser * @version 1.3.0 */ data class PQIndexConfig(val distance: Name.FunctionName, val numCentroids: Int, val subspaces: Int, val seed: Int = System.currentTimeMillis().toInt()) : IndexConfig { companion object { - - /** The maximum number of subspaces. We cap this at 32 to limit the code length. */ private const val MAXIMUM_NUMBER_OF_SUBSPACES = 32 diff --git a/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/index/pq/quantizer/MultiStageQuantizer.kt b/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/index/pq/quantizer/MultiStageQuantizer.kt index 5fcb435c2..fbc9a9cc6 100644 --- a/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/index/pq/quantizer/MultiStageQuantizer.kt +++ b/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/index/pq/quantizer/MultiStageQuantizer.kt @@ -41,7 +41,7 @@ data class MultiStageQuantizer(val coarse: PQCodebook, val fine: Array) { /* Prepare k-means clusterer. */ val reshape = distance.copy(dimensionsPerSubspace) - val random = SplittableRandom(System.currentTimeMillis()) + val random = SplittableRandom(config.seed.toLong()) val clusterer = KMeansClusterer(config.numCentroids, reshape.type, random) /* Prepare codebooks. */