Tôi choáng ngợp trước những gì ChatGPT với Code Interpreter có thể làm cho phân tích dữ liệu
Tôi hỏi ChatGPT những câu hỏi mơ hồ như "kể cho tôi điều gì đó thú vị" về dữ liệu Treasury — nó ngay lập tức tạo ra biểu đồ sâu sắc mà tôi mất hàng giờ để tạo thủ công.
Bài viết này được viết năm 2023. Một số chi tiết có thể đã thay đổi.
Khi Ethan Mollick viết về ChatGPT với Code Interpreter mạnh mẽ thế nào, tôi vô cùng tò mò. Lúc đó tôi đang đi nghỉ nên mãi hôm nay mới có dịp thử. Và thật sự, nó khiến tôi choáng ngợp!
Để có bối cảnh, tôi quyết định sử dụng dữ liệu về các loại chứng khoán chính phủ Mỹ từ website Treasury Direct. Tôi chọn dataset này vì tôi đã viết bài "Tại sao bạn không nên tin vào sự thổi phồng rằng website TreasuryDirect lỗi thời" trước đây nên tôi khá quen thuộc với dataset. Và quan trọng hơn, tôi nhớ đại khái mất bao lâu để tạo các biểu đồ.
Tải lên toàn bộ dataset cực kỳ dễ dàng
Chỉ cần một cú click, tôi có thể tải lên toàn bộ dataset cùng với data dictionary. Và tôi không cần nói nhiều về dataset, chỉ vài câu từ website "The Securities Issued in TreasuryDirect dataset details how many of each type of Treasury bonds are issued, redeemed, or outstanding in TreasuryDirect from Fiscal Year (FY) 2002 until present. Outstanding bonds refer to those which are still in circulation, and have not yet been redeemed. The number of outstanding Treasury bonds is determined by taking the difference between the numbers of Treasury bonds issued and redeemed. This dataset does not contain any information on the values or yields of the Treasury bonds."
Tôi thích việc không cần prompt, ChatGPT tự cho tôi biết cách nó hiểu dataset ở mức tổng quan và cho tôi xem các hàng dữ liệu đầu tiên làm preview.
Giờ tôi có thể bắt đầu "trò chuyện" với dữ liệu
Bạn có thể cho tôi biết điều gì thú vị về dataset này không?
Tôi hỏi ChatGPT một câu hỏi khá mơ hồ "can you tell me something interesting about this dataset?" Đây là câu hỏi siêu chung chung vì tôi muốn xem liệu ChatGPT có thể đoán trực giác điều gì có thể thu hút con người.
Và đây là phản hồi:
Như bạn thấy, ChatGPT đoán đúng rằng xu hướng gross sales theo thời gian có lẽ là một trong những điểm thú vị đầu tiên về dataset mà tôi có thể quan tâm. Sau đó nó phân tích gross sales theo loại chứng khoán trong biểu đồ tiếp theo. (Nếu bạn để ý kỹ giữa lời mô tả và biểu đồ cuối cùng, bạn có thể thấy ChatGPT nói sai màu "orange" thay vì "darker blue", nhưng đó không phải vấn đề lớn).
Tiếp theo, tôi hỏi ChatGPT một câu hỏi mơ hồ khác :P
"Based on this dataset, do you think that the website treasury direct is getting more popular?"
Và tôi thích câu trả lời nó đưa ra "The popularity of the TreasuryDirect website could be inferred by examining the trends in sales and the number of transactions over time. If we see an increase in these metrics, it could suggest that more people are using the website to purchase Treasury bonds. However, it's important to note that this is a rough estimation and might not represent the full picture of the website's popularity, as there might be other factors at play."
Tôi thích phản hồi vì giọng điệu đúng. ChatGPT nói rõ rằng nó không chắc chắn và câu trả lời chỉ là một trong nhiều câu trả lời có thể.
Đây là biểu đồ ChatGPT tạo ra
Lặp lại là chìa khóa
Mặc dù các biểu đồ trên ổn, chúng chưa phải sản phẩm cuối cùng tôi muốn. Nên tôi hỏi ChatGPT "I want to include the chart about the number of transactions over time on my blog, can you reformat the chart so that it is easier to read?"
Và bạn có thể thấy sự cải thiện theo thời gian bên dưới, từng bước một:
Cải thiện lần 1
Đây là phản hồi của ChatGPT sau yêu cầu của tôi:
Absolutely, I can modify the chart to make it easier to read. Some changes that could improve the chart's readability include:
- Increasing the font size of the title, labels, and ticks.
- Adjusting the linewidth of the plot for better visibility.
- Adding a more descriptive title and labels.
- Making the gridlines lighter to avoid distraction.
Và đây là biểu đồ
Cải thiện lần 2
Tôi nhận thấy điều gì đó lạ với trục dọc nên tôi nói "for the vertical axis, I am not sure if my audience will understand what 1e6 means?"
và đây là kết quả
"Understandable, scientific notation can sometimes be confusing for a general audience. Instead, we can convert the y-axis labels to millions and add that information to the label. This way, the numbers will be more straightforward to understand. Let's make that adjustment."
Sửa đổi lần 3
Đây là phản hồi của tôi sau khi thấy biểu đồ trên "yes this graph is getting much better! I notice from the trend that the number of transactions increased significantly over the past few years. How do we show this better to my audience?"
và ChatGPT trả lời:
"One common method for highlighting trends in data over time is to include a trend line in the graph. A trend line (also called a line of best fit) is a line that is used to represent the behavior of a group of data to see if there's a certain pattern.
In the context of your data, adding a trend line can help visualize whether there's an overall increase in the number of transactions over time, despite any short-term fluctuations.
Let's add a trend line to the graph. We'll use a simple linear regression model to estimate the trend. We'll also include the equation of the trend line and the R-squared value (which measures how closely the data fit the regression line) in the graph's legend to provide more context for the audience."
Mặc dù câu trả lời của ChatGPT nghe tự tin, bạn có thể thấy không có đường trend màu đỏ nào trong biểu đồ trên. Vì vậy tôi đưa phản hồi
Sửa đổi lần 4
"I dont see the red line at all from the above chart"
và đây là phản hồi của ChatGPT:
"I apologize for the confusion. The red line representing the trend might not be visible due to the large fluctuations in the data. A trend line, especially for a linear regression model, may not adequately represent the data if there are large-scale fluctuations or if the trend is not linear.
An alternative way to highlight the trend could be to use a rolling mean (also known as a moving average). This technique averages out the fluctuations over a certain period to highlight the longer-term trend.
Let's apply a 12-month rolling mean to the data and plot it along with the original data. This should help us better visualize the overall trend."
"A rolling mean smooths out short-term fluctuations and highlights longer-term trends in data. In this case, it's calculated by averaging the number of transactions over 12-month periods.
The rolling mean line shows the general trend of the data despite the monthly fluctuations. As we can see, there's a clear upward trend in the number of transactions, which supports your observation that TreasuryDirect is becoming more popular."
Tuyệt vời phải không? Tôi không nói với ChatGPT rằng tôi muốn xem 12-month rolling mean nhưng nó tự đề xuất. Thành thật, tôi không nghĩ đến cách trực quan hóa sự thay đổi lớn trong vài năm qua so với 20 năm trước theo cách này. Một lần nữa rất ấn tượng!
Bạn cũng sẽ nhận thấy lựa chọn màu sắc, nó cố ý dùng màu đậm hơn cho đường trend để làm nổi bật sự thay đổi, đúng là điều tôi muốn.
Sửa đổi cuối cùng
Mặc dù đã ấn tượng với biểu đồ cuối, tôi thêm câu "actually, one additional question, do we need the gridlines for the above chart? do you think we can simlify the chart further by eliminating the gridlines?"
và đây là những gì tôi nhận lại
Đọc quy trình sửa đổi này, bạn có thể cảm thấy nó mất quá nhiều thời gian nhưng không, trong thực tế, mỗi lần lặp mất chưa đến 5-10 giây. Chắc chắn nhanh hơn nhiều so với tôi tự làm!
So sánh trực tiếp giữa biểu đồ tự làm và biểu đồ ChatGPT
Như đã đề cập ở trên, tôi đã viết bài blog sử dụng dataset này trước đây nên đã tạo vài biểu đồ. Giờ tôi muốn so sánh tạo lại cùng biểu đồ nhưng dùng ChatGPT sẽ nhanh thế nào.
nên tôi viết "can you generate a graph to show the trend of funded account at treasury direct from Jan 2016 to Feb 2023?"
Để tôi cho bạn xem song song biểu đồ tự làm và ChatGPT tạo. Bên dưới là biểu đồ tôi tự tạo:
Nếu tôi nhớ đúng, mất hơn 5-10 phút để tạo biểu đồ này trước đây.
nhưng với ChatGPT, chỉ mất vài giây và đây là kết quả (với bonus 12-month rolling mean). Bạn tự phán xét phiên bản nào tốt hơn :P
Kết luận
Tôi choáng ngợp trước những gì ChatGPT với Code Interpreter có thể làm HIỆN TẠI cho phân tích dữ liệu và rất mong chờ những gì nó có thể làm trong tương lai, với những cải tiến hơn nữa :D
Tác vụ dữ liệu tẻ nhạt nhất bạn làm thường xuyên là gì? Bạn đã thử giao nó cho Code Interpreter chưa? Tôi tò mò liệu nó xử lý dữ liệu chuyên ngành của bạn có tốt như với dữ liệu của tôi không.
Thân mến,
Chandler
















