Home  >  Article  >  Technology peripherals  >  ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%

ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%

WBOY
WBOYforward
2023-04-14 08:58:021513browse

Now, AI newbies don’t even need to read tutorials, they can create models with just ChatGPT.

It not only helps you find data sets, train models and write code, but it can also evaluate accuracy and create programs in one step.

There is such a 25-year-old guy who asked ChatGPT to help him create a geographical location recognition program, with a final accuracy rate of up to 99.7%.

And all the details and steps are there, teaching you to learn while working.

ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%

This time, I was moved by ChatGPT.

What’s even more considerate is that after every question and answer, ChatGPT will say: If you have any questions, please tell me.

ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%

Specific implementation

At the beginning of the project, this guy made it clear: I don’t want to work hard anymore, can you help me create an AI program?

Take two coordinates as input and predict which country they are in.

ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%

ChatGPT "happily" accepted the challenge and reminded the guy that the corresponding data set is needed, otherwise the model cannot be trained. Also it would be better if there is more information.

First, you need to find a suitable data set.

The little brother asked ChatGPT again, and it turned out that it threw out three options for him to choose from without saying anything, including introduction links.

ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%

From the three data sets, the natural earth data set is obviously better, and it also has "boundary", coastline and other information, which means that it is necessary to provide the model with Explain the concept of "boundaries", separating labels. But as a newcomer, the first data set has more data related to the task and the model is easier to implement. The author finally chose the first data set.

After telling ChatGPT this decision, it will teach you how to create a DataFrame (data frame) and give you sample code.

ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%

After successful execution, we come to the second stage: model training. ChatGPT also gave a code without saying a word, and even attached a detailed explanation.

ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%

#This code will use k-NN algorithm to predict the country based on the given coordinates. The KNN algorithm is a simple algorithm that classifies an input based on the majority class of its k nearest neighbors.

In this example, the data is divided into training set and test set with a ratio of 80-20. The KNN classifier is then trained using the training set, and the accuracy of the model is tested using the test set.

Please keep in mind that this is a simple example and the accuracy of the model may not be high. You can try experimenting with different algorithms and different values ​​of k to see if you can improve the accuracy of your model.

After discarding some blank data (countries without coordinates), do k for the first time -NN training is successful and has an accuracy of 99.7%.

However, this result is not so satisfactory. The author attributes these reasons: uneven distribution of data between different countries; there are some data errors; bias and other issues.

This brings us to the third step: re-evaluation.

ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%

ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%

In this code, I use the OpenCage Geocoding API to get country information from coordinates. You need to replace YORBAPI_KEY with your API key to gain access to the API. You can register a free API key on the OpenCage website.

Following the instructions, the author modified the code, and the results showed that there were many NA errors, which was equivalent to only 30% of the data remaining. But the earth is indeed mostly water. (Nothing wrong, Doge)

The accuracy of the final model dropped a bit, reaching 98.6%, but the author was very satisfied with the result. After all, he helped create an AI model in only 7 dialogue rounds.

ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%

Also tried other algorithms

But this is not my first attempt. During the first conversation, he used a smaller dataset from the same source that required more dataset correction, and the first model training code provided by ChatGPT was a logistic regression with only 51% accuracy.

It then tried different "solvers" (accuracy was about 65%), as well as other algorithms, including random forests and k-NN, with accuracy rates of 93% and 92% respectively.

The 25-year-old works as a senior security researcher at SentinelOne, researching and developing malware detection logic.

Because he was very interested in machine learning, he started self-study and had a certain foundation. In this conversation, he actually talked to ChatGPT as a newbie, and was surprised by the powerful effect.

Finally, he also said that he was really considering calling ChatGPT as "they" instead of "it".

So AI newbies, start using ChatGPT quickly. (Doge)

Full conversation: https://sharegpt.com/c/7zLivmp

Reference link: https://xrl1.sh/posts/coordinates-model-with-ChatGPT/


The above is the detailed content of ChatGPT teaches you how to write an AI package, and write a recognition model for seven dialogues, with an accuracy of up to 99.7%. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:51cto.com. If there is any infringement, please contact admin@php.cn delete