Translating Code for Human Consumption - Part II
Ashwin Pingali
Spearheading cutting-edge AI solutions for healthcare industry at Generative Inspired.
Introduction
In my previous article, we discussed how Generative AI can help CIO and CTO organizations make sense of their code and improve customer experiences and organizational reputation. As I promised, in this follow-up article, we will take a deeper dive into this topic by exploring the ways Generative AI can help understand the code. For the example code, I have chosen the Pandas library because many people who are familiar with Python would be familiar with the library and can evaluate the results of the Generative AI.
The Chosen Library: Pandas
Pandas is a popular Python library used for data manipulation and analysis. It provides several classes that allow for handling and manipulating data in various formats. We will take a look at three classes from the Pandas library: DataFrame, Series, and Panel.
DataFrame
class DataFrame(NDFrame):
??def __init__(self, data=None, index=None, columns=None, dtype=None, copy=False):
Series
class Series(NDFrame):
def __init__(self, data=None, index=None, dtype=None, name=None, copy=False, fastpath=False):
Panel
class Panel(NDFrame):
def __init__(self,data=None, items=None, major_axis=None, minor_axis=None, copy=False, dtype=None):
领英推荐
This is what the Generative AI explanation looks like
Explanation for Technical Audience:
The DataFrame class is a two-dimensional tabular data structure that can be initialized with various data formats such as a dictionary, a numpy ndarray, a Series, or an Index. It has several methods and attributes, such as reindexing, that allow for easy manipulation and analysis of data.
The Series class is a one-dimensional ndarray with axis labels, including time series. It has several methods and attributes that allow for manipulation of the data, such as reindexing, and statistical methods from ndarray have been overridden to automatically exclude missing data.
The Panel class is a three-dimensional size-mutable array that allows for handling and manipulating data in three dimensions. It has several methods and attributes that enable easy manipulation and analysis of data.
Summary for Executive Audience:
The Pandas library is a powerful tool for data manipulation and analysis. It provides several classes, such as DataFrame, Series, and Panel, that allow for handling and manipulating data in various formats. The DataFrame class is a two-dimensional tabular data structure, the Series class is a one-dimensional array with axis labels and the Panel class is a three-dimensional size-mutable array. These classes have several methods and attributes that allow for easy manipulation and analysis of data.
Conclusion:
In conclusion, Generative AI can be used to understand the code of popular libraries such as the Pandas library by providing explanations for technical audiences and summaries for non-technical audiences, making it more accessible to a wider audience. This can greatly improve customer experiences and enhance an organization's reputation. Furthermore, using Generative AI, one can convert these summaries into an audio file for Executive consumption, making it easy for them to understand the code base even if they are not technically inclined. While the example of the Pandas library is trivial, in reality, one can use this approach to understand internal code bases which may not be well commented. Generative AI can greatly help organizations manage the information overload of code and improve the overall understanding of their code base.
Lessons Learnt and Next steps
While the summaries and explanations were done by Chatgpt the code explanations were equally good when using the GPT3 using the API end points. To productize something like this, the next step is to build a data transformation pipeline. Since this can cost some resources and time, I would like to take feedback from the audience to see if there is anyone who is interested in sponsoring such a project and if so what would be the likely value for them in performing the task.