---
language:
- en
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:6448
- loss:MultipleNegativesRankingLoss
base_model: BAAI/bge-base-en-v1.5
widget:
- source_sentence: How are retail sales data integrated into trading models?
sentences:
- Lagged variables represent historical values of a time series variable and are
used in forecasting models to capture the impact of past observations on future
market trends, enhancing the accuracy of predictions by incorporating relevant
historical information.
- Retail sales data reflect consumer spending patterns and overall economic activity.
Traders analyze this indicator to gauge consumer confidence, sectoral performance,
and potential market trends related to retail-focused stocks.
- Regulatory approval for a new drug can have a positive impact on a pharmaceutical
company's stock price as it opens up new revenue streams and market opportunities.
- source_sentence: What impact does algorithmic trading have on market liquidity?
sentences:
- Volume analysis in stock trading involves studying the number of shares or contracts
traded in a security or market over a specific period to gauge the strength or
weakness of a price move.
- Social media sentiment analysis can assist in detecting anomalies in stock prices
by capturing public sentiment and opinions on stocks, identifying trends or sudden
shifts in sentiment that may precede abnormal price movements.
- Algorithmic trading can impact market liquidity by increasing trading speed, efficiency,
and overall trading volume, leading to potential liquidity disruptions during
certain market conditions.
- source_sentence: What considerations should traders take into account when selecting
an adaptive trading algorithm?
sentences:
- Historical price data helps analysts identify patterns and trends that can be
used to develop models for predicting future stock prices based on past performance.
- Traders should consider factors such as performance metrics, risk management capabilities,
adaptability to changing market conditions, data requirements, and the level of
transparency and control offered by the algorithm.
- A stock exchange is a centralized marketplace where securities like stocks, bonds,
and commodities are bought and sold by investors and traders.
- source_sentence: How can currency exchange rates and forex markets be integrated
into trading models alongside macroeconomic indicators?
sentences:
- Moving averages smooth out price data over a specified period, making it easier
to identify trends and reversals in stock prices.
- Currency exchange rates and forex markets are integrated into trading models to
assess currency risk, international trade impact, and cross-border investment
opportunities influenced by macroeconomic indicators.
- Investors use quantitative momentum indicators to identify securities that are
gaining positive momentum and potentially generating profits by buying those assets
and selling underperforming assets.
- source_sentence: What role does back-testing play in refining event-driven trading
strategies using historical data and real-time analysis?
sentences:
- Genetic algorithms are well-suited for solving multi-objective optimization problems,
nonlinear and non-convex optimization problems, problems with high-dimensional
search spaces, and problems where traditional methods may struggle to find optimal
solutions.
- Risk management techniques such as position sizing, portfolio diversification,
and stop-loss orders are often used in quantitative momentum strategies to manage
downside risk and protect against large losses.
- Back-testing allows traders to evaluate the performance of event-driven trading
strategies using historical data, identify patterns, optimize parameters, and
refine strategies for real-time implementation.
datasets:
- yymYYM/stock_trading_QA
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
- cosine_accuracy@3
- cosine_precision@3
- cosine_recall@3
- cosine_ndcg@3
- cosine_mrr@3
- cosine_map@3
model-index:
- name: SentenceTransformer based on BAAI/bge-base-en-v1.5
results:
- task:
type: information-retrieval
name: Information Retrieval
dataset:
name: Unknown
type: unknown
metrics:
- type: cosine_accuracy@3
value: 0.6750348675034867
name: Cosine Accuracy@3
- type: cosine_precision@3
value: 0.22501162250116222
name: Cosine Precision@3
- type: cosine_recall@3
value: 0.6750348675034867
name: Cosine Recall@3
- type: cosine_ndcg@3
value: 0.5838116811117793
name: Cosine Ndcg@3
- type: cosine_mrr@3
value: 0.5523012552301251
name: Cosine Mrr@3
- type: cosine_map@3
value: 0.5523012552301255
name: Cosine Map@3
---
# SentenceTransformer based on BAAI/bge-base-en-v1.5
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) on the [stock_trading_qa](https://huggingface.co/datasets/yymYYM/stock_trading_QA) dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
## Model Details
### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5)
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 768 dimensions
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
- [stock_trading_qa](https://huggingface.co/datasets/yymYYM/stock_trading_QA)
- **Language:** en
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': True}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
(2): Normalize()
)
```
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bash
pip install -U sentence-transformers
```
Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("iamleonie/leonies-test")
# Run inference
sentences = [
'What role does back-testing play in refining event-driven trading strategies using historical data and real-time analysis?',
'Back-testing allows traders to evaluate the performance of event-driven trading strategies using historical data, identify patterns, optimize parameters, and refine strategies for real-time implementation.',
'Risk management techniques such as position sizing, portfolio diversification, and stop-loss orders are often used in quantitative momentum strategies to manage downside risk and protect against large losses.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```
## Evaluation
### Metrics
#### Information Retrieval
* Evaluated with [InformationRetrievalEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
| Metric | Value |
|:-------------------|:-----------|
| cosine_accuracy@3 | 0.675 |
| cosine_precision@3 | 0.225 |
| cosine_recall@3 | 0.675 |
| **cosine_ndcg@3** | **0.5838** |
| cosine_mrr@3 | 0.5523 |
| cosine_map@3 | 0.5523 |
## Training Details
### Training Dataset
#### stock_trading_qa
* Dataset: [stock_trading_qa](https://huggingface.co/datasets/yymYYM/stock_trading_QA) at [35dab2e](https://huggingface.co/datasets/yymYYM/stock_trading_QA/tree/35dab2e25b6da10842cfb0f832b715cab3765727)
* Size: 6,448 training samples
* Columns: anchor
and context
* Approximate statistics based on the first 1000 samples:
| | anchor | context |
|:--------|:----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|
| type | string | string |
| details |
How should I approach investing in a volatile stock market?
| Diversify your portfolio, invest in stable companies, consider dollar-cost averaging, and stay informed about market trends to make informed trading decisions.
|
| What is the role of cross-validation in assessing the performance of time series forecasting models for stock market trends?
| Cross-validation helps evaluate the generalization ability of forecasting models by partitioning historical data into training and validation sets, ensuring that the model's performance is robust and reliable for future predictions.
|
| What role does correlation play in statistical arbitrage and pair trading?
| Correlation measures the relationship between asset prices and helps traders identify pairs that exhibit a stable price relationship suitable for pair trading.
|
* Loss: [MultipleNegativesRankingLoss
](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
```
### Evaluation Dataset
#### stock_trading_qa
* Dataset: [stock_trading_qa](https://huggingface.co/datasets/yymYYM/stock_trading_QA) at [35dab2e](https://huggingface.co/datasets/yymYYM/stock_trading_QA/tree/35dab2e25b6da10842cfb0f832b715cab3765727)
* Size: 717 evaluation samples
* Columns: anchor
and context
* Approximate statistics based on the first 717 samples:
| | anchor | context |
|:--------|:----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|
| type | string | string |
| details | How can anomaly detection in stock prices be used to identify market inefficiencies and opportunities for arbitrage?
| Anomaly detection can help identify market inefficiencies by spotting mispricings and opportunities for arbitrage, where traders can exploit price differentials to make profits by trading on anomalies.
|
| How do traders interpret the Head and Shoulders pattern as a trading signal?
| The Head and Shoulders pattern is a reversal pattern with three peaks, where the middle peak (head) is higher than the other two (shoulders), signaling a potential trend reversal and offering a bearish trading signal.
|
| How do traders use Fibonacci levels as trading signals?
| Fibonacci levels are used as trading signals to identify potential support and resistance levels, trend reversals, and price targets in financial markets.
|
* Loss: [MultipleNegativesRankingLoss
](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `gradient_accumulation_steps`: 16
- `learning_rate`: 2e-05
- `num_train_epochs`: 4
- `lr_scheduler_type`: cosine
- `warmup_ratio`: 0.1
- `fp16`: True
- `optim`: adamw_8bit
- `batch_sampler`: no_duplicates
#### All Hyperparameters