CPCS-335 Introduction to Artificial Intelligence Lecture 8 PDF
Document Details
Uploaded by SuccessfulHeliotrope540
King Abdulaziz University
Dr. Arwa Basbrain & Dr. Nofe Alganmi
Tags
Related
Summary
This document is a lecture presentation on machine learning, covering various aspects and concepts of the field. It includes slides about the introduction to machine learning, different learning types, and applications of machine learning, suitable for an undergraduate computer science course.
Full Transcript
CPCS-335 Introduction to Artificial Intelligence Lecture 8: Machine Learning Part(I): Introduction Dr. Arwa Basbrain & Dr. Nofe Alganmi 1 Part(I): Machine Learning Outlines...
CPCS-335 Introduction to Artificial Intelligence Lecture 8: Machine Learning Part(I): Introduction Dr. Arwa Basbrain & Dr. Nofe Alganmi 1 Part(I): Machine Learning Outlines 1-Introduction to Machine Learning (ML) What is Machine Learning? Why Would We Want an Agent to Learn? Machine Learning Applications Machine Learning Main Components 2-Data: The Fuel for Machine Learning Importance of Data in Machine Learning The Nature of Real-world Data Examples of Everyday Data Important Characteristics of Training Data 3-Model: The Core Component of ML What is a Machine Learning Model? Types of Learning Supervised Unsupervised Reinforcement Part(I) 4-ML Pipeline : From Problem to Deployment Gathering Data Preparing Data Selecting & Training The Model Testing & Deploying The Model 5-Responsible AI 1/09/2023 What is Responsible AI? Key Principles of Responsible AI Today’s Plan Introduction to Machine Learning (ML) Data: The Fuel for Machine Learning Model: The Core Component of ML ML Pipeline : From Problem to Deployment Responsible AI 3 Machine Learning 1- Introduction to Machine Learning (ML) 1/09/2023 4 Introduction to ML What is Machine Machine Learning (ML) is a subset of artificial intelligence (AI) Learning? that focuses on the development of algorithms and statistical models that allow computers to perform tasks without being explicitly programmed for each specific task. ML enables computers to learn from data. Definition A computer program is said to learn from experience E with respect to some task T and some performance measure P, if its performance on T, as measured by P, improves with experience E. (Mitchel, 1997) 5 Why Would We Want an Agent to Learn? Adaptation to Dynamic Complex Decision-Making Environments 01 02 Generalization and Improved Performance 03 04 Transfer Learning Handling Large Data Handling Uncertainty 05 06 Reduced Human Real-Time Decision- 07 08 Intervention Making Learning Agent 6 Machine Learning Applications Predict the relevance Search Engines of web pages Some machine learning applications Provide product Online Shopping recommendations Suggest movies, Entertainment shows, or music Learning Agent Facebook's friend tag Social Media suggestions 7 Machine Learning Applications Understand the user Smart Assistants commands Some machine learning applications Suggest the fastest Navigation routes Email Categorize emails Learning Agent Banking Fraud detection 8 Task In the previous provided examples of Machine learning, identify and describe the task (T), experience (E), and performance(P) associated with each scenario? 8/05/20XX 9 Machine Learning Main Components 01 02 Learning Agent Data Model The Fuel for Machine The Core Component Learning of Machine Learning 10 Machine Learning 2- Data: The Fuel for ML 1/09/2023 11 Importance of Data in Machine Learning Common Uses for Machine Learning Data: The Fuel for ML Every machine learning model starts with Training Models training. The quality, quantity, and diversity of 01 training data determine how well the model learns The more data a model is trained on, the better Improving Accuracy it becomes at making predictions. With more 02 examples, the model can learn from a broader range of scenarios. Real-world phenomena are intricate. A larger 03 Capturing Complexity dataset captures this complexity and helps in building models that are closer to reality. 12 The Nature of Real-world Data 01 02 Structured Data Organized in rows Unstructured Data and columns Real-world Data Information not organized in a predefined manner 03 Semi-structured Data A mix, structured and unstructured 13 Examples of Data Sources Social Media Data Healthcare Data Communication Data Posts, comments, and Patient medical records, Text messages, emails, likes. User profiles including diagnoses, and voice containing personal treatments, and lab results information, interests, and connections Internet of Things Data Research Data Sensor data from Scientific experiments smart home devices, and observations such as thermostats, collected in various doorbells, and security fields. Surveys and cameras Education Data questionnaires Student grades, attendance, course completion rates 14 Examples of Data Sources E-commerce Data Financial Data Environmental Data Product listings, prices, and Stock prices, trading Temperature, humidity, customer reviews on online volumes, and market and air quality shopping platforms. indices. measurements from Purchase history, user weather stations preferences, and recommendations Transportation Data Entertainment Data GPS location data from Streaming history on navigation apps and platforms like Netflix or devices. Traffic flow Spotify. User and congestion interactions and information reviews for movies, music, and games. 15 Task Give an example of a machine learning task for the provided examples of everyday data. 8/05/20XX 16 Important Characteristics of Training Data 01 Important of Training Data Quality Data quality refer to data that is accurate, unbiased and relevant to the problem. High-quality training data is a critical factor for a successful learning experience. It is important to understand that ML systems are only as good as the data they learn from. 02 Important of Training Data Quantity The amount of training data used in ML can significantly influence an AI system's performance. Generally, the more data the system has to learn from, the better it can understand the complexity of the problem and make accurate predictions because larger datasets offer a more comprehensive representation of the scenario or problem the ML needs to solve. 17 Machine Learning 3-Model: The Core Component of ML 1/09/2023 18 What is a Machine Learning Model? Model: The Core Component Machine Learning (ML) models are computer programs that of Machine Learning are used to recognize patterns in data or make predictions, decisions, or classifications. It's the core component of a machine learning system that encapsulates the knowledge gained from the training data and can be used to make predictions on new, unseen data. Model enables computers to learn from data. 19 Types of Learning Model: The Core Component of Machine Learning Supervised learning Unsupervised learning Reinforcement learning 20 What is Supervised Learning? Supervised learning is a machine learning approach that’s defined by its use of labelled Classification datasets. These datasets are designed to train or 01 Sorting items into “supervise” algorithms into classifying data or Cat categories predicting outcomes accurately. Supervised Dog Learning Regression 02 Identify real value Price, weight, etc 21 How Supervised Learning Works? (Classification) Dog Cat Cat Dog Training Dog Dog Cat Cat Data (Labelled ) Training Dataset Supervised Learning Agent Training Data (Labelled ) Learning Model Cat Testing Dataset Testing Dog Learning Agent Testing Data 22 Examples of Classification in Various Domains 1.Medical Diagnosis: Problem: Diagnose diseases based on patient symptoms and medical test results. Features: Patient's medical history, test results, age, gender, etc. Application: Identifying diseases like diabetes, cancer, or heart conditions based on patient data. 2.Credit Scoring: Problem: Determine whether a loan applicant is likely to repay the loan. Features: Credit history, income, employment status, debt, etc. Application: Banks and financial institutions use this to assess the risk associated with providing loans. 3.Image Classification: Problem: Classify images into predefined categories or objects. Features: Pixel values of the image, possibly augmented with deep learning features. Application: Identifying objects in images for self-driving cars, medical imaging, facial recognition, etc. 4.Sentiment Analysis: Problem: Classify text as expressing a positive, negative, or neutral sentiment. Features: Text content, word frequencies, sentiment-related features. Application: Analysing social media posts, reviews, or customer feedback to understand public sentiment. 5.Handwriting Recognition: Problem: Recognize handwritten characters or digits. Features: Pixel values of handwritten images. Application: Optical character recognition (OCR) systems used in digitizing documents and automating data entry. 6.Fraud Detection: Problem: Identify fraudulent transactions in financial transactions. Features: Transaction history, amounts, locations, time of day, etc. Application: Banks and credit card companies use this to detect unauthorized or suspicious activities. 23 How Supervised Learning Works? ( Regression ) Features Label Propert Locatio Area y Name n (sq. ft) Rooms Levels Price City Urban Training Center, 1,800 4 2 550,000 Retreat ABC Country Tranquil side, 2,500 5 3 800,000 Data (Labelled ) Villa DEF Modern Downto 900 2 1 250,000 Training Dataset Condo wn, GHI Supervised Learning Agent Training Data (Labelled ) Learning Model Testing Dataset Output Real Features Value Label Testing Predicted Property Area Price Name Location (sq. ft) Rooms Levels Price Modern Downtown, 900 2 1 1,450,000 1,500,000 Condo GHI Luxe Upscale, 5,000 8 4 250,000 10,000 Mansion JKL Learning Agent Testing Data 24 Examples of Regression in Various Domains 1.House Price Prediction: Problem: Predict the selling price of a house based on its features. Features: Square footage, number of bedrooms, location, amenities, etc. Application: Real estate agents and platforms use this to estimate property values. 2.Temperature Forecasting: Problem: Predict the temperature for the next day based on historical data. Features: Historical temperature, humidity, time of day, etc. Application: Meteorological agencies use this for weather forecasting. 3.Stock Price Prediction: Problem: Forecast the future stock price of a company based on historical stock data. Features: Historical stock prices, trading volume, economic indicators, etc. Application: Investors use these predictions to make trading decisions. 4.Healthcare Cost Prediction: Problem: Predict medical treatment costs based on patient characteristics. Features: Age, gender, medical history, procedures, location, etc. Application: Insurance companies use this to estimate costs for policyholders. 5.Energy Consumption Forecasting: Problem: Predict future energy consumption based on historical data. Features: Historical energy usage, weather conditions, time of day, etc. Application: Utilities plan energy generation and distribution based on these predictions. 6.GPA Prediction: Problem: Predict a student's GPA based on factors like study hours, attendance, etc. Features: Study hours, attendance, prior grades, extracurricular activities, etc. Application: Educational institutions use this to identify students who might need additional support. 25 Supervised Learning Algorithms 01 02 03 Linear regression Naive bayes Support vector machines 04 05 K-nearest neighbour Neural networks 26 What is Unsupervised Learning? Unsupervised learning uses machine learning algorithms to analyse and cluster unlabelled 01 Clustering data sets. These algorithms discover hidden patterns in data without the need for human Clustering is a technique for intervention. grouping unlabelled data based on their similarities or differences Unsupervised Learning Dimensionality 02 reduction Dimensionality reduction is a learning technique used when the number of features (or dimensions) in a given dataset is too high 28 How Unsupervised Learning Works? ( Clustering ) Features Custo Annual Spending Marital mer ID Gender Age Income Score Status 1 Male 25 40 65 Single Training 2 Female 40 60 30 Married Data (Unlabelled ) 3 Female 32 80 85 Single 4 Male 45 50 20 Married Training Dataset Unsupervised Learning Agent Training Data (Unlabelled ) Learning Model Testing Dataset (3) (1) Features Testing Custo Annual Spending Marital mer ID Gender Age Income Score Status (2) 9 Female 48 100 5 Single Group (1) Testing Data Learning Agent 29 Examples of Clustering in Various Domains 1.Customer Segmentation: Problem: Group customers into segments based on their purchasing behaviour. Features: Purchase history, demographics, browsing behaviour, etc. Application: Businesses use these segments for targeted marketing and personalized recommendations. 2.Image Segmentation: Problem: Segment an image into distinct regions based on similarities in colour or texture. Features: Pixel values, colour histograms, texture features. Application: Medical imaging, object detection, and computer vision tasks. 3.Social Network Analysis: Problem: Identify communities or groups within a social network. Features: Connections between individuals, shared interests, interactions. Application: Understanding network structure, influence spread, and community dynamics. 4.Document Clustering: Problem: Group similar documents together for topic discovery. Features: Text content, word frequencies. Application: Organizing news articles, customer reviews, and research papers. 5.Genomic Data Analysis: Problem: Group genes with similar expression patterns across samples. Features: Gene expression levels under different conditions. Application: Understanding gene interactions and identifying biomarkers. 6.Market Basket Analysis: Problem: Discover associations and patterns in customer purchasing habits. Features: Purchased items in transactions Application: Retailers use this for product recommendations and store layout optimization. 30 Unsupervised Learning Algorithms 01 02 Principal component K-means clustering analysis 31 What is Reinforcement Learning? Reinforcement Learning (RL) is a subfield of machine learning where an agent learns to make decisions by interacting with an environment. Reinforcement learning involves learning through trial and error based on feedback from the environment. Reinforcement Learning 33 What Are the Applications of Reinforcement Learning? Reinforcement Learning 34 What Are the Applications of Reinforcement Learning? Example self-driving cars Reinforcement Learning Objectives: The learning Learning objectives can include safe and efficient navigation, obeying traffic rules, avoiding collisions, adapting to traffic conditions, and minimizing travel time. Action Space: The action space refers to Reward Design: the possible control inputs that the self- Positive rewards can be given driving car can apply, such as for safe driving, staying within accelerating, braking, steering, and lanes, obeying traffic signals, and changing lanes. reaching a destination. Negative rewards can be assigned for collisions, violating Environment : The environment for a self- traffic rules, abrupt manoeuvres, driving car consists of the road, other and driving too close to other vehicles, pedestrians, and traffic signals. vehicles. State Representation: The car's state can be represented by various factors, such as its position, speed, acceleration, orientation, distances to surrounding objects, and traffic conditions. 35 Revision: Supervised Vs Unsupervised Vs Reinforcement Supervised learning Unsupervised learning Reinforcement learning Training on Training on Training on Training a model on Training a model on Training a model through labelled data. unlabelled data. interactions with an environment. The goal The goal The goal The goal is to learn a The goal is to discover The model learns to take mapping from input features patterns, structures, or actions in order to maximize to the correct output labels. relationships within the a reward signal over time data. Application Application Application Robotics Anomaly detection Spam detection 36 Revision: Examples of Learning Types in Various Domains Supervised learning Unsupervised learning Reinforcement learning Classification Clustering Fraud detection Customer Segmentation Finances Email spam detection Image Segmentation Diagnostics Social Network Analysis Manufacturing Image classification Document Clustering Stock management Genomic Data Analysis Self-driving cars Regression House Price Prediction Dimensionality reduction Temperature Forecasting Stock Price Prediction Medical Image Analysis Healthcare Cost Prediction Image Compression Energy Consumption Forecasting Genomic Data Analysis GPA Prediction 37 Machine Learning 4-ML Pipeline : From Problem to Deployment 1/09/2023 38 Machine Learning Pipeline The process of building effective and insightful machine learning solutions ML Pipeline : From Problem involves a series of well-defined steps that guide us from the initial problem formulation to the successful deployment of functional models. to Deployment Start by understanding the problem you want to solve using machine learning. What's the goal, and are there any limits? Also, figure out what type of machine learning you need – like sorting things, predicting values, or grouping stuff. 39 Machine Learning Pipeline Data Gathering & Preparing The goal of these steps is to Testing & Deploying The Model identify and obtain all data-related Evaluate the trained model's performance 4 problems. Prepare the model for deployment in a production environment. Selecting & Training The Model Choose an appropriate model. 3 Use the training data to train the selected model. Adjust model parameters for optimal performance. Preparing Data Data preparation is a step where we put our 2 data into a suitable place and prepare it to use in our machine learning training and testing Gathering Data Identify various data sources. 1 Collect data and integrate the data obtained from different sources 40 Machine Learning 5-Responsible AI 1/09/2024 41 Responsible AI What is Responsible AI is the practice of designing, developing, and Responsible AI? deploying AI systems that are ethical, transparent, and aligned with human values. Its goal is to ensure AI is used in a way that benefits society while minimizing risks and negative impacts. Why is Responsible use of AI can help to reduce AI bias and increase Responsible AI transparency. Users, affected individuals, data subjects, society, Important? and companies can suffer consequences if AI is misused, or used carelessly. For example: Facial Recognition and Bias 42 Key Principles of Responsible AI Fairness Privacy Accountability Avoid bias in AI models Protect personal data, ensure Assign responsibility for the and ensure equitable confidentiality, and comply outcomes of AI systems outcomes across with regulations like GDPR. and establish governance diverse groups, such as and legal frameworks to gender, race, and socio- ensure proper oversight. economic status. Transparency Safety & Security Make AI systems Ensure AI systems are explainable and secure, prevent harm, understandable while and mitigate risks from clearly communicating adversarial attacks or how decisions are made Inclusiveness system failures. by AI. Develop AI that is accessible to all, considering the needs of marginalized and underrepresented groups. 43