“When Harry Met Sally” Or When SOT Met COT – Practical AI In Financial Predictions

Meg Ryan And Billy Crystal Portrait

Access the Complete Original Forbes article Here.

Overview of the Forbes article about:
The Technic of Prompt Engineering Embraces a New Technique
Called SOT And COT Reasoning for Generative AI:

The Forbes article discusses the skeleton-of-thought (SoT) technique and its potential to improve generative AI results. The author argues that while some can write essays without outlines, SoT can be a valuable tool for organizing thoughts and improving writing efficiency.

 The article includes quotes from author Jeffery Deaver about the importance of outlining and describes the benefits of using SoT in prompt engineering. The article also references a study on the advantages of leveraging parallelism to speed up processing in AI. 

Overall, the article overviews SoT And CoT and its potential applications in generative AI.

Access the Complete Original Forbes article

Access the Complete Original Forbes article Here.

Practical example of predicting stock market trends 

While inspired by an article in Forbes about Prompt Engineering Embracing a New Technique Called Skeleton-Of-Thought as a Bonus on Chain-Of-Thought Reasoning for Generative AI on the Skeleton-of-Thought (SoT) technique, this article aims to further elucidate the concept by presenting a singular, practical application in the financial domain.

It’s essential to understand that while the underlying theory derives from the Forbes article, the practical example of predicting stock market trends is an original contribution to showcasing the technique’s real-world potential.

Meg Ryan And Billy Crystal Portrait

When Harry Met Sally - Or When SOT Met COT

What is SoT?

Skeleton-of-thought (SoT) is a technique used in prompt engineering for generative AI. It is a creative adaptation of the chain-of-thought (CoT) prompting approach. It involves deriving a skeleton first and then adding evidence and details to refine and clarify each point. SoT can accelerate open-source models with batched decoding and closed-source models with parallel API calls. The technique can provide considerable speed-up and improve the answer quality on several question categories regarding diversity and relevance. However, it currently needs help to answer math questions well.

What is a CoT?

Chain-of-thought (CoT) is a prompting technique that involves expanding on each thought process step to continue the following reasoning. It is a widespread technique used in prompt engineering for generative AI. CoT relies on the raised details of each step to continue the following rationale, while the skeleton-of-thought (SoT) technique hopes to list out the skeleton in advance strategically.

Concentrated Young African American Female Leader Boss,Negotiating Business Ideas

The Project:

Predictive Analysis of Stock Market Trends Using Time-Series Data

This project focuses on leveraging AI to predict stock market trends, a challenging yet valuable task in the financial world. Remember that many unpredictable factors influence stock markets, so always approach cautiously and ethically.

  1. Literature Review and Research:

Study the basics of stock market behavior, financial indicators, and time-series analysis.

Understand current state-of-the-art techniques in stock price prediction and its challenges.

  1. Define the Scope:

Determine the specific stock market index or individual stocks you want to focus on.

Define the prediction horizon (e.g., next day, week, month).

  1. Gather Data:

Collect historical stock price data, preferably with high granularity (daily, hourly).

Incorporate other relevant data sources: financial news, global economic indicators, company performance metrics, etc.

  1. Build the Predictive Model:

Use a deep learning library (TensorFlow, PyTorch) to design a time-series prediction model (e.g., LSTM, GRU).

Consider hybrid models that combine time-series data with other contextual information.

  1. Training:

Split your data into training, validation, and test sets.

Train your model using the training dataset. Tune hyperparameters based on performance on the validation set.

  1. Evaluation:

Assess the model’s predictive accuracy on the test set.

Compare its performance with traditional stock prediction methods or models.

  1. Optimization and Fine-tuning:

Incorporate feedback loops to adapt to new data and market conditions.

Fine-tune the model using transfer learning or ensemble methods to enhance accuracy.

  1. Deployment:

Convert the model into a real-time stock prediction tool.

Integrate with trading platforms or financial analysis dashboards.

  1. Documentation:

Detail the approach, data sources, model architecture, training, and results.

Offer insights into potential risks, challenges, and ethical considerations.

  1. Share & Collaborate:

 Share your findings and model with the financial community.

Engage with experts for further refinement and potential real-world applications.

Below is a simplified version of the code for a stock prediction model using an LSTM (Long Short-Term Memory) network. This will give you a starting point. Please note that predicting stock prices is complex, and this basic model is only for educational purposes.

					# Import necessary libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, LSTM

# Load data
data = pd.read_csv('stock_data.csv')  # replace with your data file
prices = data['Close'].values.reshape(-1, 1)  # replace 'Close' with your column name if different

# Normalize data
scaler = MinMaxScaler(feature_range=(0,1))
normalized_prices = scaler.fit_transform(prices)

# Split data into train and test
train_size = int(len(normalized_prices) * 0.67)
train, test = normalized_prices[0:train_size, :], normalized_prices[train_size:len(normalized_prices), :]

# Convert data to appropriate format for LSTM
def create_dataset(dataset, look_back=1):
    dataX, dataY = [], []
    for i in range(len(dataset) - look_back - 1):
        a = dataset[i:(i + look_back), 0]
        dataY.append(dataset[i + look_back, 0])
    return np.array(dataX), np.array(dataY)

look_back = 3
trainX, trainY = create_dataset(train, look_back)
testX, testY = create_dataset(test, look_back)

trainX = np.reshape(trainX, (trainX.shape[0], trainX.shape[1], 1))
testX = np.reshape(testX, (testX.shape[0], testX.shape[1], 1))

# Build LSTM model
model = Sequential()
model.add(LSTM(50, input_shape=(look_back, 1)))
model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(trainX, trainY, epochs=50, batch_size=1, verbose=2)

# Make predictions
trainPredict = model.predict(trainX)
testPredict = model.predict(testX)

# Invert predictions to original scale
trainPredict = scaler.inverse_transform(trainPredict)
trainY = scaler.inverse_transform([trainY])
testPredict = scaler.inverse_transform(testPredict)
testY = scaler.inverse_transform([testY])

# Calculate root mean squared error
trainScore = np.sqrt(mean_squared_error(trainY[0], trainPredict[:,0]))
print(f'Train Score: {trainScore} RMSE')
testScore = np.sqrt(mean_squared_error(testY[0], testPredict[:,0]))
print(f'Test Score: {testScore} RMSE')

# Plot original data and predictions
trainPredictPlot = np.empty_like(normalized_prices)
trainPredictPlot[:, :] = np.nan
trainPredictPlot[look_back:len(trainPredict) + look_back, :] = trainPredict
testPredictPlot = np.empty_like(normalized_prices)
testPredictPlot[len(trainPredict)+(look_back*2)+1:len(normalized_prices)-1, :] = testPredict

Important Notes:

Replace ‘stock_data.csv’ with your dataset’s path.

Ensure you have the required libraries installed (pip install pandas numpy tensorflow scikit-learn matplotlib).

More sophisticated models, features, and methodologies are needed for real-world applications.

Use the predictions responsibly and remember that numerous factors influence stock markets. Always be cautious and consult with domain experts.

Code Integration and Corresponding Project Phases:

In the structure I provided for the project, the code snippet I subsequently provided relates to these sections:

4. Build the Predictive Model:

Here, we defined the model architecture using LSTM layers for the time-series prediction.

5. Training:

The code contains a segment that handles the training of the LSTM model on the given dataset.

6. Evaluation:

In the provided code, the model’s performance is evaluated based on root mean squared error (RMSE) for both training and testing datasets.

8. Deployment:

While the provided code does not directly deploy the model, the prediction step is akin to how the model would be used in a deployment setting, i.e., making predictions on new data.

Further Steps for Comprehensive Project Execution

To fully address the entire project structure, additional steps such as data gathering, preprocessing, further optimization, deployment specifics, and documentation would need to be expanded upon separately.

Business Ethics Behavior And Manners Concept. Businessman Pressing Button On

Ethical Considerations in Stock Market Predictions Using AI

Integrating AI in stock market predictions presents a transformative approach to finance. However, alongside its potential, there are several ethical concerns that practitioners and stakeholders must address:

1. Over-Reliance on Predictions:

AI predictions are based on past data and do not guarantee future outcomes. Investors, primarily those less familiar with AI, might overly rely on these predictions, leading to potentially significant financial losses.

2. Transparency and Accountability:

AI models, intense learning ones, can be complex and not easily interpretable. Any AI-driven tool must provide as much transparency as possible about how predictions are made and that there’s accountability for inaccurate forecasts.

3. Data Bias:

AI models are as good as the data they’re trained on. Predictions could be skewed if the training data has an inherent bias. For stock market predictions, this could mean an undue emphasis on certain stocks or trends that don’t reflect the broader market.

4. Potential for Manipulation:

Malicious actors risk manipulating predictions for personal gain, either by feeding misleading data to the model or exploiting known biases in AI predictions.

5. Economic Implications:

The widespread use of AI in stock predictions can impact market dynamics. If many investors use similar AI-driven tools, it could lead to herding behavior, exacerbating market volatility.

6. Social Responsibility:

Investors and financial institutions should consider the broader societal impact of their actions. For instance, AI-driven speculation could negatively impact industries or lead to sudden market downturns affecting ordinary people’s pensions and savings.

7. Continuous Learning and Adaptation:

Financial markets are dynamic, with new factors and events continuously shaping trends. Relying solely on historical data can be misleading. Ensuring AI models constantly learn and adapt to new data is ethically imperative.


In conclusion, while AI offers unprecedented capabilities in forecasting stock market trends, using such tools responsibly is imperative. Transparent communication about the limitations and uncertainties of AI predictions, combined with ethical considerations, will ensure that investors are informed and protected.

Share This: