Democratising coding ? A tete-a-tete with ChatGPT !
Image generated using DALL-E

Democratising coding ? A tete-a-tete with ChatGPT !

Unless you have been living in a remote island in the middle of an ocean or a cave in the deepest crevices of the earth, you would have come across the now ubiquitous term : ChatGPT. I have been using ChatGPT for various purposes and it certainly has blown me away. Almost 50% of my google searches have now moved on to ChatGPT. Even managed to create a shortcut on my phone !

Happened to read this article and I thought of trying something I had done years ago the old fashioned way. My apartment has a IOT based water meter where we get readings (down to the hour) of water usage. Under the guise of collecting metrics related to water consumption in my flat, I decided to learn python for data aggregation, processing and visualisation. Took me a few days to learn, install python on my laptop, code to get the output I desired. By no means an expert programmer, I had to wade through multiple forums to debug the errors I received during this short, frustrating but fulfilling journey. Now this was years back and not having a chance (or possibly an inclination) to dabble in python, I conveniently forgot the nuances of coding till I chanced upon the above article. With all the hullabaloo around ChatGPT, I tried to figure out if it can help a layman ( with some basic knowledge of programming) analyse and write a code to give the desired output.

To save time in installation and the works, used Google Colaboratory as the playground for this small experiment. I get the water consumption data monthly in a spreadsheet with day wise columns..something like this

No alt text provided for this image
Monthly water consumption data


Fired up ChatGPT and typed in the prompt

write a python code to analyse my weekly water consumption in a spreadsheet

A simple code was generated. I tried further

for the above example I have a spreadsheet with each day as a column and two rows with first row containing headers and second row containing water consumption. Please change the code accordingly

Sure enough, ChatGPT spit out a neat code with comments explaining each step. I copied the code into the environment and ran it. The generated errors ( mostly due to my ignorance and my belief that even a machine cannot write code right the first time ;)) were copied back to ChatGPT. I got the root cause and the corrected code in the blink of an eye. Within a few minutes of changing, correcting the code and a few more prompts for data conversion, I got the output dataset looking something like this.

No alt text provided for this image
Output

Satisfied with the result, I made one more request

write a python code to predict my water consumption using the dataset generated above

Yet another code piece utilising linear regression model with a caveat "Note that in this example, we use a simple linear regression model to predict water consumption based on the date. Depending on the characteristics of your data, you may need to use a more sophisticated model or include additional features to obtain accurate predictions."

Fair enough but for what I sought to accomplish, this was more than enough. After a few more prompts for help with collating data across 6 months, I was able to

  • generate metrics regarding my usage: Daily/Monthly/Mean/Max Consumptions et
  • graphs for the above
  • and a prediction for my usage in March (taken with a pinch of salt ! )

It was remarkable that

  • It was as if I was chatting with a human expert as it was able to understand the context with prompts like "in the above code", "from the above dataset" and suggest solutions
  • Could finish this in a matter of hours.

Though this is a very simple example, the fact that I could seek ChatGPT's help in finding a technical solution will go a long way in simplifying things for users not inclined to writing code afresh .The possibilities of using ChatGPT as an aid to programmers for complex use cases are endless. It could help

  • translate code from one platform to another
  • analyse code and propose alternatives
  • provide code snippets
  • in training
  • debugging code and many more...

Apart from programming, everyday brings in news about its acceptance in other areas (here, here)

Just like the cloud adoption boom in 2020, will 2023 be the 'Year of the Intelligent Bot'

要查看或添加评论,请登录

社区洞察

其他会员也浏览了