Cover....1
Title Page....4
Copyright Page....5
Dedication....6
Contents....8
Preface....14
Chapter 1: ChatGPT and GPT-4....18
What is Generative AI?....18
Key Features of Generative AI....18
Popular Techniques in Generative AI....19
What Makes Generative AI Different....19
Conversational AI Versus Generative AI....20
Primary Objectives....20
Applications....20
Technologies Used....20
Training and Interaction....21
Evaluation....21
Data Requirements....21
Is DALL-E Part of Generative AI?....21
Are ChatGPT-3 and GPT-4 Part of Generative AI?....22
DeepMind....23
DeepMind and Games....23
Player of Games (PoG)....23
OpenAI....24
Cohere....25
Hugging Face....25
Hugging Face Libraries....25
Hugging Face Model Hub....25
AI21....26
InflectionAI....26
Anthropic....26
What is Prompt Engineering?....27
Prompts and Completions....27
Types of Prompts....28
Instruction Prompts....28
Reverse Prompts....28
System Prompts Versus Agent Prompts....29
Prompt Templates....29
Prompts for Different LLMs....30
Poorly Worded Prompts....31
What is ChatGPT?....32
ChatGPT: GPT-3 “on Steroids?”....33
ChatGPT: Google “Code Red”....33
ChatGPT Versus Google Search....34
ChatGPT Custom Instructions....34
ChatGPT on Mobile Devices and Browsers....35
ChatGPT and Prompts....35
GPTBot....35
ChatGPT Playground....36
ChatGPT and Medical Diagnosis....36
Plugins, Advanced Data Analysis, and Code Whisperer....37
Plugins....37
Advanced Data Analysis....38
Advanced Data Analysis Versus Claude 2....39
Code Whisperer....39
Detecting Generated Text....40
Concerns About ChatGPT....40
Code Generation and Dangerous Topics....41
ChatGPT Strengths and Weaknesses....41
Sample Queries and Responses from ChatGPT....42
Alternatives to ChatGPT....44
Google Bard....44
YouChat....45
Pi from Inflection....45
Machine Learning and ChatGPT: Advanced Data Analysis....45
What is InstructGPT?....46
VizGPT and Data Visualization....47
What is GPT-4?....48
GPT-4 and Test-Taking Scores....49
GPT-4 Parameters....49
GPT-4 Fine-Tuning....49
ChatGPT and GPT-4 Competitors....50
Bard....50
CoPilot (OpenAI/Microsoft)....51
Codex (OpenAI)....52
Apple GPT....52
PaLM-2....52
Med-PaLM M....52
Claude 2....53
LlaMa-2....53
How to Download LlaMa-2....53
LlaMa-2 Architecture Features....54
Fine-Tuning LlaMa-2....54
When is GPT-5 Available?....55
Summary....56
Chapter 2: ChatGPT and Python....58
Simple Calculator....59
Simple File Handling....60
Simple Web Scraping....60
Basic Chatbot....61
Basic Data Visualization....62
Basic Pandas....63
Generate Random Data....64
Recursion: Fibonacci Numbers....65
Object Oriented Programming....66
Asynchronous Programming with asyncio....66
Working with Requests in Python....70
Image Processing with PIL....71
Exception Handling....74
Generators in Python....74
Roll 7 or 11 with Two Dice....75
Roll 7 or 11 with Three Dice....76
Roll 7 or 11 with Four Dice....78
Mean and Standard Deviation....79
Summary....79
Chapter 3: ChatGPT and Data Visualization....82
Working with Charts and Graphs....82
Bar Charts....83
Pie Charts....83
Line Graphs....84
Heat Maps....84
Histograms....84
Box Plots....85
Pareto Charts....85
Radar Charts....85
Treemaps....86
Waterfall Charts....86
Line Plots with Matplotlib....86
A Pie Chart Using Matplotlib....87
Box-and-Whisker Plots using Matplotlib....88
Time Series Visualization with Matplotlib....89
Stacked Bar Charts with Matplotlib....90
Donut Charts Using Matplotlib....92
3D Surface Plots with Matplotlib....92
Radial or Spider Charts with Matplotlib....94
Matplotlib’s Contour Plots....96
Stream Plots for Vector Fields....97
Quiver Plots for Vector Fields....99
Polar Plots....100
Bar Charts with Seaborn....100
Scatter Plots with Regression Lines Using Seaborn....101
Heatmaps for a Correlation Matrix with Seaborn....102
Histograms with Seaborn....103
Violin Plots with Seaborn....104
Pair Plots Using Seaborn....105
Facet Grids with Seaborn....106
Hierarchical Clustering....107
Swarm Plots....108
Joint Plots for Bivariate Data....109
Point Plots for Factorized Views....110
Seaborn’s KDE Plots for Density Estimations....111
Seaborn’s Ridge Plots....112
Summary....113
Chapter 4: Linear Regression With GPT-4....114
What is Linear Regression?....115
Examples of Linear Regression....115
Metrics for Linear Regression....116
Coefficient of Determination (R2)....117
Linear Regression with Random Data with GPT-4....118
Linear Regression with a Dataset with GPT-4....121
Describe the Features of the death.csv Dataset....122
The Preparation Process of the Dataset....124
The Exploratory Analysis....126
Detailed EDA on the death.csv Dataset....127
Bivariate and Multivariate Analyses....130
The Model Selection Process....132
Code for Linear Regression with the death.csv Dataset....134
Describe the Model Diagnostics....136
Additional Model Diagnostics....138
More Recommendations from GPT-4....139
Summary....141
Chapter 5: Visualization with Generative AI....142
Generative AI and Art and Copyrights....143
Generative AI and GANs....143
GANs (Generative Adversarial Networks)....144
What is Diffusion?....144
Diffusion Image Sample....145
Diffusion Models Versus GANs....146
What are Diffusers and DDPMs?....146
CLIP (OpenAI)....147
GLIDE (OpenAI)....148
Text-to-Image Generation....148
Stability AI/Stable Diffusion....149
Imagen (Google)....150
Make-a-Scene (Meta)....150
Diffuse the Rest....150
GauGAN2 (NVIDIA)....152
PromptBase....152
Limitations of Text-to-Image Models....152
Text-to-Image Models....152
The DALL-E Models....154
DALL-E....154
DALL-E 3....154
Paid Accounts for DALL-E....155
Invoking the DALL-E API....156
DALL-E 2....159
DALL-E 2 Overview....159
The DALL-E 2 Model....160
DALL-E 2 Content Preparation....161
DALL-E-Bot....161
DALL-E Demos....162
Text-to-Video Generation....163
Meta (Make-a-Video)....163
Imagen Text-to-Video....163
Ruben Villegas and Google (Phenaki)....164
Text-to-Speech Generation....164
Whisper (OpenAI)....165
Summary....165
Index....166
This resource is designed to bridge the gap between theoretical understanding and practical application, making it a useful tool for software developers, data scientists, AI researchers, and tech enthusiasts interested in harnessing the power of GPT-4 in Python environments. The book contains an assortment of Python 3.x code samples that were generated by ChatGPT and GPT-4. Chapter 1 provides an overview of ChatGPT and GPT-4, followed by a chapter which contains Python 3.x code samples for solving various programming tasks in Python. Chapter 3 contains code samples for data visualization, and Chapter 4 contains code samples for linear regression. The final chapter covers visualization with Gen AI (Generative AI) and DALL-E. Companion files with source code and figures are available for downloading.