이 예에서는 Jina, PyTorch 및 Hugging Face 변환기를 사용하여 프로덕션 준비가 완료된 BERT 기반 금융 질문 응답 시스템을 구축합니다. 우리는 먼저 상위 50개 후보 답변을 검색한 다음, 최첨단 결과를 달성한 FiQA 데이터 세트에서 미세 조정된 BERT 기반 모델인 FinBERT-QA를 사용하여 후보 답변의 순위를 다시 매기는 방식으로 구절 재순위 접근 방식을 적용했습니다.
? 단계별 가이드와 자세한 설명은 이 튜토리얼을 참조하세요.
대규모 비정형 및 정형 데이터의 자동 분석에 대한 금융 업계의 새로운 수요에 힘입어 QA 시스템은 금융 자문가의 의사 결정을 촉진함으로써 기업에 수익성과 경쟁 우위를 제공할 수 있습니다. 우리 시스템의 목표는 질문에 대한 관련 답변 구절 목록을 검색하는 것입니다. 다음은 FiQA 데이터 세트의 질문과 정답 답변의 예입니다.
https://github.com/yuanbit/jina-financial-qa-search.git
jina-financial-qa-search/
작업 디렉토리로 사용하겠습니다.
pip install -r requirements.txt
bash get_data.sh
우리는 FiQA 데이터세트 dataset/test_answers.csv
에서 답변 구절의 하위 집합을 색인화하려고 합니다.
398960 From http://financial-dictionary.thefreedictionary.com/Business+Fundamentals The facts that affect a company's underlying value. Examples of business fundamentals include debt, cash flow, supply of and demand for the company's products, and so forth. For instance, if a company does not have a sufficient supply of products, it will fail. Likewise, demand for the product must remain at a certain level in order for it to be successful. Strong business fundamentals are considered essential for long-term success and stability. See also: Value Investing, Fundamental Analysis. For a stock the basic fundamentals are the second column of numbers you see on the google finance summary page, P/E ratio, div/yeild, EPS, shares, beta. For the company itself it's generally the stuff on the 'financials' link (e.g. things in the quarterly and annual report, debt, liabilities, assets, earnings, profit etc.
19183 If your sole proprietorship losses exceed all other sources of taxable income, then you have what's called a Net Operating Loss (NOL). You will have the option to "carry back" and amend a return you filed in the last 2 years where you owed tax, or you can "carry forward" the losses and decrease your taxes in a future year, up to 20 years in the future. For more information see the IRS links for NOL. Note: it's important to make sure you file the NOL correctly so I'd advise speaking with an accountant. (Especially if the loss is greater than the cost of the accountant...)
327002 To be deductible, a business expense must be both ordinary and necessary. An ordinary expense is one that is common and accepted in your trade or business. A necessary expense is one that is helpful and appropriate for your trade or business. An expense does not have to be indispensable to be considered necessary. (IRS, Deducting Business Expenses) It seems to me you'd have a hard time convincing an auditor that this is the case. Since business don't commonly own cars for the sole purpose of housing $25 computers, you'd have trouble with the "ordinary" test. And since there are lots of other ways to house a computer other than a car, "necessary" seems problematic also.
전체 데이터 세트로 색인을 생성하도록 answer_collection.tsv
의 경로를 변경할 수 있습니다.
python app.py index
마지막에는 다음이 표시됩니다.
✅ done in ⏱ 1 minute and 54 seconds ? 7.7/s
gateway@18904[S]:terminated
doc_indexer@18903[I]:recv ControlRequest from ctl▸doc_indexer▸⚐
doc_indexer@18903[I]:Terminating loop requested by terminate signal RequestLoopEnd()
doc_indexer@18903[I]:#sent: 56 #recv: 56 sent_size: 1.7 MB recv_size: 1.7 MB
doc_indexer@18903[I]:request loop ended, tearing down ...
doc_indexer@18903[I]:indexer size: 865 physical size: 3.1 MB
doc_indexer@18903[S]:artifacts of this executor (vecidx) is persisted to ./workspace/doc_compound_indexer-0/vecidx.bin
doc_indexer@18903[I]:indexer size: 865 physical size: 3.2 MB
doc_indexer@18903[S]:artifacts of this executor (docidx) is persisted to ./workspace/doc_compound_indexer-0/docidx.bin
상위 50개 후보 답변의 순위를 다시 지정하려면 사용자 지정 실행자를 구축해야 합니다. Jina Hub API를 사용하면 이 작업을 수행할 수 있습니다. Jina Hub 확장이 설치되어 있는지 확인해 보겠습니다.
pip install "jina[hub]"
다음을 실행하여 맞춤형 랭커인 FinBertQARanker
구축할 수 있습니다.
jina hub build FinBertQARanker/ --pull --test-uses --timeout-ready 60000
이제 다음을 실행하여 Financial QA 검색 엔진을 사용할 수 있습니다.
python app.py search
Ranker는 BERT 기반 모델을 사용하기 때문에 관련성 점수를 계산하는 데 시간이 걸릴 수 있습니다. FiQA 데이터 세트에서 다음 질문 목록을 시험해 볼 수 있습니다.
• What does it mean that stocks are “memoryless”?
• What would a stock be worth if dividends did not exist?
• What are the risks of Dividend-yielding stocks?
• Why do financial institutions charge so much to convert currency?
• Is there a candlestick pattern that guarantees any kind of future profit?
• 15 year mortgage vs 30 year paid off in 15
• Why is it rational to pay out a dividend?
• Why do companies have a fiscal year different from the calendar year?
• What should I look at before investing in a start-up?
• Where do large corporations store their massive amounts of cash?
#JinaSearch
를 사용하여 소통하세요.Copyright (c) 2021 지나의 친구. 모든 권리 보유.