# ChatGPT: Can we call this Artificial Intelligence instead of Machine Learning ?

With the release of ChatGPT Dec 15 Version by OpenAI, we have taken another step closer to creating a general artificial intelligence machine.

While many machine learning methods and systems are designed to solve specific tasks, such as image recognition, predicting event outcomes based on past data, or predicting stock prices, ChatGPT is capable of tackling a wide range of problems, including writing academic essays, poems, and Python scripts or functions for specific purposes.

This makes ChatGPT more akin to an artificial intelligence rather than simply a machine learning system. Photo: A little girl, making friends with a robot in Japan, taken by Andy Kelly. Used here under the Unsplash License

Let’s test some functions of ChatGPT. Firtsly, I asked ChatGPT: ’Can you explain what ChatGPT is ?’ and the answer from ChatGPT was:

`ChatGPT is a language model developed by OpenAI that is capable of generating human-like text. It uses machine learning techniques to predict the next word in a sequence based on patterns learned from a large dataset of human-generated text. ChatGPT is versatile, able to perform tasks such as conversation, translation, summarization, and text generation. It is also capable of generating text in a variety of styles and tones, making it suitable for use in chatbots, language translation, content generation, and creative writing applications. ChatGPT represents an important step towards the development of general artificial intelligence, and has the potential to transform how we use machines to solve complex tasks.`

Secondly, I asked it to write a Python function to accurately calculate pi and include docstrings. And the answer was:

`def calculate_pi(precision: int) -> float:    """    Calculate the value of pi to a high degree of precision using the Bailey-Borwein-Plouffe formula.        Args:    - precision: The number of decimal places of precision to calculate pi to.        Returns:    - A float representing the value of pi to the specified precision.        Examples:    - calculate_pi(10) -> 3.1415926536    - calculate_pi(100) -> 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233785303861        """    pi = 0    k = 0    while True:        pi += (1/16**k) * ((4/(8*k + 1)) - (2/(8*k + 4)) - (1/(8*k + 5)) - (1/(8*k + 6)))        k += 1        if precision == 0:            return pi        if len(str(pi)[2:]) >= precision:            return round(pi, precision)`

You can see in the codes above even it explained the algorithm and provided example calculations.

The next question was more challenging: ‘Can you write a C++ class to read data from IoT sensors and store the data in a text file ?’ And its answer was:

`#include <iostream>#include <fstream>#include <string>class SensorDataLogger {public:  // Constructor  SensorDataLogger(std::string filename) : filename_(filename) {}  // Method to read data from an IoT sensor  std::string ReadSensorData() {    // Replace this with code to read data from an IoT sensor    return "Sensor data";  }  // Method to write data to a text file  void WriteDataToFile(std::string data) {    std::ofstream outfile(filename_, std::ios_base::app);    outfile << data << std::endl;    outfile.close();  }private:  std::string filename_;};int main() {  // Create a SensorDataLogger object with a file named "sensor_data.txt"  SensorDataLogger logger("sensor_data.txt");  // Read data from an IoT sensor and write it to the text file  std::string sensor_data = logger.ReadSensorData();  logger.WriteDataToFile(sensor_data);  return 0;}`

It is amazing, I have not tested if the codes properly work, but these are perfectly explained and written codes. And the last question was ‘Can you write a CNN model in Python ?’ and the answer was:

`# Certainly! Here is a simple example of a Convolutional Neural # Network (CNN) model implemented in Python using the popular # deep learning library Keras:from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Densefrom tensorflow.keras.models import Sequential# Define the model architecturemodel = Sequential()# Add convolutional layersmodel.add(Conv2D(32, kernel_size=(3, 3), activation='relu', input_shape=(28, 28, 1)))model.add(Conv2D(64, kernel_size=(3, 3), activation='relu'))# Add max pooling layermodel.add(MaxPooling2D(pool_size=(2, 2)))# Flatten the data for the fully connected layermodel.add(Flatten())# Add a fully connected layermodel.add(Dense(128, activation='relu'))# Add the output layermodel.add(Dense(10, activation='softmax'))# Compile the modelmodel.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])`

Well done, OpenAI. This a great step towards general Artificial Intelligence models.

I will keep exploring ChatGPT and its fascinating features and answers. Cheers !