Skip to content

Commit 05f9904

Browse files
2023-01-31-finclf_bert_broker_sentiment_analysis_en (#13446)
* Add model 2023-01-31-finclf_bert_broker_sentiment_analysis_en * Update 2023-01-31-finclf_bert_broker_sentiment_analysis_en.md * Update 2023-01-31-finclf_bert_broker_sentiment_analysis_en.md --------- Co-authored-by: gadde5300 <gadde5300@gmail.com> Co-authored-by: GADDE SAI SHAILESH <69344247+gadde5300@users.noreply.github.com>
1 parent bf2c3a1 commit 05f9904

File tree

1 file changed

+170
-0
lines changed

1 file changed

+170
-0
lines changed
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
---
2+
layout: model
3+
title: Sentiment Analysis on Broker's Reports
4+
author: John Snow Labs
5+
name: finclf_bert_broker_sentiment_analysis
6+
date: 2023-01-31
7+
tags: [licensed, en, finance, bert, classification, tensorflow]
8+
task: Text Classification
9+
language: en
10+
edition: Finance NLP 1.0.0
11+
spark_version: 3.0
12+
supported: true
13+
engine: tensorflow
14+
annotator: FinanceBertForSequenceClassification
15+
article_header:
16+
type: cover
17+
use_language_switcher: "Python-Scala-Java"
18+
---
19+
20+
## Description
21+
22+
This English Sentiment Analysis Text Classifier will determine from a Broker's report whether a text is Positive, Negative, Neutral, or other expression.
23+
24+
## Predicted Entities
25+
26+
`Positive`, `Negitive`, `Neutral`, `other`
27+
28+
{:.btn-box}
29+
<button class="button button-orange" disabled>Live Demo</button>
30+
<button class="button button-orange" disabled>Open in Colab</button>
31+
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/finance/models/finclf_bert_broker_sentiment_analysis_en_1.0.0_3.0_1675177527227.zip){:.button.button-orange}
32+
[Copy S3 URI](s3://auxdata.johnsnowlabs.com/finance/models/finclf_bert_broker_sentiment_analysis_en_1.0.0_3.0_1675177527227.zip){:.button.button-orange.button-orange-trans.button-icon.button-copy-s3}
33+
34+
## How to use
35+
36+
37+
38+
<div class="tabs-box" markdown="1">
39+
{% include programmingLanguageSelectScalaPythonNLU.html %}
40+
```python
41+
# Test classifier in Spark NLP pipeline
42+
document_assembler = nlp.DocumentAssembler() \
43+
.setInputCol('text') \
44+
.setOutputCol('document')
45+
46+
tokenizer = nlp.Tokenizer() \
47+
.setInputCols(['document']) \
48+
.setOutputCol('token')
49+
50+
# Load newly trained classifier
51+
sequenceClassifier_loaded = finance.BertForSequenceClassification.pretrained("finclf_bert_broker_sentiment_analysis", "en", "finance/models")\
52+
.setInputCols(["document",'token'])\
53+
.setOutputCol("class")
54+
55+
pipeline = Pipeline(stages=[
56+
document_assembler,
57+
tokenizer,
58+
sequenceClassifier_loaded
59+
])
60+
61+
# Generating example
62+
example = spark.createDataFrame([["""UPL
63+
64+
65+
Estimate change
66+
TP change
67+
Rating change
68+
69+
Bloomberg UPLL IN
70+
Equity Shares (m) 765
71+
M.Cap.(INRb)/(USDb) 538.2 / 6.5
72+
52-Week Range (INR) 848 / 608
73+
1, 6, 12 Rel. Per (%) 0/-20/-3
74+
12M Avg Val (INR M) 2009
75+
76+
Financials & Valuation s (INR b)
77+
Y/E Mar 2022 2023E 2024E
78+
Sales 462.4 537.0 593.4
79+
EBITDA 101.7 121.5 135.3
80+
PAT 48.5 54.9 61.0
81+
EBITDA (%) 22.0 22.6 22.8
82+
EPS (INR) 63.5 71.7 79.7
83+
EPS Gr. (%) 39.9 13.0 11.1
84+
BV/Sh. (INR) 429 512 652
85+
Ratios
86+
Net D/E 1.0 0.8 0.5
87+
RoE (%) 24.5 23.1 20.7
88+
RoCE (%) 15.1 16.2 16.5
89+
Payout (%) 21.1 18.0 17.6
90+
Valuations
91+
P/E (x) 11.3 10.0 9.0
92+
EV/EBITDA (x) 7.6 6.3 5.2
93+
Div Yield (%) 1.4 1.7 2.0
94+
FCF Yield (%) 4.4 7.2 14.0
95+
96+
Shareholding pattern (%)
97+
Sep-22 Jun-22 Sep-21
98+
Promoter 29.0 29.0 28.0
99+
DII 17.2 16.5 18.0
100+
FII 42.8 36.4 35.1
101+
Others 11.1 18.1 19.0
102+
Note: FII includes depository receipts
103+
104+
CMP: INR 717 TP: INR 780 (+9%) Neutral
105+
106+
Higher working capital adversely impacts CFO
107+
Earnings better than expected
108+
 UPLL reported strong revenue growth of 18% YoY , driven primarily by an
109+
increase in price realization ( up 21% YoY). However, volume s declined (down
110+
7% YoY) in 2QFY23, led by rationalization of product mix toward high margin
111+
products. Except Europe (+1% YoY), all other key geographies registered a
112+
strong sales growth of over 20% YoY.
113+
 Gross debt increased to INR 326b in 2QFY23 from INR 301b in 1Q FY23 with
114+
net debt rising INR20b QoQ to INR 285b, due to an increas e in working
115+
capital requirement . This increase in working capital also resulted in cash
116+
outflow from operation of INR45.94b in 1HFY23 v/s cash outflow INR24.15b
117+
in 1HFY22 .
118+
 We largely maintain our FY23E/FY24 E earnings . We reiterate our Neutral
119+
rating on the stock with a TP of INR 780 (premised on 1 0x FY24E P/E) ."""]]).toDF("text")
120+
121+
result = pipeline.fit(example).transform(example)
122+
123+
# Checking results
124+
result.select("text", "class.result").show(truncate=False)
125+
```
126+
127+
</div>
128+
129+
## Results
130+
131+
```bash
132+
+----------+
133+
|result |
134+
+----------+
135+
|[Neutral] |
136+
+----------+
137+
```
138+
139+
{:.model-param}
140+
## Model Information
141+
142+
{:.table-model}
143+
|---|---|
144+
|Model Name:|finclf_bert_broker_sentiment_analysis|
145+
|Compatibility:|Finance NLP 1.0.0+|
146+
|License:|Licensed|
147+
|Edition:|Official|
148+
|Input Labels:|[document, token]|
149+
|Output Labels:|[class]|
150+
|Language:|en|
151+
|Size:|402.5 MB|
152+
|Case sensitive:|true|
153+
|Max sentence length:|128|
154+
155+
## References
156+
157+
An in-house annotated dataset
158+
159+
## Benchmarking
160+
161+
```bash
162+
label precision recall f1-score support
163+
Negative 1.00 0.81 0.90 16
164+
Neutral 0.84 0.84 0.84 25
165+
Positive 0.74 0.88 0.80 32
166+
other 1.00 0.77 0.87 13
167+
accuracy - - 0.84 86
168+
macro-avg 0.89 0.82 0.85 86
169+
weighted-avg 0.86 0.84 0.84 86
170+
```

0 commit comments

Comments
 (0)