Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
AI-Assisted Programming for Web and Machine Learning
AI-Assisted Programming for Web and Machine Learning

AI-Assisted Programming for Web and Machine Learning: Improve your development workflow with ChatGPT and GitHub Copilot

Arrow left icon
Profile Icon Christoffer Noring Profile Icon Anjali Jain Profile Icon Marina Fernandez Profile Icon Ayşe Mutlu Profile Icon Ajit Jaokar +1 more Show less
Arrow right icon
€8.98 €28.99
eBook Aug 2024 602 pages 1st Edition
eBook
€8.98 €28.99
Paperback
€35.99
Subscription
Free Trial
Arrow left icon
Profile Icon Christoffer Noring Profile Icon Anjali Jain Profile Icon Marina Fernandez Profile Icon Ayşe Mutlu Profile Icon Ajit Jaokar +1 more Show less
Arrow right icon
€8.98 €28.99
eBook Aug 2024 602 pages 1st Edition
eBook
€8.98 €28.99
Paperback
€35.99
Subscription
Free Trial
eBook
€8.98 €28.99
Paperback
€35.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

AI-Assisted Programming for Web and Machine Learning

Introduction

In the previous chapter, we gave some historical context to how AI has developed over the years, how we’ve gone from natural language processing (NLP) to large language models (LLMs), and how the latter serves as the underlying machine learning model in AI assistants. To use these AI assistants, you use natural language prompts as input. However, to ensure you “prompt” in an efficient way, so that you get what you want, it’s important to have a strategy, and that’s what this chapter aims to give you.

How to “prompt” efficiently is commonly known in the industry as a “prompt strategy” or “prompt engineering.” It’s not an engineering practice in the common sense of the word but rather an art form where practitioners of AI assistants have discovered patterns and practices that seem to work well. We, the authors of this book, are building upon those discovered practices and aim to describe...

Where you are

As a reader and a practitioner of data science and/or full-stack web development, you know your craft. Knowing your craft means you know the tools and techniques to solve problems. At this point, you’re looking at an AI assistant and realize it’s controlled by natural language, so-called prompts. What you may not realize is that there’s more to it than just writing a prompt and getting an answer. An AI assistant is trained on a large corpus of text, so it’s quite flexible on what it can generate text on and how to respond to prompts. Because of this flexibility, it’s important to understand how to write prompts that are effective and efficient.

Guidelines for how to prompt efficiently

Prompts are input to AI tools. Depending on what you’re trying to achieve, you need to adjust your prompts for the scenario you’re solving for. Therefore, how you “prompt” matters. For example, if your prompt is too vague, you won’t get what you need. Or, let’s say you’re trying to use a prompt to generate company slogans; you don’t want to use the same prompt for generating code for an app. Conversely, in a discipline like data science, it’s important you perform tasks in a certain order and your prompt should reflect what you want done and, if needed, the steps to do so.

What you need to succeed is an approach, a strategy, that you can use in general to be efficient with AI assistants. Additionally, such a strategy should be specific enough to present “best practices” for chosen problem domains. As mentioned earlier in this chapter, we’ve developed a prompt...

Prompt strategy for web development

Let’s apply the different guidelines presented in the former section, and through using these guidelines, we will step by step work ourselves toward a prompt strategy.

Break down the problem: “web system for inventory management”

Let’s use a real example, “inventory management” within web development, to see if we can understand the general problem. To “manage” an inventory, you need to read and write data to it. Most likely, you will have different roles in this system/app, everything from administrators to normal users. You might also need to consider how this system fits in with other systems, should you, for example, integrate it with other systems, what parts it consists of in that case and how.

The domain seems pretty straightforward so let’s move on to understand what parts it consists of.

At a high level, we understand what the system should do. But to solve...

Prompt strategy for data science

Let’s do a similar thought experiment for data science as we did for web development. We’ll use the presented guidelines “problem breakdown” and “generate prompts,” and just like in the web development section, we’ll draw some general conclusions on the domain and present those as a prompt strategy for data science.

Problem breakdown: predict sales

Let’s say we’re building a machine-learning model to predict sales. At a high level, we understand what the system should do. To solve the problem though, we need to divide it into smaller parts, which in data science usually entails the following components:

  • Data: The data is the part of the system that stores information. The data can come from many places like databases, web endpoints, static files, and more.
  • Model: The model is responsible for learning from the data and producing a prediction that’s as accurate...

Validate the solution

The most important part of this strategy is verifying correctness and that the text and code created by the AI assistant are correct. There are two general approaches we can take to verify our outcome:

  • Verification via prompts: The first approach is to use prompts to verify the outcome. This means writing prompts that question the outcome of specific results. This can be a good strategy to employ at the beginning of your verification process. What you’re looking for are situations where the AI assistant isn’t consistent in its responses.
  • Classical verifications: The second approach is to use classical verification techniques. What those techniques are varies depending on the problem domain. At a high level, though, it boils down to testing code, comparing output, and relying on your own knowledge, and the knowledge of your peers, to verify the outcome.

The AI tool doesn’t really know what it’s doing. The...

Summary

Throughout this chapter, we’ve provided a strategy for solving problems with prompts and validating the solution.

You’ve seen how both web development and data science can be broken down into smaller parts that can be solved with prompts. We also identified some basic principles for writing prompts.

Finally, we looked at how to validate the solution using prompts and classical verification techniques.

It’s our hope that you will revisit this chapter when you’re looking at solving a problem within web development or data science and you’re looking for an approach.

There’s more to prompting than writing a prompt and getting a response. You will see throughout this book how we use these principles in various domains to solve problems. Try typing these prompts as you read, adapt to your own needs, and see what happens.

In the next chapter, we are going to learn more about the two AI assistants of our choice, GitHub...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Utilize prompts to enhance frontend and backend web development
  • Develop prompt strategies to build robust machine learning models
  • Use GitHub Copilot for data exploration, maintaining existing code bases, and augmenting ML models into web applications

Description

AI-Assisted Programming for Web and Machine Learning shows you how to build applications and machine learning models and automate repetitive tasks. Part 1 focuses on coding, from building a user interface to the backend. You’ll use prompts to create the appearance of an app using HTML, styling with CSS, adding behavior with JavaScript, and working with multiple viewports. Next, you’ll build a web API with Python and Flask and refactor the code to improve code readability. Part 1 ends with using GitHub Copilot to improve the maintainability and performance of existing code. Part 2 provides a prompting toolkit for data science from data checking (inspecting data and creating distribution graphs and correlation matrices) to building and optimizing a neural network. You’ll use different prompt strategies for data preprocessing, feature engineering, model selection, training, hyperparameter optimization, and model evaluation for various machine learning models and use cases. The book closes with chapters on advanced techniques on GitHub Copilot and software agents. There are tips on code generation, debugging, and troubleshooting code. You’ll see how simpler and AI-powered agents work and discover tool calling.

Who is this book for?

Experienced developers new to GitHub Copilot and ChatGPT can discover the best strategies to improve productivity and deliver projects quicker than traditional methods. This book is ideal for software engineers working on web or machine learning projects. It is also a useful resource for web developers, data scientists, and analysts who want to improve their efficiency with the help of prompting. This book does not teach web development or how different machine learning models work.

What you will learn

  • Speed up your coding and machine learning workflows with GitHub Copilot and ChatGPT
  • Use an AI-assisted approach across the development lifecycle 
  • Implement prompt engineering techniques in the data science lifecycle
  • Develop the frontend and backend of a web application with AI assistance 
  • Build machine learning models with GitHub Copilot and ChatGPT 
  • Refactor code and fix faults for better efficiency and readability 
  • Improve your codebase with rich documentation and enhanced workflows 

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 30, 2024
Length: 602 pages
Edition : 1st
Language : English
ISBN-13 : 9781835083895
Vendor :
OpenAI
Category :
Languages :
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Aug 30, 2024
Length: 602 pages
Edition : 1st
Language : English
ISBN-13 : 9781835083895
Vendor :
OpenAI
Category :
Languages :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 107.97
AI-Assisted Programming for Web and Machine Learning
€35.99
Python Feature Engineering Cookbook
€33.99
Generative AI Application Integration Patterns
€37.99
Total Mex$ 107.97 Stars icon

Table of Contents

24 Chapters
It’s a New World, One with AI Assistants, and You’re Invited Chevron down icon Chevron up icon
Prompt Strategy Chevron down icon Chevron up icon
Tools of the Trade: Introducing Our AI Assistants Chevron down icon Chevron up icon
Build the Appearance of Our App with HTML and Copilot Chevron down icon Chevron up icon
Style the App with CSS and Copilot Chevron down icon Chevron up icon
Add Behavior with JavaScript Chevron down icon Chevron up icon
Support Multiple Viewports Using Responsive Web Layouts Chevron down icon Chevron up icon
Build a Backend with Web APIs Chevron down icon Chevron up icon
Augment Web Apps with AI Services Chevron down icon Chevron up icon
Maintaining Existing Codebases Chevron down icon Chevron up icon
Data Exploration with ChatGPT Chevron down icon Chevron up icon
Building a Classification Model with ChatGPT Chevron down icon Chevron up icon
Building a Regression Model for Customer Spend with ChatGPT Chevron down icon Chevron up icon
Building an MLP Model for Fashion-MNIST with ChatGPT Chevron down icon Chevron up icon
Building a CNN Model for CIFAR-10 with ChatGPT Chevron down icon Chevron up icon
Unsupervised Learning: Clustering and PCA Chevron down icon Chevron up icon
Machine Learning with Copilot Chevron down icon Chevron up icon
Regression with Copilot Chat Chevron down icon Chevron up icon
Regression with Copilot Suggestions Chevron down icon Chevron up icon
Increasing Efficiency with GitHub Copilot Chevron down icon Chevron up icon
Agents in Software Development Chevron down icon Chevron up icon
Conclusion Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.

Modal Close icon
Modal Close icon