Chatbot Showdown: ChatGPT vs. Google BARD in Predicting Stock Market Prices

Exploring AI-Powered Assistants for Data Scientists — Unleashing the Power of ChatGPT and Google BARD

Arthur Chong
Artificial Corner
7 min readAug 4, 2023

--

Photo by Mojahid Mottakin on Unsplash

Introduction

In today’s data-driven world, the field of data science plays a crucial role in extracting valuable insights and making informed decisions. However, data science projects often involve complex tasks, ranging from data preprocessing and exploratory analysis to model training and result interpretation.

Now, imagine having an intelligent assistant that can understand your data-related queries, guide you through the analysis process, and provide real-time insights. This is where AI chatbots step in, offering an innovative and interactive approach to data science projects.

In this article, we will discuss more about the world of AI chatbots and explore their role in data science projects, specifically machine learning modelling. We will examine 2 of the most popular AI chatbot tools today and they are:

  1. OpenAI’s ChatGPT
  2. Google Bard

These AI chatbots have been trained on large amounts of text data and are capable of understanding natural language and even complete complex tasks that is asked of them.

In this article, we will explore how to craft prompts for these 2 chatbots to obtain high-quality responses from them. But here’s the catch, to make things interesting, we will pit these 2 chatbots against each other and see which one can come up with the better model at the end! This time, we will use a clean and simple stock market dataset. Here is a snippet of the data.

ChatGPT

First up is ChatGPT! This AI tool needs no introduction, but for the sake of those living under a rock, ChatGPT is OpenAI’s most popular work. It reached a million users in only 5 days after launching in late 2022. For comparison, Instagram took 2.5 months to reach 1 million users, 2 years for Twitter, and 3.5 years for Netflix. This chatbot utilises OpenAI’s large language models, and was trained on large amounts of text sourced on the internet (like most other chatbots). Thus, ChatGPT is capable of tasks like language translation, text generation, text completion, and even assist in generating or troubleshooting your code. We will now look at how to create prompts for ChatGPT and how does it fare when creating a model.

Project planning

When starting a new project, we will almost always be provided with a dataset and depending on how large it is, we may be unsure of what steps we should take to achieve our project end goal. Here, we can consult ChatGPT and it can help us generate a list of steps to follow.

Here is the prompt I created and ChatGPT’s response.

ChatGPT has kindly listed us 9 steps to follow to create a model that can help us predict housing prices based on the input features given in the dataset. It has also given us a brief description of each step. To keep things simple, we will just be asking the model to split the dataset and create the model for us.

Splitting dataset

In this example, let’s ask ChatGPT to split the data into a training set and a test set using python.

Here, ChatGPT has provided us with the libraries to import to complete this task. It has identified the input features for us and the target variable correctly. It has also suggested a split ratio of 80:20 for us, but you can tell it to split it using another ratio as well.

Creating a model

Finally, let us try asking ChatGPT to create a logistic regression model based on the training set and test set that it has helped us create.

Just like that, we have created a logistic regression model using the scikit-learn library with the help of ChatGPT in a matter of minutes!

But how did this model fare? I ran the code that ChatGPT gave me and it got an accuracy of 1.0! Even though that may be the ideal score for a model, a perfect score could raise suspicions on whether this model may be overfitted.

Google Bard

The second contestant is Google Bard! Google Bard is Google’s new AI chatbot released in March 2023 and like ChatGPT, it is built on a large language model (PaLM2) and can perform similar tasks as ChatGPT. However, one big difference that sets Bard apart from ChatGPT is that Google Bard has access to the internet, an attribute that ChatGPT does not possess. This allows Bard to give up-to-date information unlike ChatGPT which is only trained on information until September 2021.

Let us now look at how we can leverage Google Bard to carry out the same project we just did! When it comes to Bard, we will have to be more specific with our inputs in order to receive high-quality responses from Bard.

Let us start with asking Bard to generate the steps to take for creating a model that predicts housing prices.

Prompt: “Act as a data scientist. You have been tasked to develop steps to create a machine learning model that can predict the stock market direction (Up or Down) given some input features. You have been given a stock market dataset consisting of 1250 rows and 10 columns [‘ID’, Year, Lag1, Lag2, Lag3, Lag4, Lag5, Volume, Today, Direction].”

The response is quite similar to ChatGPT. However, notice the difference in the prompt. We have to ask bard to act as a Data Scientist to plan for the project. This is essential in order to get a good and more reliable response from Bard. Now let us ask it to split the dataset for us!

Prompt: “Now write code in python using scikit-learn to split the dataset above into training set and test set.”

When it comes to splitting the training and test set, we have to ask explicity ask Bard to use the scikit-learn library. Otherwise, Bard would not use it and use other methods to complete this task. However, since we are planning to implement a machine learning model, we would prefer to use the scikit-learn library. Bard also splits the dataset into a 75:25 ratio instead of a 80:20 ratio. Finally, we will ask Bard to create the logistic regression model

Prompt: “Now you are tasked to write a Python code to build a logistic regression model that predicts the stock market direction.”

Once again, Google Bard has helped us to create a Logistic Regression Model to predict the stock market direction based on the dataset provided to us!

After running this code in my Jupyter Notebook, the accuracy score of the model is 0.9936! This is also very high and may indicate overfitting.

Conclusion

In the ever-evolving landscape of AI-driven tools, both ChatGPT and Google Bard have showcased their unique capabilities in creating a model. Through our comparative analysis, we explored their strengths, differences, and how they approached the task of building a logistic regression model to predict stock market directions. However, this is a very simplified example and thus the results may not be reliable so take it with a very big pinch of salt!

ChatGPT showed that it was able to guide us through the data exploration process, providing valuable insights along the way. Furthermore, its conversational nature allowed for a collaborative experience, enabling us to interact and iterate on ideas seamlessly.

On the other hand, Google Bard required a more structured and efficient communication. The clear and concise instructions allowed us to streamline the model-building process, making it an ideal choice for projects that require precision and quick execution.

We are fortunate to have access to such powerful AI chatbot tools (for free!), each with its distinctive characteristics that cater to different project needs. Thus, when embarking on your data science journey, the choice between these AI chatbots ultimately depends on your preferred interaction style, project complexity, and personal preference.

In conclusion, leveraging AI chatbots like ChatGPT and Google Bard can significantly enhance the productivity and effectiveness of your data science projects. These conversational AI assistants can be your companions, guiding you through data exploration, model training, and decision-making, ultimately empowering you to uncover valuable insights from your data.

As we continue to embrace the possibilities of AI, it’s essential to remember that these tools are here to augment our skills, not replace them. By combining the power of AI with human expertise, we can navigate the data science landscape with confidence and creativity.

Connect with me!

LinkedIn
Email : arthurchong01@gmail.com

--

--

Arthur Chong
Artificial Corner

Undergraduate Data Science and Analytics student at The National University of Singapore interested in Machine Learning and AI