class_docstr: Method from Chen et al., 2018 performing poisoning detection based on activations clustering.
  
  | Paper link: https://arxiv.org/abs/1811.03728
  
  | Please keep in mind the limitations of defences. For more information on the limitations of this
      defence, see https://arxiv.org/abs/1905.13409 . For details on how to evaluate classifier security
      in general, see https://arxiv.org/abs/1902.06705
docstr: This function analyzes the clusters according to the provided method.
  
  :param kwargs: A dictionary of cluster-analysis-specific parameters.
  :return: (report, assigned_clean_by_class), where the report is a dict object and assigned_clean_by_class
           is a list of arrays that contains what data points where classified as clean.
docstr_tok: ["This","function","analyzes","the","clusters","according","to","the","provided","method",".",":","param","kwargs",":","A","dictionary","of","cluster-analysis-specific","parameters",".",":","return",":","(","report",",","assigned_clean_by_class",")",",","where","the","report","is","a","dict","object","and","assigned_clean_by_class","is","a","list","of","arrays","that","contains","what","data","points","where","classified","as","clean","."]
code: def analyze_clusters(
      self, **kwargs
  ) -> Tuple[Dict[str, Any], np.ndarray]:
      """
      This function analyzes the clusters according to the provided method.
  
      :param kwargs: A dictionary of cluster-analysis-specific parameters.
      :return: (report, assigned_clean_by_class), where the report is a dict object and assigned_clean_by_class
               is a list of arrays that contains what data points where classified as clean.
      """
      self.set_params(**kwargs)
  
      if not self.clusters_by_class:
          self.cluster_activations()
  
      analyzer = ClusteringAnalyzer()
      if self.cluster_analysis == "smaller":
          (
              self.assigned_clean_by_class,
              self.poisonous_clusters,
              report,
          ) = analyzer.analyze_by_size(self.clusters_by_class)
      elif self.cluster_analysis == "relative-size":
          (
              self.assigned_clean_by_class,
              self.poisonous_clusters,
              report,
          ) = analyzer.analyze_by_relative_size(self.clusters_by_class)
      elif self.cluster_analysis == "distance":
          (
              self.assigned_clean_by_class,
              self.poisonous_clusters,
              report,
          ) = analyzer.analyze_by_distance(
              self.clusters_by_class,
              separated_activations=self.red_activations_by_class,
          )
      elif self.cluster_analysis == "silhouette-scores":
          (
              self.assigned_clean_by_class,
              self.poisonous_clusters,
              report,
          ) = analyzer.analyze_by_silhouette_score(
              self.clusters_by_class,
              reduced_activations_by_class=self.red_activations_by_class,
          )
      else:
          raise ValueError(
              "Unsupported cluster analysis technique "
              + self.cluster_analysis
          )
  
      # Add to the report current parameters used to run the defence and the analysis summary
      report = dict(
          list(report.items()) + list(self.get_params().items())
      )
  
      return report, self.assigned_clean_by_class
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import os
  import pickle
  import time
  from typing import Any, Dict, List, Optional, Tuple, TYPE_CHECKING
  import numpy
  from sklearn.cluster import KMeans, MiniBatchKMeans
  from art import config
  from art.data_generators import DataGenerator
  from art.defences.detector.poison.clustering_analyzer import ClusteringAnalyzer
  from art.defences.detector.poison.ground_truth_evaluator import GroundTruthEvaluator
  from art.defences.detector.poison.poison_filtering_defence import PoisonFilteringDefence
  from art.utils import segment_by_class
  from art.visualization import create_sprite, save_image, plot_3d
label_desc: Use image node_id 5 for calling the ActivationDefence obj's underlying member method code with example usage: obj.analyze_clusters() and returns: report,  self