craigtrim / opensearch-helper

OpenSearch Helper for Easy I/O
2 stars 0 forks source link

Compute Confidence using Max Score #5

Open craigtrim opened 1 year ago

craigtrim commented 1 year ago

The response object has a max score.

The confidence of each result can be computed by dividing it into the max score.

craigtrim commented 1 year ago

For example, consider this JSON output from OpenSearch:

{
   "took":3,
   "timed_out":false,
   "_shards":{
      "total":1,
      "successful":1,
      "skipped":0,
      "failed":0
   },
   "hits":{
      "total":{
         "value":4,
         "relation":"eq"
      },
      "max_score":8.828966,
      "hits":[
         {
            "_index":"trends_summaries",
            "_id":"jdvoGoYBwVxr156y_CZk",
            "_score":8.828966,
            "_source":{
               "id":10913,
               "page":3,
               "name":"NOURISH_TRENDREPORT2023",
               "url":"https://iceberg-data-slack.s3.us-west-1.amazonaws.com/book/NOURISH_TRENDREPORT2023/page/CH00-PG003.jpg",
               "text":"Climate change now registers with all our senses, including taste. Farmers are on the frontline of climate change and its effects can't be overlooked even by consumers. In one Saturday edition of The Globe & Mail newspaper, 11 articles or ads related to climate change were present. In a New York Times Sunday paper, there were nine articles according to a recent Leger Poll. 56% of Canadians and 45% of Americans believe they have personally experienced the effects of climate change where they live. The tastes of some crops, such as wine grapes and potatoes, are changing due to taint from forest fire smoke, extreme temperatures, and water conditions. While climate change concerns have grown, there is still the \"intention versus action\" gap. Consumers want to do the right thing, but often it requires sacrifice in terms of cost, taste or requiring too much change. It's up to government and industry to move the agenda ahead and nudge consumers into the future.",
               "text_type":"full_text"
            }
         },
         {
            "_index":"trends_summaries",
            "_id":"6NvoGoYBwVxr156y_CJj",
            "_score":6.765611,
            "_source":{
               "id":9980,
               "page":29,
               "name":"MINDTREE_TECHTRENDS_IN_GLOBAL_CAPITAL",
               "url":"https://iceberg-data-slack.s3.us-west-1.amazonaws.com/book/MINDTREE_TECHTRENDS_IN_GLOBAL_CAPITAL/page/CH00-PG029.jpg",
               "text":"Trend 10 Distributed Ledger Technology (DLT) provides safe and secure flow of assets, money and value across markets and regions. It has high resilience with quick and reliable validation, no single point of failure, increased transparency with auditability and open accessibility and efficient reconciliations. Shortened distributed ledger technology presents an ambitious opportunity to re-define and upgrade market risk and margin requirements, significantly reducing settlement times and freeing up capital. This gives the opportunity to address age-old operational issues for the efficient allocation of saved capital. Distributed ledger technology (DLT) has proven its potential to disrupt payment, clearing, settlement, issuance, and custody services. Thus, this gives rise to an industry-wide exploration of the benefits of technology in dealing with data multiplicity and duplicity across capital markets, resulting in instant solutions for reconciliation and transaction disputes such as reference data management and settlement cycles. One of the key benefits of bonds and security issuances, tokenization, custody introduction of DLT in settlement space is microshortening of the settlement cycle. This is helpful in payments, liquidity pool generation, clearing and settlements, nettings, collateral management, etc. Implementation of distributed ledger technology (DLT) will speed up transaction clearing and settlement to almost real-time levels, minimizing manual and recon-related bottlenecks, decreasing risk-weighted assets, and achieving capital efficiency for parties. On the other hand, DLT can significantly simplify capital markets post-trade processes. Advanced stages of operations and back-office processes will be optimized, reducing manual intervention significantly. However, the implementation of experiments and proof of concepts of DLT usage in clearing and settlement has produced mixed results. The barriers to adoption of DLTs in the settlement space range from lack of standardization, regulation, scalability solutions, reconciliation and matching errors. These need to be addressed before large-scale adoption can be realized and its benefits can be enjoyed.",
               "text_type":"full_text"
            }
         },
         {
            "_index":"trends_summaries",
            "_id":"advoGoYBwVxr156y_Ati",
            "_score":4.07501,
            "_source":{
               "id":3965,
               "page":33,
               "name":"CITI_GPS_DISRUPTIVE_INNOVATIONS",
               "url":"https://iceberg-data-slack.s3.us-west-1.amazonaws.com/book/CITI_GPS_DISRUPTIVE_INNOVATIONS/page/CH00-PG033.jpg",
               "text":"In December 2022, Citi GPS: Global Perspectives & Solutions will distribute collective risk and rewards based on programmatically executed rules. It infuses transparency by ensuring that all transactions in a DAO occur on-chain, making them trackable and observable. The community can review spending, funding allocations, and fulfillment of plans. Figure 19 shows prominent real-world use cases of DAOs protocol: philanthropy DAOs focused on governance of decentralized protocols, such as borrow/lending applications and decentralized exchanges, and community-driven projects. For examples, the Big Green DAO focuses on food justice and gardening initiatives. Prominent protocol DAOs include MakerDAO, Uniswap and Yearn Finance. Investment/Venture DAOs fund innovative new DeFi projects based on applications, chain investments, and other DeFi projects. Start-ups receive help from DAOs, which democratize and decentralize investment processes. Donations to the grant pool are popular based, and projects receive funding based on collective votes. Examples of such DAOs include MetaCartel Ventures and BitDAO. Aave Collector DAOs aim to support ownership of art and NFTs. Metaverse DAOs can operate autonomously, creating content. ArtsDAO represents the largest NFT community in a new ecosystem built around tokens. Metaverse could be the Middle East, composed of investors, artists, creators, governed by a DAO. Members will vote on proposals that affect the metaverse's future. Social DAOs Foster communities and personal connections by bringing like-minded people together and coordinating activities via tokens. Many crossovers from Collector DAOs to Social Entertainment DAOs, Gaming DAOs, and Operating System DAOs such as Board Ape Yacht Club. Source: 101 Blockchains, Alchemy Blog, Ledger Academy, Citi GPS DAOs. Critics view the shareholder model of capitalism as providing less power to creators, users and employees while maximizing value for shareholders. While this form of capitalism may lead to growth, it can also cause inequality, social and economic instability, and corruption. DAOs provide small investors and contributors with access to the content and a voice in decisions. DAOs can help unlock access to private investment opportunities previously available only to wealthy investors. What are they best suited to building and operating? DAOs enable more individuals to collectively work for themselves, as styles of employment and structures change: This includes portfolio careers, digital nomad lifestyle and virtual corporations, accelerated by high-speed internet and the work-from-home model that was turbocharged by COVID-19.",
               "text_type":"full_text"
            }
         },
         {
            "_index":"trends_summaries",
            "_id":"69voGoYBwVxr156y_CJj",
            "_score":3.7193546,
            "_source":{
               "id":9983,
               "page":30,
               "name":"MINDTREE_TECHTRENDS_IN_GLOBAL_CAPITAL",
               "url":"https://iceberg-data-slack.s3.us-west-1.amazonaws.com/book/MINDTREE_TECHTRENDS_IN_GLOBAL_CAPITAL/page/CH00-PG030.jpg",
               "text":"Confirm the democratization of contracts: Granting access to data and confirming trades can be time-consuming. Providing this information for all parties involved would have a beneficial outcome. Current issuers should implement these changes. It involves scanning key trade attributes on an agreed template for diversifying sources of funding. End-investors would benefit from transparency and exchanging, acknowledging market-based pricing and portfolio diversification. It involves complex linkages between trading, legal, documentation, communication and micro-services enhanced financial accessibility exchange interfaces that would benefit SMEs and small investors. If DLTs promise of trust and transparency is implemented on a common ledger then intermediaries for financial services can be bypassed. This will significantly reduce costs (due to reduced data entry duplication and reconciliation errors), strengthen resilience, reduce operational risk, and enable efficient and reliable management of the data flow between clearinghouses, security exchanges, brokers, clearing members, custodians, prime brokers, investors, market makers, asset managers, dealer/brokers, corporate and retail banks, transfer agents, and liquidity providers. In brief, DLT addresses key problems through use of decentralized ledger technology. This can offer the following opportunities: resolving issues of trust between trading parties, market participants and service providers who often have divergent or competing business interests. Thus, establishing trust amongst them though desirable is inherently antagonistic. As an independent node, they can have equal access to data, so they can collaborate to achieve the bare minimum trust to sign confirmation agreements. The same can be achieved with an efficient consensus. Digitize and automate the existing manual protocol, strengthening trust because each party is aware that no single party can temper or alter the data: confirmations, issuances, settlements, payments, tokenization of liquid and illiquid assets. Unequal access to data: In the security and Clearing asset ecosystem, there is a lack of a single 'golden source' of master and reference data. Clearing and settlement of derivatives involves numerous manual processes and cumbersome tasks. Sharing interest on PAI (price Blockchain allowing controlled, common, and secure data alignment), maintaining audit and sharing access to ownership records, and arranging cross-system data pool margin obligations. With the advent of UMR regulations, clearing and risk management of OTC derivatives has become costly due to collateral, reconciliations, verification, valuation, capital, and regulatory requirements. DLT processes, operational risks and reduced transaction movement can be addressed with tokenization and smart contracts. Near real-time settlement and confirmation could be achieved more efficiently with DLT, leading to financial cost benefits. Programmable codes, known as 'smart contracts', could optimize pricing and margin calculations for market participants. Finally, streamline or automate manual and routine payments with DLT to carry out seamless cross-border transactions, sub-transactions and regulatory reporting in a fast, reliable and cost-effective manner.",
               "text_type":"full_text"
            }
         }
      ]
   }
}

The path to hits/max_score can be used to compute a confidence for each result.

craigtrim commented 1 year ago

This still isn't perfect because the max score is relative.

To be a better system, we need some way of demonstrating the result with the maximum score is valid and viable. If both are valid and viable, then the max score can be used objectively. Otherwise, the outcome of this algorithm is meaningless for decision-making.