2.2.3. Classification

In Featurization, we provide examples on how to generate feature matrices from persistence diagrams. Here, we show how to perform classification using supervised machine learning algorithms.

teaspoon.ML.PD_Classification.getPercentScore(DgmsDF, labels_col='trainingLabel', dgm_col='Dgm1', params=<teaspoon.ML.Base.ParameterBucket object>, precomputed=False, saving=False, saving_path=None, **kwargs)[source]
  • DgmsDF (dataframe) – Data frame that includes persistence diagrams and labels. If user choose to performs transfer learning, DgmsDF_test should be given to algorithm. When transfer learning is performed, first diagram input is assumed as training set.

  • labels_col (str) – Name of the column that stores the labels for persistence diagrams in a Pandas dataframe. The default is ‘trainingLabel’.

  • dgm_col (str) – Name of the column that stores the persistence diagrams in a Pandas dataframe. The default is ‘Dgm1’.

  • params (parameterbucket object) – Parameter bucket object. The default is Base.ParameterBucket().

  • precomputed (boolean, optional) – If user already computed the persitence landscapes, this should be set to True, otherwise algorithm will spend time on computing these. This option is only valid when persistence landscapes are used as featurization methods. If this parameter is True, algorithm treat ‘DgmsDF’ as persistence landscapes. The default is False.

  • saving (boolean, optional) – If user wants to save classification results, this should be set to True and saving_path needs to be provided. The default is False.

  • saving_path (str, optional) – The path where user wants to save the results. This should be provided when saving is True. The default is None.

  • **kwargs – Additional parameters. When user wants to apply transfer learning, the second set of persistence diagrams and their labels should be passed in a dataframe format.


  • c_report_train (dict) – Classification report for training set results.

  • c_report_test (dict) – Classification report for test set results.

Please see following subsections for classification examples of each featurization approach.