datumaro.plugins.sampler.algorithm.entropy#

Classes

SampleEntropy(data, inference)

Entropy is a class that inherits an Sampler, calculates an uncertainty score based on an entropy, and get samples based on that score.

class datumaro.plugins.sampler.algorithm.entropy.SampleEntropy(data, inference)[source]#

Bases: InferenceResultAnalyzer

Entropy is a class that inherits an Sampler, calculates an uncertainty score based on an entropy, and get samples based on that score.

Constructor function

Parameters:
  • data – Receive the data format in pd.DataFrame format. ImageID is an essential element for data.

  • inference – Receive the inference format in the form of pd.DataFrame. ImageID and ClassProbability are essential for inferences.

get_sample(method: str, k: int, n: int = 3) DataFrame[source]#

A function that extracts sample data and returns it.

Parameters:
  • method

    • ‘topk’ - It extracts the k sample data with the highest uncertainty.

    • ’lowk’ - It extracts the k sample data with the lowest uncertainty.

    • ’randomk’ - Extract and return random k sample data.

  • k – number of sample data

  • n – Parameters to be used in the randtopk method, Variable to first extract data of multiple n of k.

Returns:

pd.DataFrame

Return type:

Extracted sample data