Discover more from Data Science is not Rocket Science
How AI tools helped me create this data science post
For this post, I am testing three new out-of-the box AI tools that will help me easily and quickly put together a complete data science post for my publication.
The first tool I'll introduce is DALL·E 2 from OpenAI. This new AI system can create photorealistic images and artwork by simply reading a description given in natural language.
So far, I've used this tool to create all illustrations for my Substack posts, including this one.
With this tool, you can create art by simply typing a description of the image you want to generate. For example, for the illustration in this article, I typed out the following:
“Three robots, one drawing a painting, one writing on a notepad, and one playing with dice”
The tool produced these four image options from my prompt:
While I liked the third option best, it had a few issues. The drawing included four robots instead of three. Additionally, none of them appeared to be playing with dice, and it wasn't evident which robot was writing and which one was drawing.
The tool also includes an editing function that allows you to delete certain parts of any illustrations and change the prompt. This generate 4 more options based on your edits.
I deleted the following from my favorite illustration:
And modified the description to say:
“A robot writing in the bottom left, a robot painting on the bottom right, and a robot rolling dice in the back”
The following 4 options were generated by the tool:
The tool’s third option was my favorite, even though it added back a fourth robot. At least the two robots in the back are now clearly playing with dice, and with the two robots in the front it is now clear which one is writing and which one is painting. I ended up using this as the illustration for this post.
The second tool on my list is GitHub Copilot. It's a fantastic time-saver that allows you to code in multiple programming languages, including Python, by simply using natural language prompts.
In a post on my publication about the probability of earthquakes in Mexico, I used some basic python code to run simulations in order to answer the question posed by the article. For this new post, I want to use GitHub copilot to write the python code. This tool will automatically translate my English language instructions into working python code.
I started by creating an empty file called “simulation.py” and typed the following comments:
# sample 64 days from 1 to 365
# and assess if any day was sampled three or more times
# if so, return true
# If not, return false
As soon as I hit Enter, the tool suggested to add the following Python code to the file:
days = np.random.choice(np.arange(1, 366), size=64, replace=True)
return np.any(np.bincount(days) >= 3)
I was impressed by this tool and accepted the recommended code, but I didn't know that it was just getting started. When I pressed enter again after the tool generated its code, it automatically suggested adding these new comments:
# Path: main.py
# run simulation 10000 times
# and calculate the probability
# that at least one day was sampled three or more times
The comments impressed me as they were exactly what I wanted my program to do next--I didn't even have to write them. The tool even accurately guessed that I wanted to run the simulation ten thousand times. It was quite spooky.
I hit enter, and the tool immediately created the rest of the code it required from its own comments.
simulations = [simulation() for _ in range(10000)]
if __name__ == '__main__':
Running that code produced the same results as my original code, except it was quicker to write and neater. All I did was type a few short comments and then press enter repeatedly to accept all the recommendations--the whole process only took me less than 2 minutes.
In addition to the aforementioned tools, I'm also using Jasper to help create this post. For those who don't know, Jasper is a high quality AI copywriting tool that eliminates creative blocks so you can write original content faster.
I hastily typed this article into their tool and the results were a much better quality text. In fact, all of the text you've read in this post has been edited or rewritten by the tool.
For example, here is the original text for this last paragraph that the tool completely rewrote:
"The last tool I’m using to produce this post is called Jasper. Jasper is a high quality AI copywriting tool that helps break through creative blocks to create amazing, original content faster. The text for this article I quickly and carelessly typed into their tool and got the tool to edit and rewrite the text in much better shape. All the text you’ve read so far for this post was edited and sometimes fully rewritten by the tool"
In less than two hours, I learned how to use three different tools and produce the content for this post. It's fascinating that we've reached a point in AI technology where very good but not perfect vision and language models can be leveraged by tools that help people complete their tasks much faster and efficiently.