ChatGPT assessing code it generated and making it better and more real-world!

ChatGPT assessing code it generated and making it better and more real-world!

#ChatGPT the AI that keeps giving amazement.

Ok, so I asked ChatGPT for this:

Prompt: "Create a simple python program to create a consumption model for consuming paper goods."

ChatGPT:

Here's a simple Python program that uses a decision tree to predict future consumption of paper goods:

No alt text provided for this image
This program loads the data from a CSV file called "paper_goods_data.csv", which should contain information on consumption of paper goods. The data should include columns for day of the week, time of day, price and quantity consumed. The features are day of the week, time of day and price, and the target variable is the quantity consumed. The program then split the data into training and test set using train_test_split and then creates a decision tree model, which is trained on the training data using the fit method. The program then makes predictions on the test set using the predict method, and finally it prints the accuracy of the model using score method. Please keep in mind that this is a simple example, and in practice, you would likely need to do more preprocessing and feature engineering, try different models, perform cross-validation, and fine-tune the hyperparameters to get the best performance. Also, this program doesn't cover how to handle missing or categorical data, which is very important as well.

I saw that is referenced paper_goods_data.csv. So I asked it:

Prompt: "Generate sample data for paper_goods_data.csv"

ChatGPT:

No alt text provided for this image

I asked it to add date, so it did.

Then I asked it to update the code to reflect the new CSV and it did.

Then I asked it to have the data span between 1-3 weeks and it did.

I tried to run the code but, it had errors. So I pasted it back into ChatGPT.

Me: "What's wrong with this code...."

No alt text provided for this image

It just assessed it's own generated code and said it's kinda a toy (my words) and it "requires more work"

So of course I said:

Prompt: "Can you make it better"

GPT:

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Can you believe this?

I put it in PyCharm and ran it and here you go. Ran first try:


No alt text provided for this image

Best 1.0 version of any software I've seen. And will revolutionize.

Peter Erickson

Founder @ Modev | Independent Conferences | Meaningful Connections

1 年

Great example, John. I saw a quote somewhere that people won't lose jobs to AI, they'll lose jobs to people leveraging AI. This is a perfect example.

回复

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

社区洞察

其他会员也浏览了