Chat GPT has become a trend because it can solve many complex issues, even creating your own scripts.
I was planning to do a story showing how to build a stock price prediction system, but since I wanted to test Chat GPT I wanted to see how good it is.
Will it be able to replace a person in the future? Let’s see the results.
Generated script
To the question “How to create a Python script that makes a prediction about the future price of a stock” and then asking for an example of the script, I got the following script:
# Import the required libraries
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
# Upload historical share price data
data = pd.read_csv("historical_stock_prices.csv")
# Select the columns of interest
X = data[['precio_maximo', 'precio_minimo', 'volumen']]
y = data['precio_cierre']
# Split the data into training and test sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
# Creating and training the linear regression model
model = LinearRegression()
model.fit(X_train, y_train)
# Making predictions with the test set
predictions = model.predict(X_test)
# Calculate the error of predictions
error = mean_absolute_error(y_test, predictions)
# Show error…