We live in a time of revolutionary technological progress, with many companies now beginning to integrate new generative AI technologies into the workplace. Data scientists and analysts have been using these technologies to improve productivity and the quality of their work.
Before ChatGPT, data scientists and analysts used GitHub Copilot to assist with coding tasks like optimization, formatting, debugging, and writing test units. However, ChatGPT has changed the game, enabling users to apply generative AI to almost every data science task, from data cleaning to model development and monitoring.
Expand your knowledge of GPT models, specifically GPT-4, by reading our article What is GPT-4 and Why Does it Matter?
Image by Author
Since the release of ChatGPT, we have witnessed a rapid development of open-source generative AI and commercial AI systems. This article will explore a new state-of-the-art model called Claude and compare it to ChatGPT across various data science tasks.
If you're interested, there are 12 open-source alternatives to ChatGPT that you can explore to build your very own AI Chatbot. You can also find out how the new DataCamp AI assistant works in a separate article.
What is Claude?
Claude is a large language model (LLM) AI created by Anthropic that can generate text, write code, and act as an intelligent automated assistant, similar to ChatGPT.
Anthropic trained Claude using a “Constitutional AI” technique, which aims to produce AI systems aligned with human values and goals from inception.
Image from Poe
How to Access Claude?
At this time, Anthropic is making Claude available only to a limited "early access" group and commercial partners. But you can access Claude for free using the following:
- Vercel AI Playground: create a free Vercel Hobby account to access the Claude model and other LLMs.
- Poe: create a free account to access all versions of Claude, ChatGPT, Sage, and more.
- Slack App: add the Claude app to your workspace for free. Send Claude a direct message or mention @Claude in a channel to interact with an AI bot.
What is ChatGPT?
ChatGPT is an AI-powered conversational platform developed by OpenAI. Under the hood, it utilizes large language models like GPT-3.5 Turbo and GPT-4 to enable human-like conversations through natural language prompts. Read our full guide, What is ChatGPT? for more information.
The chatbot is capable of generating code, translating text from one language to another, summarizing lengthy passages, correctly understanding the context within conversations, and performing a variety of complex tasks.
ChatGPT's capabilities can be extended through the use of plugins that provide additional functionality like automation, web search integration, code execution, and other features.
Image from ChatGPT
How to Access ChatGPT?
Access ChatGPT by creating a free account at openai.com. The free account provides access to the GPT-3.5 turbo model. For an enhanced experience, consider subscribing to ChatGPT Plus, which unlocks features like plugins and access to more powerful models.
Comparing the Capabilities of Claude and ChatGPT
Let’s compare the two AI chatbots, Claude and ChatGPT, based on example prompts for data science tasks, including project planning, programming, data analysis, machine learning, time series, and natural language processing.
Note: it is not a comprehensive evaluation, as we are using a single prompt example to determine which AI model provides better output for the specific tasks.
Before comparing the results in detail, let's first look at the key differences between Claude and ChatGPT by reviewing the comparison table.
30th November 2022
14th March 2023
Number of users
100 million +
Private; not yet launched to the public
GPT-3.5 and GPT-4
Better than Claude
Calculations are fine
Better than ChatGPT
Writes optimized code
Understands the question well
Natural language processing
Table by Author
Now, we will compare the performance of the GPT-3.5-turbo model against the Claude-instant model in detail.
Screenshot by Author | ChatGPT
Screenshot by Author | Claude | poe.com
Problem: In the prompt, we included a dataset description and project goal for building a loan classifier model. Those interested in accessing the dataset and project planning can find them in A Guide to Using ChatGPT for Data Science Projects.
Verdict: Both are Great at project planning, but ChatGPT is slightly better at presenting the information and additional steps.
Problem: We asked both models to optimize a nested Python loop example.
Verdict: While ChatGPT attempted to optimize the code by storing values in a list, Claude was able to convert the nested loops into list comprehension, resulting in faster execution. Therefore, Claude emerged as the winner.
Problem: We tasked both models with conducting exploratory data analysis on a loan classification dataset.
Verdict: Although ChatGPT demonstrated strong skills in data analysis, Claude's proficiency in writing efficient Python code ultimately gave it the edge. While ChatGPT employed a variety of libraries for data analysis, Claude relied solely on the pandas library for data visualization, processing, and analysis, showcasing their mastery of this tool. As a result, Claude emerged as the clear winner.
Problem: We asked both models to perform detailed model evaluations using cross-validation and assess performance metrics such as accuracy, precision, recall, and F1 score.
Verdict: Claude outperformed ChatGPT in this regard by employing cross-validation for label prediction and subsequently utilizing various metrics to gauge model performance. In contrast, ChatGPT relied on
cv_scores and a separate model to determine classification metrics.
Problem: We presented a data description and tasked both models with building a machine learning model for predicting stock prices.
Verdict: Claude demonstrated a better understanding of the task while ChatGPT continuously asked follow-up questions. However, both models excelled at generating code, with ChatGPT resorting to an outdated method using from
statsmodels.tsa.arima.model import ARIMA, while Claude implemented a more advanced approach using
GradientBoostingRegressor. Claude was a winner in this case.
Natural Language Processing
Problem: We asked both models to write a Python code for fine-tuning the GPT-2 model on a new dataset.
Verdict: ChatGPT seemed to have hallucinated and created a new library for fine-tuning the model that didn't exist. On the other hand, Claude used a transformer library and successfully fine-tuned the model. Therefore, Claude wins this round.
Take a look at the comparison between Bard and ChatGPT for Data Science to understand how Google Bard measures up against ChatGPT in various data science assignments.
Claude vs ChatGPT: The Final Verdict
For data-related tasks that require a deep understanding of technical context and the ability to generate optimized code, Claude is the recommended choice. However, for all other tasks, ChatGPT is the preferred option, especially with its advanced GPT-4 model.
Note: Claude-Instant-100K model is on par with GPT-4 in terms of performance, but it's not widely available. You can also check out the non-official benchmark results at chat.lmsys.
Practical Applications of Claude and ChatGPT in Data Science
Claude and ChatGPT can provide valuable assistance in various data science tasks, such as:
Extensive project planning
Both tools can assist you in developing a comprehensive project plan. They can also provide insights, methodologies, and tools to help you prepare for the data science project.
With generative AI, You can learn new concepts, languages, and even frameworks. Moreover, they can help you gather information, summarize research papers, and generate content.
Both Claude and ChatGPT can generate code snippets for data preprocessing, feature engineering, model training, and evaluation, saving time and effort for data scientists.
You can also automatically generate test cases based on the code and specifications provided.
Each tool can provide suggestions and insights into potential errors or issues in code or data pipelines, giving you the chance to spot mistakes and learn how and why they’re impacting your code.
ChatGPT and Claude can both understand data analysis results and help you generate analytical data reports that demonstrate your findings.
You can optimize Python, SQL, and R code using these tools and also use them to recommend efficient algorithms or techniques to improve your code.
Performing statistical tests
You can generate statistical tests, such as hypothesis testing, ANOVA, t-tests, and regression analysis, based on the provided data and research questions.
Understanding data analysis results
Both AI tools can interpret your results, providing explanations, insights, and recommendations based on statistical findings and visualizations. This can help you understand your findings better and also help explain them to others.
Automating data science tasks
With the help of plugins, you can automate data analysis and various other tasks in data science workflow.
To learn how to use ChatGPT for building end-to-end machine learning projects, check out the Guide to Using ChatGPT For Data Science Projects.
ChatGPT and Claude are great at solving problems and generating high-quality code for data science projects. Due to its limited availability, Claude is largely unknown to professionals. Most use ChatGPT to create a code snippet, debug, and solve complex problems.
However, when comparing Claude by Anthropic with ChatGPT on various data science tasks, we found that Claude offers comparable or even superior performance to ChatGPT in specific tasks.
I am a certified data scientist who enjoys building machine learning applications and writing blogs on data science. I am currently focusing on content creation, editing, and working with large language models.