Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI4Finance Foundation FinGPT vote output

From Leeroopedia
Knowledge Sources
Domains NLP, Evaluation, Ensemble_Methods
Last Updated 2026-10-18 00:00 GMT

Overview

Concrete tool for ensembling sentiment predictions across multiple prompt templates via majority voting provided by the FinGPT Benchmark FPB module.

Description

The vote_output function implements template ensemble voting for the multi-template sentiment evaluation variants (`test_fpb_mlt`, `test_fiqa_mlt`). For each input, the model is prompted with multiple sentiment instruction templates (from `sentiment_templates.txt`), producing one prediction per template. `vote_output` normalizes each prediction via `change_target`, counts votes for positive/negative/neutral, and returns the majority label (positive if positive > negative, negative if negative > positive, else neutral).

Usage

Import this function when you need to ensemble sentiment predictions across prompt templates:

  • Multi-template evaluation: Ensembling `_mlt` benchmark variants.
  • Prompt robustness: Reducing sensitivity to instruction phrasing.

Code Reference

Source Location

  • Repository: FinGPT
  • File: fingpt/FinGPT_Benchmark/benchmarks/fpb.py
  • Lines: L41-51

Signature

def vote_output(
    x: pd.Series,
) -> str

Import

from fpb import vote_output

I/O Contract

Inputs

Name Type Required Description
x pd.Series Yes Row with out_text_0, out_text_1, ... columns (one per template)

Outputs

Name Type Description
return value str Majority-voted sentiment: 'positive', 'negative', or 'neutral'

Usage Examples

Ensemble Voting

from fpb import vote_output

# Row with predictions from 5 templates
row = pd.Series({
    'out_text_0': 'positive',
    'out_text_1': 'positive',
    'out_text_2': 'neutral',
    'out_text_3': 'positive',
    'out_text_4': 'negative',
})
result = vote_output(row)
# 'positive' (3 positive > 1 negative)

Related Pages

Implements Principle

Uses Heuristic

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment