From edcc94d073bedf0c25cdc353a9ee21ab3657410a Mon Sep 17 00:00:00 2001 From: Masajiro Iwasaki Date: Fri, 6 Jan 2023 13:40:02 +0900 Subject: [PATCH] fix uninitialized parameters --- VERSION | 2 +- lib/NGT/Clustering.h | 11 ++++++----- lib/NGT/NGTQ/QuantizedBlobGraph.h | 4 ++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 815e68d..09843e3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.8 +2.0.9 diff --git a/lib/NGT/Clustering.h b/lib/NGT/Clustering.h index 9f435b0..491db17 100644 --- a/lib/NGT/Clustering.h +++ b/lib/NGT/Clustering.h @@ -954,8 +954,9 @@ namespace NGT { break; } default: - std::cerr << "proper initMode is not specified." << std::endl; - exit(1); + std::stringstream msg; + msg << " kmeans: invalid initialization mode. " << initializationMode; + NGTThrowException(msg); } } } @@ -990,9 +991,9 @@ namespace NGT { break; #endif default: - cerr << "kmeans::fatal error!. invalid clustering type. " << clusteringType << endl; - abort(); - break; + std::stringstream msg; + msg << " kmeans: invalid clustering type. " << clusteringType; + NGTThrowException(msg); } } diff --git a/lib/NGT/NGTQ/QuantizedBlobGraph.h b/lib/NGT/NGTQ/QuantizedBlobGraph.h index 913eea1..c5c1a54 100644 --- a/lib/NGT/NGTQ/QuantizedBlobGraph.h +++ b/lib/NGT/NGTQ/QuantizedBlobGraph.h @@ -59,6 +59,7 @@ namespace QBG { creation.localIndexType = NGT::Property::GraphAndTree; creation.localInsertionRadiusCoefficient = 1.1; creation.localGraphType = NGT::NeighborhoodGraph::GraphTypeANNG; + hierarchicalClustering.maxSize = 1000; hierarchicalClustering.numOfObjects = 0; hierarchicalClustering.numOfClusters = 2; @@ -75,6 +76,8 @@ namespace QBG { hierarchicalClustering.extractCentroid = false; hierarchicalClustering.threeLayerClustering = true; + optimization.clusteringType = NGT::Clustering::ClusteringTypeKmeansWithoutNGT; + optimization.initMode = NGT::Clustering::InitializationModeHead; optimization.timelimit = 24 * 1 * 60.0 * 60.0; optimization.iteration = 100; optimization.clusterIteration = 100; @@ -92,6 +95,7 @@ namespace QBG { optimization.rotation = true; optimization.globalType = QBG::Optimizer::GlobalTypeNone; optimization.randomizedObjectExtraction = true; + optimization.showClusterInfo = false; } void setProperties(NGTQ::Property &property, NGT::Property &globalProperty,