Get Started for AWS Certification for Machine Learning
In this post we will learn some key concept of machine learning in a flash card concept.
Neural networks
A neural network is a type of machine learning model that mimics how the human brain works to process information and make decisions. It’s made up of layers of nodes (neurons) that are connected to each other. Each node processes inputs, learns patterns, and helps the model make predictions, like recognizing images or understanding text.
Think of a neural network as a team of detectives trying to solve a mystery:
Each detective (node) looks at different clues (data) and makes a small guess. These guesses are passed to other detectives in the team (other layers), who make their own guesses based on what they received. In the end, the team combines all their guesses to solve the mystery (output a prediction). Over time, the detectives learn from their mistakes and get better at solving the mystery.
AWS Services for Neural Networks
Amazon Web Services (AWS) provides several services to build and deploy neural networks:
Amazon SageMaker: A fully managed service that helps you build, train, and deploy machine learning models, including neural networks. SageMaker supports popular frameworks like TensorFlow, PyTorch, and MXNet.
AWS Deep Learning AMIs: These Amazon Machine Images (AMIs) come pre-configured with deep learning frameworks like TensorFlow, PyTorch, and Apache MXNet to build neural networks.
AWS Lambda: Can be used to deploy lightweight neural network models to perform real-time predictions without managing servers.
AWS Inferentia: A specialized chip designed by AWS for high-performance inference of neural networks. It powers services like SageMaker Neo to optimize and deploy models on edge devices.
AWS Elastic Inference: A service that lets you attach low-cost GPU-powered inference acceleration to EC2 and SageMaker to speed up neural network predictions.
These services allow you to build, train, and deploy powerful neural networks on the cloud without worrying about infrastructure management.
Foundation models
A foundation model is a large, pre-trained machine learning model that can perform many different tasks with little fine-tuning. These models are trained on huge datasets and can understand language, images, or other types of data. They serve as a “foundation” that can be adapted for various specific tasks, like translating languages, answering questions, or generating content.
Think of a foundation model as a general-purpose tool:
- Imagine a Swiss Army knife with many tools (blade, scissors, screwdriver, etc.).
- You don’t need to build a new tool from scratch for each task; you just use the appropriate tool for the job.
- Similarly, a foundation model has learned general patterns from a huge amount of data and can be quickly adapted to do specific tasks, such as generating text or identifying objects in images.
Amazon Web Services (AWS) offers services to use and build on foundation models:
- Amazon Bedrock: This is AWS’s service to access foundation models from various providers. It allows you to use pre-built models for tasks like text generation, summarization, and question answering without needing to manage the underlying infrastructure.
- Amazon SageMaker Jump Start: A feature of SageMaker that provides access to pre-trained models, including foundation models, for tasks such as image classification and text analysis. You can fine-tune these models for your specific needs.
- Amazon SageMaker: While SageMaker primarily helps you build and train machine learning models, it can also be used to fine-tune foundation models on specific datasets, helping you quickly apply these models to specialized tasks.
Multi-modal models
A multi-modal model is a machine learning model that can understand and process multiple types of data at the same time, such as text, images, audio, or video. Unlike single-mode models that focus on just one type of input, multi-modal models can combine different kinds of information to make more accurate predictions or provide richer insights.
Think of a multi-modal model as a detective who solves cases by gathering clues from multiple sources:
- The detective uses sight (images), hearing (audio), and reading (text) to get a full picture of what happened.
- Similarly, a multi-modal model combines different types of data, like an image with a description, to understand the whole situation better.
- Instead of relying on just one clue (one type of data), it considers everything together to make a better decision.
AWS provides several services that support building and deploying multi-modal models:
- Amazon SageMaker: This fully managed service allows you to build, train, and deploy multi-modal models. You can use different data types (like text, images, and structured data) in a single model by combining frameworks such as TensorFlow or PyTorch.
- Amazon Rekognition: This service analyzes images and videos. While it’s focused on visual data, it can be integrated with text-based models (e.g., using Amazon Comprehend for text analysis) to create multi-modal applications.
- Amazon Comprehend: This service performs text analysis. It can be used in conjunction with other AWS services like Rekognition for building multi-modal models that understand both text and visual inputs.
- Amazon Bedrock: Provides access to foundation models that are multi-modal, allowing you to work with both text and image inputs without managing infrastructure.
- AWS Lambda: You can build serverless workflows that handle multiple types of inputs (like processing an image and generating descriptive text) by combining different AWS services into a single application.
Fine-tuning
Fine-tuning is a process where you take a pre-trained machine learning model (like a foundation model) and make small adjustments so it works better for a specific task or dataset. Instead of building a model from scratch, you start with a model that already knows a lot and teach it to perform your unique task more accurately.
Think of fine-tuning as customizing a car:
- You buy a car that’s already built and works well, but you want to make it more suitable for your needs. You might change the tires, adjust the seats, or add a custom sound system.
- Similarly, in fine-tuning, the model already knows a lot, but you tweak it to work best for your specific data or problem.
Types of Fine-Tuning
Full Fine-Tuning:
Adjust all the layers of the pre-trained model to adapt to your specific task. When to use: When your new task is very different from the original task the model was trained on. Example: Starting with a general language model and fine-tuning it to generate legal contracts.
Partial Fine-Tuning (or Feature Extraction):
Only adjust the last few layers while keeping the earlier layers fixed. The early layers retain the general features learned from the original training. When to use: When your task is similar to the original task, and you don’t want to retrain the entire model. Example: Fine-tuning an image classification model to recognize a specific type of animal, but leaving most of the model unchanged.
Parameter-Efficient Fine-Tuning:
Only a subset of the parameters are fine-tuned, such as adding small adapters or using techniques like LoRA (Low-Rank Adaptation). When to use: When you need to save computational resources or memory while still improving performance on a specific task. Example: Fine-tuning a large language model on a specific domain (e.g., medical text) without retraining the entire model.
Hyper-parameter Tuning:
Instead of adjusting the model’s internal weights, this process focuses on tweaking the hyper-parameters that control how the model learns, like learning rate or batch size. When to use: When the model works well, but small adjustments to its learning process can improve performance. Example: Adjusting the learning rate for a model to improve training efficiency.
AWS Services for Fine-Tuning
AWS provides multiple services for fine-tuning machine learning models:
Amazon SageMaker:
Offers built-in support for fine-tuning models, whether you’re using pre-trained models from SageMaker JumpStart, built-in algorithms, or your own custom models. SageMaker simplifies the process of loading pre-trained models and training them on your data.
Amazon SageMaker JumpStart:
Provides access to a wide variety of pre-trained models that can be fine-tuned for different tasks, including text classification, image recognition, and more. It allows you to quickly start fine-tuning models without needing to manually configure everything.
Amazon Bedrock:
Enables access to large foundation models that can be fine-tuned on your specific dataset. You can customize foundation models from providers through Bedrock for a variety of use cases like text generation, summarization, or translation.
AWS Deep Learning AMIs:
Pre-configured machine images with deep learning frameworks like TensorFlow and PyTorch, making it easier to fine-tune models on your own infrastructure.
SageMaker Automatic Model Tuning:
Automatically fine-tunes hyperparameters of machine learning models by running multiple training jobs with different settings, selecting the best performing model configuration. With AWS, fine-tuning becomes easier because you can leverage powerful pre-trained models and adapt them to your specific tasks, allowing for faster and more efficient model development.
AWS AI/ML Services Overview
Here are some AWS services those are used for different tasks to leverage machine learning.
1. Amazon Comprehend
When to Use:
- Use when you need to analyze text for sentiment, key phrases, entities, and language.
- Ideal for text classification and extracting insights from unstructured data.
Use Cases:
- Customer Feedback Analysis: Analyze customer reviews to detect sentiment and trends.
- Document Processing: Extract key information from documents like contracts and medical reports.
- Content Classification: Automatically categorize news articles, blog posts, or support tickets.
Architecture Decisions:
- Integrates well with Amazon S3 for storing unstructured data.
- Use in combination with Amazon Lambda for real-time text analysis in erverless applications.
- Pair with Amazon SageMaker for more complex NLP models that require custom training.
Cost Decision:
- Pay-per-usage model based on the number of documents or characters processed.
- Opt for batch processing if analyzing large volumes of data to lower costs.
- Use Comprehend Custom for custom classification or entity recognition models with an associated training cost.
2. Amazon Translate
When to Use:
- Use when you need fast, accurate machine translation between different languages.
- Ideal for multi-lingual content processing.
Use Cases:
- Website Localization: Automatically translate your website into different languages.
- Customer Support: Translate customer interactions for international support teams.
- Real-Time Translation: Translate text inputs for applications such as chatbots and messaging services.
Architecture Decisions:
- Use Amazon API Gateway and Lambda to create serverless translation services.
- Combine with Amazon Comprehend to extract insights from translated text.
Cost Decision:
- Pay-as-you-go pricing model based on the number of characters translated.
- Choose batch processing if dealing with large volumes of text to reduce costs.
3. Amazon Transcribe
When to Use:
- Use for converting audio or video files into text.
- Ideal for voice applications, transcription services, and call analytics.
Use Cases:
- Meeting Transcription: Convert meeting audio into text for note-taking and review.
- Call Center Analysis: Automatically transcribe and analyze customer service calls.
- Captioning Services: Transcribe videos for subtitles or closed captions.
Architecture Decisions:
- Store audio files in Amazon S3 and use Amazon Lambda for triggering transcriptions.
- Use Transcribe Streaming for real-time transcription and combine with Amazon Kinesis for data ingestion.
Cost Decision:
- Charged by the duration of the audio processed (per second).
- Consider using batch processing for pre-recorded audio files to optimize costs.
4. Amazon Rekognition
When to Use:
- Use for image and video analysis, object detection, and facial recognition.
- Ideal for applications that require visual content understanding.
Use Cases:
- Security Monitoring: Detect faces, objects, or suspicious activities in security footage.
- Content Moderation: Automatically filter inappropriate or unwanted content in images and videos.
- Photo Tagging: Automatically label and tag images for easy search and retrieval.
Architecture Decisions:
- Use Amazon S3 for storing images and videos.
- Combine with Lambda for automated image analysis workflows, such as real-time moderation or facial recognition.
Cost Decision:
- Charged based on the number of images processed or video duration analyzed.
- Choose between Real-Time Analysis or Batch Processing depending on your needs and budget.
5. Amazon Forecast
When to Use:
- Use when you need accurate time-series forecasting.
- Ideal for predicting future trends in sales, inventory, and demand.
Use Cases:
- Demand Forecasting: Predict product demand to optimize inventory.
- Financial Forecasting: Forecast future financial metrics like revenue or cost.
- Capacity Planning: Predict future workload to optimize resource planning.
Architecture Decisions:
- Integrate with Amazon S3 for storing historical data.
- Use SageMaker if custom modeling is required on top of the standard time-series model.
Cost Decision:
- Pricing is based on the amount of data stored, the number of forecasts generated, and the training hours used.
- Opt for on-demand forecasting based on the frequency of prediction requirements to save costs.
6. Amazon Lex
When to Use:
- Use for building conversational interfaces and chat-bots.
- Ideal for creating virtual assistants, customer service bots, and voice-enabled applications.
Use Cases:
- Customer Support Bots: Provide 24/7 customer service through automated chat-bots.
- Virtual Assistants: Create voice-driven virtual assistants for tasks like booking or ordering.
- IVR Systems: Automate call routing and responses with intelligent voice systems.
Architecture Decisions:
- Integrates with AWS Lambda for executing back-end logic based on user input.
- Pair with Amazon Polly to enable text-to-speech functionality.
Cost Decision:
- Charged per text or voice request made to the chat-bot.
- Optimize costs by using predefined intents and minimizing complex flows that increase conversation duration.
7. Amazon Personalize
When to Use:
- Use for creating personalized recommendations and content suggestions.
- Ideal for e-commerce, media, and entertainment platforms.
Use Cases:
- Product Recommendations: Provide personalized product suggestions for users on an e-commerce site.
- Content Personalization: Recommend movies, shows, or articles based on user preferences.
- Marketing Campaigns: Deliver personalized marketing messages and promotions.
Architecture Decisions:
- Store user interaction data in Amazon S3 or use Amazon DynamoDB for real-time interaction tracking.
- Combine with SageMaker for more advanced recommendation systems if needed.
Cost Decision:
- Pay based on the amount of data processed and the number of recommendations made.
- Use batch processing to generate recommendations periodically to reduce costs.
8. Amazon Textract
When to Use:
- Use for extracting text, tables, and forms from scanned documents.
- Ideal for processing large volumes of documents or digitizing paper-based workflows.
Use Cases:
- Document Automation: Extract data from contracts, forms, and legal documents.
- Invoice Processing: Automate the extraction of information from invoices for accounting systems.
- Healthcare Records: Digitize handwritten or scanned medical records for easy access.
Architecture Decisions:
- Store scanned documents in Amazon S3 and use Lambda for processing documents in real-time.
- Use Comprehend for additional natural language processing on the extracted text.
Cost Decision:
- Charged based on the number of pages processed.
- Optimize cost by batching document processing during off-peak hours or using scheduled jobs.
9. Amazon Kendra
When to Use:
- Use for building enterprise search solutions that help users find relevant information from within internal documents and data repositories.
- Ideal for companies with large document collections, like legal, healthcare, and research organizations.
Use Cases:
- Knowledge Base Search: Search across internal documents, manuals, and policies.
- Customer Support: Enable support agents to quickly find answers from large document sets.
- Research Tools: Help researchers navigate large datasets or reports efficiently.
Architecture Decisions:
- Store document sources in Amazon S3, SharePoint, or databases.
- Combine with Lambda to enrich the search results or trigger real-time actions based on queries.
Cost Decision:
- Charged based on the number of queries processed and the volume of data indexed.
- Consider reducing data indexing frequency to save costs in low-update environments.
10. Amazon Augmented AI (A2I)
When to Use:
- Use for building workflows that combine machine learning with human reviewers for tasks requiring human judgment.
- Ideal for scenarios where high confidence predictions are needed, such as document reviews or content moderation.
Use Cases:
- Content Moderation: Use human reviewers to handle edge cases in image or video moderation.
- Document Validation: Validate data extraction from scanned forms and documents with human verification.
- Fraud Detection: Review flagged transactions or predictions for potential fraud.
Architecture Decisions:
- Integrate with SageMaker for AI model outputs, and add human review workflows using A2I.
- Use Amazon S3 for storing input data and results from human review processes.
Cost Decision:
- Pricing is based on the number of human review tasks performed.
- Optimize by using A2I only for cases where the model’s confidence level is below a threshold.
11. Amazon’s Hardware for AI
When to Use:
- Use for accelerating machine learning model training and inference workloads with specialized hardware.
- Ideal for deep learning models or large-scale machine learning tasks.
Use Cases:
- Deep Learning Training: Use hardware like AWS Inferential and GPU instances to train deep learning models faster.
- Real-Time Inference: Deploy low-latency inference models using AWS Elastic Inference.
Architecture Decisions:
- Leverage Amazon EC2 P3 or G4 Instances for GPU-accelerated workloads.
- Integrate AWS Inferential or Elastic Inference to reduce costs without compromising performance.
Cost Decision:
- Pricing is based on the type and size of instance or hardware chosen.
- Use Spot Instances for non-critical workloads to lower training costs, or Reserved Instances for long-term usage.
12. Amazon Lookout
When to Use:
- Use for anomaly detection in industrial data, metrics, or business processes.
- Ideal for monitoring manufacturing operations, supply chain processes, or financial metrics.
Use Cases:
- Manufacturing: Detect equipment failure or process anomalies.
- Business Metrics: Monitor key performance indicators and alert on abnormal behavior.
- IoT Data: Analyze sensor data from industrial machines and detect irregularities.
Architecture Decisions:
- Use Amazon S3 for data storage and AWS IoT for real-time sensor data processing.
- Combine with Amazon CloudWatch for continuous monitoring of anomalies.
Cost Decision:
- Charged based on the volume of data ingested and the complexity of anomaly detection models.
- Optimize by only monitoring key metrics that are critical for business or operational performance.
13. Amazon Fraud Detector
When to Use:
- Use for detecting potential fraudulent activities in online transactions and business operations.
- Ideal for e-commerce, financial services, and insurance sectors.
Use Cases:
- Payment Fraud Detection: Identify suspicious transactions and flag them for review.
- Account Takeover Prevention: Detect unusual login patterns that may indicate a compromised account.
- Insurance Fraud: Analyze claims data for suspicious behavior and fraud signals.
Architecture Decisions:
- Use Amazon S3 for storing historical transaction data and Amazon Lambda for real-time transaction processing.
- Combine with SageMaker for advanced custom fraud detection models.
Cost Decision:
- Charged based on the number of fraud predictions made.
- Batch process historical data periodically to reduce costs, or limit fraud detection to high-value transactions.
14. Amazon QuickSight (Q)
When to Use:
- Use for building interactive dashboards and business intelligence (BI) tools.
- Ideal for visualizing data insights and enabling self-service BI.
Use Cases:
- Business Analytics: Create interactive dashboards for business reporting.
- Data Exploration: Allow users to explore and visualize data in real-time.
- Operational Dashboards: Track KPIs and operational metrics in a user-friendly format.
Architecture Decisions:
- Connect to data stored in Amazon RDS, Redshift, or S3.
- Use Amazon Athena to query data directly from S3 for interactive analysis.
Cost Decision:
- Pay-per-session pricing for users or a monthly subscription for advanced features.
- Optimize by limiting access to non-essential users and using session-based pricing for occasional users.
15. Amazon Lookout for Vision
When to Use:
- Use for automated visual inspection of products and equipment to detect anomalies or defects.
- Ideal for manufacturing environments and quality control processes.
Use Cases:
- Manufacturing Defects: Detect product defects during production with automated vision systems.
- Quality Control: Automate the visual inspection of items to ensure product quality.
- Equipment Monitoring: Monitor equipment in industrial settings for wear and tear.
Architecture Decisions:
- Store images or videos in Amazon S3 for analysis, and use Lambda to automate workflows.
- Combine with Amazon Rekognition for additional image analysis tasks.
Cost Decision:
- Pricing is based on the number of images processed.
- Batch process images during non-peak hours to save costs, or use scheduled jobs for periodic inspection.
16. Amazon Lookout for Metrics
When to Use:
- Use for detecting anomalies in business and operational metrics.
- Ideal for monitoring sales, marketing performance, and operational KPIs.
Use Cases:
- Sales Metrics: Monitor fluctuations in sales performance and detect abnormal patterns.
- Marketing Analytics: Detect sudden changes in campaign performance metrics.
- Operational Efficiency: Track KPIs like downtime or throughput to detect anomalies.
Architecture Decisions:
- Store time-series data in Amazon S3 or use Amazon Timestream for real-time metric analysis.
- Combine with Amazon CloudWatch to set up alerts when anomalies are detected.
Cost Decision:
- Charged based on the volume of data ingested and processed.
- Optimize costs by filtering non-critical metrics and focusing only on essential KPIs for monitoring.
17. Amazon Q Business
When to Use:
- Use for business users to ask data questions in plain language and get insights through natural language processing (NLP).
- Ideal for non-technical teams that need access to business data insights without needing SQL knowledge.
Use Cases:
- Self-Service Business Intelligence: Allow non-technical users to explore data by asking questions in plain language.
- Operational Reporting: Quickly generate reports and dashboards without needing data engineering support.
Architecture Decisions:
- Connect to data stored in Amazon Redshift, RDS, or S3.
- Combine with Amazon Athena for querying large datasets stored in S3 without needing complex ETL pipelines.
Cost Decision:
- Pay-per-query model, based on the number of queries asked.
- Optimize costs by limiting the number of users with access to Q and by batching similar queries.
18. Amazon Q Developer
When to Use:
- Use for developers building natural language query interfaces into applications for end users.
- Ideal for companies wanting to add NLP-driven business intelligence features into custom apps.
Use Cases:
- Embedded BI: Embed Q capabilities directly into business applications for easy data querying.
- Customer-Facing Dashboards: Enable users to interact with dashboards and data without needing technical knowledge.
Architecture Decisions:
- Integrate with Amazon QuickSight as the underlying BI engine for building custom user interfaces.
- Store data in Amazon Redshift or RDS for fast query performance.
Cost Decision:
- Pricing is similar to QuickSight Q, with a pay-per-query model.
- Consider limiting access to Q features for specific user roles to manage query costs.