#### Discover more from Buy the Rumor; Sell the News

I wrote, of ChatGPT, on Facebook, somewhat pretentiously:

Thesis: ChatGPT enables iterative epistemological feedback loops. Example: I asked it to write a Python script for calculating linear regressions. Then I asked it to modify the script such that a user is prompted to enter values for x and y. I don’t know Python well enough to determine if there are erorrs or if the code is not optimal, but…

What I mean in plainer English is that ChatGPT seems to enable faster, iterative learning. And this is something that is worth looking at in greater detail. Take a prompt, such as that above: calculating linear regressions. ChatGPT’s output is:

```
# import the necessary libraries
import numpy as np
# define the function that calculates the linear regression
def linear_regression(x, y):
# calculate the mean of x and y
x_mean = np.mean(x)
y_mean = np.mean(y)
# calculate the numerator and denominator for the slope
numerator = 0
denominator = 0
for i in range(len(x)):
numerator += (x[i] - x_mean) * (y[i] - y_mean)
denominator += (x[i] - x_mean) ** 2
# calculate the slope and intercept
slope = numerator / denominator
intercept = y_mean - slope * x_mean
return slope, intercept
# main function
def main():
# get the x and y values from the user
x = []
y = []
num_values = int(input("Enter the number of x and y values: "))
for i in range(num_values):
x_val = float(input("Enter the value of x: "))
y_val = float(input("Enter the value of y: "))
x.append(x_val)
y.append(y_val)
# calculate the linear regression
slope, intercept = linear_regression(x, y)
print("Slope:", slope)
print("Intercept:", intercept)
# call the main function
if __name__ == "__main__":
main()
```

Does this work? I’ve no clue. It has the right terminology—slope, intercept, etc. Sure sounds like linear regression. But I can dump the code in Replit, run it, and see if it throws any errors. This is what I get:

No errors. Amazing. Granted, linear regressions are relatively simple. But now I have information that I can use to compound my knowledge of Python. This is what a working script looks like. Sure, there’s a lot of syntax here to learn.

Which gives me an idea. I don’t know what `def main():`

means. Back to ChatGPT. Here’s my prompt and its response:

This is rather helpful: an infinitely scalable tutor to whom I can ask all kinds of questions. What if I want to save the output of the linear regression calculation to Excel?

Here’s where it gets really interesting. Consider my prompt:

`Thanks. Can you modify the script so that the calculation, and x and y values are saved to an Excel file? Call the file Python_Linear_regression_output.xlsx`

Now consider its response. Note that the actual Python code in the below window appears between a series of asterisks. The text above and below the asterisks in the window below are introductory and concluding text that ChatGPT provided to provide some context for the code it wrote.

```
Certainly! Here is a modified version of the script that saves the x and y values, as well as the slope and intercept of the linear regression, to an Excel file called "Python_Linear_regression_output.xlsx":
*******
# import the necessary libraries
import numpy as np
import openpyxl
# define the function that calculates the linear regression
def linear_regression(x, y):
# calculate the mean of x and y
x_mean = np.mean(x)
y_mean = np.mean(y)
# calculate the numerator and denominator for the slope
numerator = 0
denominator = 0
for i in range(len(x)):
numerator += (x[i] - x_mean) * (y[i] - y_mean)
denominator += (x[i] - x_mean) ** 2
# calculate the slope and intercept
slope = numerator / denominator
intercept = y_mean - slope * x_mean
return slope, intercept
# main function
def main():
# create a new Excel workbook
wb = openpyxl.Workbook()
sheet = wb.active
# get the x and y values from the user
x = []
y = []
num_values = int(input("Enter the number of x and y values: "))
for i in range(num_values):
x_val = float(input("Enter the value of x: "))
y_val = float(input("Enter the value of y: "))
x.append(x_val)
y.append(y_val)
# write the x and y values to the Excel sheet
sheet.append(["x", "y"])
for i in range(len(x)):
sheet.append([x[i], y[i]])
# calculate the linear regression
slope, intercept = linear_regression(x, y)
# write the slope and intercept to the Excel sheet
sheet.append(["Slope", "Intercept"])
sheet.append([slope, intercept])
# save the Excel workbook
wb.save("Python_Linear_regression_output.xlsx")
# call the main function
if __name__ == "__main__":
main()
*******
This script imports the openpyxl library, which is used to create and manipulate Excel files. The script creates a new Excel workbook, gets the x and y values from the user, writes the x and y values to the sheet, calculates the linear regression using the linear_regression function, writes the slope and intercept to the sheet, and then saves the workbook to a file called "Python_Linear_regression_output.xlsx".
To use this script, simply run it and follow the prompts to input the x and y values. The script will then save the x and y values, as well as the slope and intercept of the linear regression, to an Excel file called "Python_Linear_regression_output.xlsx".
```

ChatGPT understood my prompt, correctly, to mean, that I wanted the script to save the slope, intercept, and x and y values to Excel. Note that I merely said “calculation” in the response. It further understood that when I wrote the desired filename of `Python_Linear_regression_output.xlsx`

, that a second `.xlsx`

was not necessary. Try doing that with some filename systems and you’d get `Python_Linear_regression_output.xlsx.xlsx`

. On the other hand, it didn’t catch that I capitalized “Linear” for no reason. To be fair, neither did I until I started to write this paragraph. Garbage in, garbage out.

**Cool. Where does this leave us?**

It’s pretty clear to me that ChatGPT enables quick, iterative learning for a wide variety of topics. I know that a common (and valid!) criticism of ChatGPT is that it confidently makes mistakes. And this is true. On the other hand, it also seems to be improving over time. It seems safe to assume that the rough edges will smooth out over time, and that ChatGPT (or its successor(s)) will be a powerful, and infinitely scalable, second brain for knowledge workers.

In a somewhat speculative post on LessWrong, Marius Hobbhahn writes:

Different demographics take the fast automation of labor very differently. Many young people quickly adapt their lives and careers and enjoy many of the benefits of automated labor. People who are highly specialzied and have a lot of work experience often find it hard to adapt to new circumstances. The jobs that gave them status, meaning and a high income can suddenly be performed by machines with simple instructions. Automation is happening at an unprecedented pace and it becomes harder and harder to choose stable career trajectories. People invest many years of their life to become a specialist in a field just to be replaced by a machien right before they enter the job market. This means people have to switch between jobs and re-educate all the time.

There is a large rift in society between people who use AI-driven tech and those who don’t. This is equivalent to most young people in 2022 seamlessly using Google and the Internet to answer their questions while a grandpa might call their children for every question rather than using “this new technology.” This difference is much bigger now. AI-powered technology has become so good that people who use it are effectively gods among men (and women and other genders) compared to their counterparts who don’t use the tech. Those that know how to use ML models are able to create new books, symphonies, poems and decent scientific articles in minutes. Furthermore, they are drastically more productive members of the workforce because they know how to outsource the majority of their work to AI systems. This has direct consequences on their salaries and leads to large income inequality. From the standpoint of an employer, it just makes more sense to pay one person who is able to tickle Ai models the right way $10K/h than pay 100 human subject-matter experts $100/h each.

As I say, this is a speculative post, about the future powered by pervasive AIs. But to the extent that rapid iteration on concepts, and rapid output of work, in the future look like what we can do with ChatGPT * today*, it doesn’t seem that speculative! Here in 2022, we have the seeds of a more productive future, in which people are able to rapidly synthesize vast amounts of information, by outsourcing some of that cognitive load to artificial intelligence(s).

Those who can learn to leverage this cognitive complement will flourish. The linear regression example I provide above is a relatively simple and contrived demonstration of this iterative learning. Nonetheless, it portends rather remarkable things in the years and decades ahead.