--- title: metric_for_TP_FP_samples datasets: - tags: - evaluate - metric description: This metric is specially designed to measure the performance of sentence classification models over multiclass test datasets containing both True Positive samples, meaning that the label associated to the sentence in the sample is correctly assigned, and False Positive samples, meaning that the label associated to the sentence in the sample is incorrectly assigned. sdk: gradio sdk_version: 3.0.2 app_file: app.py pinned: false --- # Metric Card for metric_for_TP_FP_samples ## Metric Description This metric is specially designed to measure the performance of sentence classification models over multiclass test datasets containing both True Positive samples, meaning that the label associated to the sentence in the sample is correctly assigned, and False Positive samples, meaning that the label associated to the sentence in the sample is incorrectly assigned. ## How to Use In addition to the conventional *predictions* and *references* inputs, this metric includes a *kwarg* named *prediction_strategies (list(str))*, that refer to a family of prediction strategies that the metric can handle. The *prediction_strategies* implemented in this metric are: - *argmax*, which takes the highest value of the softmax inference logits to select the prediction. - *threshold*, which takes all softmax inference logits above a certain value to select the predictions. - *topk*, which takes the highest *k* softmax inference logits to select the predictions. The minimum fields required by this metric for the test datasets are the following: - *title* containing the first sentence to be compared with different queries representing each class. - *label_ids* containing the *id* of the class the sample refers to. Including samples of all the classes is advised. - *nli_label* which is '0' if the sample represents a True Positive or '2' if the sample represents a False Positive, meaning that the *label_ids* is incorrectly assigned to the *title*. Including both True Positive and False Positive samples for all classes is advised. Example: |title |label_ids |nli_label | |-----------------------------------------------------------------------------------|:---------:|:----------:| |'Together we can save the arctic': celebrity advocacy and the Rio Earth Summit 2012| 8 | 0 | |Tuple-based semantic and structural mapping for a sustainable interoperability | 16 | 2 | ### Inputs - *predictions*, *(numpy.array(float32)[sentences to classify,number of classes])*: numpy array with the softmax logits values of the entailment dimension of the inference on the sentences to be classified for each class. - *references* , *(numpy.array(int32)[sentences to classify,2]: numpy array with the reference *label_ids* and *nli_label* of the sentences to be classified, given in the *test_dataset*. - A *kwarg* named *prediction_strategies*, (list(str))*.f prediction strategies which must be included within the options lists for the parameter *prediction_strategy_selector* in the [options.py](https://huggingface.co/spaces/gorkaartola/Zero_Shot_Classifier_by_SDGs/blob/main/options.py) file. ### Output Values *Explain what this metric outputs and provide an example of what the metric output looks like. Modules should return a dictionary with one or multiple key-value pairs, e.g. {"bleu" : 6.02}* *State the range of possible values that the metric's output can take, as well as what in that range is considered good. For example: "This metric can take on any value between 0 and 100, inclusive. Higher scores are better."* #### Values from Popular Papers *Give examples, preferrably with links to leaderboards or publications, to papers that have reported this metric, along with the values they have reported.* ### Examples *Give code examples of the metric being used. Try to include examples that clear up any potential ambiguity left from the metric description above. If possible, provide a range of examples that show both typical and atypical results, as well as examples where a variety of input parameters are passed.* ## Limitations and Bias *Note any known limitations or biases that the metric has, with links and references if possible.* ## Citation *Cite the source where this metric was introduced.* ## Further References *Add any useful further references.*