Posts

Showing posts from September, 2023

Programming With ChatGPT Part 2

Image
  Image generated by OpenAI In a previous post , I described my experiments using Bing/ChatGPT for programming. This time, I want to try some simpler tasks to see how ChatGPT handles them. In the previous post, ChatGPT generated the following Python code. I wrapped the generated code in a function. import numpy as np import pandas as pd import matplotlib.pyplot as plt def main (): out_file = '/mnt/d/Documents/analytic_garden/cp_pytorch/data/ts_chatgpt.csv' # Define the number of data points n = 1000 # Define the means and variances for each region means = [ 1 , 5 , 2 ] variances = [ 1 , 1 , 1 ] # Generate the time series ts = np . zeros(n) for i in range (n): if i < n // 3 : ts[i] = np . random . normal(means[ 0 ], variances[ 0 ]) elif i < 2 * n // 3 : ts[i] = np . random . normal(means[ 1 ], variances[ 1 ]) else : ts[i] = np . random . normal(means[ 2...

Programming With ChatGPT

Image
You may have read stories like this on Reddit or other sites: "Two weeks ago I couldn't program at all, now, thanks to ChatGPT , I'm a senior software engineer at Google." That is a bit of an exaggeration, but sites like r/ChatGPT  often contain quite a bit of AI hype. I was recently working on using PyTorch to detect change points in time series sequences.  I have written about change point detection before: here , here , here , and here . There are numerous methods for detecting regions of change in series data depending on the characteristics of the data. I was interested to see what ChatGPT could contribute. Change point detection algorithms are traditionally classified as online or offline. Offline methods have the entire data sequence available. Online algorithms process each data point as it arrives. I'm interested in offline change point detection. This paper gives a good overview of some of the common detection methods. Generating Data My first step wa...