Machine Learning Guide

Machine Learning Guide

Download on the App Store
  • Favorites

    233

    Followers

  • Typical duration

    50 min

    per episode

Based on Podcast App listening data

Machine Learning Guide episodes

  • MLA 015 AWS SageMaker MLOps 1

    SageMaker is an end-to-end machine learning platform on AWS that covers every stage of the ML lifecycle, including data ingestion, preparation, training, deployment, monitoring, and bias detection. The platform offers integrated tools such as Data Wrangler, Feature Store, Ground Truth, Clarify, Autopilot, and distributed training to enable scalable, automated, and accessible machine learning operations for both tabular and large data sets.

    Links
    • Notes and resources at ocdevel.com/mlg/mla-15
    • Try a walking desk stay healthy & sharp while you learn & code
    Amazon SageMaker: The Machine Learning Operations Platform

    MLOps is deploying your ML models to the cloud. See MadeWithML for an overview of tooling (also generally a great ML educational run-down.)

    Introduction to SageMaker and MLOps
    • SageMaker is a comprehensive platform offered by AWS for machine learning operations (MLOps), allowing full lifecycle management of machine learning models.
    • Its popularity provides access to extensive resources, educational materials, community support, and job market presence, amplifying adoption and feature availability.
    • SageMaker can replace traditional local development environments, such as setups using Docker, by moving data processing and model training to the cloud.
    Data Preparation in SageMaker
    • SageMaker manages diverse data ingestion sources such as CSV, TSV, Parquet files, databases like RDS, and large-scale streaming data via AWS Kinesis Firehose.
    • The platform introduces the concept of data lakes, which aggregate multiple related data sources for big data workloads.
    • Data Wrangler is the entry point for data preparation, enabling ingestion, feature engineering, imputation of missing values, categorical encoding, and principal component analysis, all within an interactive graphical user interface.
    • Data wrangler leverages distributed computing frameworks like Apache Spark to process large volumes of data efficiently.
    • Visualization tools are integrated for exploratory data analysis, offering table-based and graphical insights typically found in specialized tools such as Tableau.
    Feature Store
    • Feature Store acts as a centralized repository to save and manage transformed features created during data preprocessing, ensuring different steps in the pipeline access consistent, reusable feature sets.
    • It facilitates collaboration by making preprocessed features available to various members of a data science team and across different models.
    Ground Truth: Data Labeling
    • Ground Truth provides automated and manual data labeling options, including outsourcing to Amazon Mechanical Turk or assigning tasks to internal employees via a secure AWS GUI.
    • The system ensures quality by averaging multiple annotators' labels and upweighting reliable workers, and can also perform automated label inference when partial labels exist.
    • This flexibility addresses both sensitive and high-volume labeling requirements.
    Clarify: Bias Detection
    • Clarify identifies and analyzes bias in both datasets and trained models, offering measurement and reporting tools to improve fairness and compliance.
    • It integrates seamlessly with other SageMaker components for continuous monitoring and re-calibration in production deployments.
    Build Phase: Model Training and AutoML
    • SageMaker Studio offers a web-based integrated development environment to manage all aspects of the pipeline visually.
    • Autopilot automates the selection, training, and hyperparameter optimization of machine learning models for tabular data, producing an optimal model and optionally creating reproducible code notebooks.
    • Users can take over the automated pipeline at any stage to customize or extend the process if needed.
    Debugger and Distributed Training
    • Debugger provides real-time training monitoring, similar to TensorBoard, and offers notifications for anomalies such as vanishing or exploding gradients by integrating with AWS CloudWatch.
    • SageMaker's distributed training feature enables users to train models across multiple compute instances, optimizing for hardware utilization, cost, and training speed.
    • The system allows for sharding of data and auto-scaling based on resource utilization monitored via CloudWatch notifications.
    Summary Workflow and Scalability
    • The SageMaker pipeline covers every aspect of machine learning workflows, from ingestion, cleaning, and feature engineering, to training, deployment, bias monitoring, and distributed computation.
    • Each tool is integrated to provide either no-code, low-code, or fully customizable code interfaces.
    • The platform supports scaling from small experiments to enterprise-level big data solutions.
    Useful AWS and SageMaker Resources
    • SageMaker
    • DataWrangler
    • Feature Store
    • Ground Truth
    • Clarify
    • Studio
    • AutoPilot
    • Debugger
    • Distributed Training
    • JumpStart
    48 min
  • MLA 014 Hosting and Deploying ML: Managed APIs, Serverless GPUs, Self-Hosting

    Where the model behind your product should run in 2026: managed APIs vs open weights, AWS native vs Modal, RunPod and Cloud Run GPU, vLLM and SGLang, quantized CPU inference on Spot, batch pricing, prod evals, and infra as code.

    Links
    • Try a walking desk - stay healthy & sharp while you learn & code
    • More OCDevel shows - this one has siblings, each on its own subject and produced the same way

    The infrastructure episode, standalone: where the model behind your product runs in 2026, and what each choice costs. Managed APIs versus self-hosted open weights, AWS native (Bedrock, SageMaker) versus serverless GPU platforms (Modal, RunPod, Cloud Run GPU) versus bare GPUs, the inference servers (vLLM, SGLang, llama.cpp), quantized CPU inference on Spot, queues and batch pricing, observability and evals, and a minute on infrastructure as code. The coding-agent workflow is covered in Vibe Coding in 2026 through Agentic Software Engineering; agent architecture in AI Agents in 2026.

    Calling a model vs running one
    • The default for a product builder is a managed API: cost is linear in usage with no floor, while a self-hosted GPU costs the same idle as busy.
    • Four things flip the default: sustained volume, privacy or data residency, a strict latency shape, or a model only available as open weights. Move one workload when a flip applies, not the whole stack.
    • The cloud-hosted middle path: Amazon Bedrock's model catalog now spans Anthropic, OpenAI (including the open-weight gpt-oss models), Meta Llama, Mistral, DeepSeek, Qwen and more, and Custom Model Import serves your own safetensors weights on demand with no instance to manage.
    • The framing on rent vs own is still a16z's "Navigating the High Cost of AI Compute": renting wins for almost everyone; owning pays only at large steady spend.
    AWS native
    • Lambda and Fargate still have no GPUs; the Lambda quotas page has no accelerator dimension and the Fargate FAQ sends GPU work to EC2. Lambda offers 10 GB memory, 15-minute timeouts, 10 GB container images, and SnapStart for Python.
    • SageMaker AI: real-time endpoints scale to zero only via inference components; asynchronous inference queues S3 payloads up to 1 GB and scales to zero; serverless inference is CPU-only; batch transform for offline scoring.
    • AWS Batch GPU jobs on Spot compute environments are the cheapest bursty GPU on AWS, with no scheduler surcharge.
    • Aurora PostgreSQL ships pgvector 0.8.2 with HNSW, and Aurora Serverless v2 auto-pause drops compute to zero when idle. Bedrock Knowledge Bases can use that Aurora as its store. Aurora DSQL has no extensions, so no pgvector.
    Serverless GPU platforms
    • The category: ship a container or function, pay per GPU-second, scale to zero. Differentiators are cold start and warm-pool control.
    • Modal: Python-native, per-second billing, T4 through B300; cold starts around a second with memory snapshots and minimum-container knobs; batch via Function.map.
    • RunPod Serverless: queue-based or load-balanced endpoints, FlashBoot, async run and webhooks, wide GPU list from economy cards to B200.
    • Cloud Run GPU: GA, NVIDIA L4 and RTX PRO 6000 Blackwell, scales to zero, instance-based billing required.
    • Baseten with the open-source Truss packager: operated production deployments for custom models.
    • Replicate joined Cloudflare in November 2025; Cloudflare Workers AI remains a curated open-model catalog, not a bring-your-own-weights host.
    • fal: generative media inference first, serverless GPUs on the side.
    • Status changes: Lambda's inference API is winding down in favor of GPU instances; Fly.io's GPU Machines appear withdrawn (docs removed, no GPU line on pricing).
    Bare GPUs, neoclouds, and Spot
    • Hyperscaler families: AWS P6, Google Cloud GPUs, Azure ND/NC sizes. Neoclouds: CoreWeave, Nebius, Lambda, Crusoe; Vast.ai as a marketplace with interruptible pricing.
    • A reserved box beats serverless when the GPU is busy most of the hour.
    • EC2 Spot advertises up to 90 percent off on-demand, with a two-minute interruption notice. The discount is paid for with checkpointing, retry-on-reclaim, and instance-pool diversity using the SPOT_PRICE_CAPACITY_OPTIMIZED allocation strategy AWS recommends.
    Inference servers
    • vLLM: PagedAttention, continuous batching, OpenAI- and Anthropic-compatible server, V1 engine, now under the PyTorch Foundation.
    • SGLang: RadixAttention prefix reuse, releases every two weeks, production use at xAI, NVIDIA, Cursor and the major clouds.
    • Hugging Face TGI was archived in March 2026; its notice points to vLLM and SGLang.
    • TensorRT-LLM for NVIDIA-only maximum throughput; NVIDIA Dynamo orchestrates disaggregated prefill/decode across engines.
    • llama.cpp for GGUF on CPUs, Apple Silicon and ARM with KleidiAI; Ollama now runs its own engine on GGML for multimodal models.
    • Also: Triton Inference Server for non-LLM models, Ray Serve for composition, OpenLLM, LMDeploy, MLC-LLM.
    Quantization for CPU inference
    • Quantized weights cut memory and, since batch-1 decode is memory-bandwidth bound, cut time per token; integer matrix instructions (ARM dot-product and MMLA, Intel VNNI) do the multiplies.
    • GGUF quant naming: bits per weight, k-quant mixed precision, size variant; Q4_K_M takes Llama 3.1 8B from about 32 GB to about 5 GB.
    • AWS Graviton guide for llama.cpp recommends Graviton3 and later for their BF16 and MMLA instructions and publishes a prebuilt llama-server container.
    • vLLM's CPU backend covers x86 AVX512 and ARM. ONNX Runtime quantization for classic models, with the caveat that gains need VNNI or ARM dot-product hardware.
    • Practice described in the episode: a quantized Qwen3-TTS model served by a C port on Graviton Spot instances via AWS Batch, checkpointing chunks to S3.
    Queues, batch, and real-time
    • If no human waits, queue it: SQS with Lambda needs idempotency and partial-batch failure reporting; SageMaker async, Modal map, and RunPod async run are the same shape.
    • Batch pricing is 50 percent off across OpenAI Batch, Anthropic Message Batches, and Bedrock batch inference, with separate rate limits and a 24-hour window.
    • Bedrock prompt caching bills cache reads at a large discount within a short TTL; put stable prefix content first.
    • Real-time paths need warm containers ("scale to zero" becomes "scale to one"), continuous batching, and streaming.
    Observability and evals in prod
    • Trace every call with prompt, response, tokens, latency, cost. The OpenTelemetry GenAI conventions moved to their own repo; OpenLLMetry emits them.
    • Tools: Langfuse (open source, part of ClickHouse since January 2026), Arize Phoenix (Elastic License), LangSmith, W&B Weave, Braintrust, Helicone as a proxy.
    • Production evals score sampled traces with a judge model: Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena found over 80 percent agreement with humans and named position, verbosity and self-enhancement bias.
    • Classic drift: Evidently covers tabular drift and LLM metrics; WhyLabs ceased operations but open-sourced whylogs and langkit.
    Infrastructure as code
    • SST runs on Pulumi with Terraform providers bridged; Pulumi for languages without SST's web opinions; Terraform under BSL since 2023 with OpenTofu as the open fork. Keep ML infra in the product's repo and deploy.
    Shout-outs
    • Fast custom silicon APIs: Groq, Cerebras. Open-model inference clouds: Together AI, Fireworks, DeepInfra. Aggregators: OpenRouter, Hugging Face Inference Providers; dedicated Inference Endpoints. AWS Trainium. SageMaker JumpStart delisted models in March 2026, so pin weights in your own bucket.
    Related episodes
    • MLA 22: Vibe Coding in 2026
    • MLA 23: Inside a Coding Agent
    • MLA 24: Agentic Software Engineering
    • MLA 28: AI Agents in 2026
    • MLA 29: OpenClaw and the Personal Agent

    More Gnothi-generated shows on AI, coding, video and business: ocdevel.com/moremlg.

    37 min
  • MLA 013 Tech Stack for Customer-Facing Machine Learning Products

    Primary technology recommendations for building a customer-facing machine learning product include React and React Native for the front end, serverless platforms like AWS Amplify or GCP Firebase for authentication and basic server/database needs, and Postgres as the relational database of choice. Serverless approaches are encouraged for scalability and security, with traditional server frameworks and containerization recommended only for advanced custom backend requirements. When serverless options are inadequate, use Node.js with Express or FastAPI in Docker containers, and consider adding Redis for in-memory sessions and RabbitMQ or SQS for job queues, though many of these functions can be handled by Postgres. The machine learning server itself, including deployment strategies, will be discussed separately.

    Links
    • Notes and resources at ocdevel.com/mlg/mla-13
    • Try a walking desk stay healthy & sharp while you learn & code
    Client Applications
    • React is recommended as the primary web front-end framework due to its compositional structure, best practice enforcement, and strong community support.
    • React Native is used for mobile applications, enabling code reuse and a unified JavaScript codebase for web, iOS, and Android clients.
    • Using React and React Native simplifies development by allowing most UI logic to be written in a single language.
    Server (Backend) Options
    • The episode encourages starting with serverless frameworks, such as AWS Amplify or GCP Firebase, for rapid scaling, built-in authentication, and security.
      • Amplify allows seamless integration with React and handles authentication, user management, and database access directly from the client.
      • When direct client-to-database access is insufficient, custom business logic can be implemented using AWS Lambda or Google Cloud Functions without managing entire servers.
    • Only when serverless frameworks are insufficient should developers consider managing their own server code.
      • Recommended traditional backend options include Node.js with Express for JavaScript environments or FastAPI for Python-centric projects, both offering strong concurrency support.
      • Using Docker to containerize server code and deploying via managed orchestration (e.g., AWS ECS/Fargate) provides flexibility and migration capability beyond serverless.
      • Python's FastAPI is advised for developers heavily invested in the Python ecosystem, especially if machine learning code is also in Python.
    Database and Supporting Infrastructure
    • Postgres is recommended as the primary relational database, owing to its advanced features, community momentum, and versatility.
      • Postgres can serve multiple infrastructure functions beyond storage, including job queue management and pub/sub (publish-subscribe) messaging via specific database features.
    • NoSQL options such as MongoDB are only recommended when hierarchical, non-tabular data models or specific performance optimizations are necessary.
    • For situations requiring in-memory session management or real-time messaging, Redis is suggested, but Postgres may suffice for many use cases.
    • Job queuing can be accomplished with external tools like RabbitMQ or AWS SQS, but Postgres also supports job queuing via transactional locks.
    Cloud Hosting and Server Management
    • Serverless deployment abstracts away infrastructure operations, improving scalability and reducing ongoing server management and security burdens.
      • Serverless functions scale automatically and only incur charges during execution.
    • Amplify and Firebase offer out-of-the-box user authentication, database, and cloud function support, while custom authentication can be handled with tools like AWS Cognito.
    • Managed database hosting (e.g., AWS RDS for Postgres) simplifies backups, scaling, and failover but is distinct from full serverless paradigms.
    Evolution of Web Architectures
    • The episode contrasts older monolithic frameworks (Django, Ruby on Rails) with current microservice and serverless architectures.
    • Developers are encouraged to leverage modern tools where possible, adopting serverless and cloud-managed components until advanced customization requires traditional servers.
    Links Client
    • React for web client
    • create-react-app: quick-start React setup
    • React Bootstrap: CSS framework (alternatives: Tailwind, Chakra, MaterialUI)
    • react-router and easy-peasy as useful plugins
    • React Native for mobile apps
    Server
    • AWS Amplify for serverless web and mobile backends
    • GCP Firebase
    • AWS Serverless (underlying building blocks)
    • AWS Lambda for serverless functions
    • ECR, Fargate, Route53, ELB for containerized deployment
    Database, Job-Queues, Sessions
    • Postgres as the primary relational database
    • Redis for session-management and pub/sub
    • RabbitMQ or SQS for job queuing (with wrapper: Celery)
    48 min
  • MLA 012 Docker for Machine Learning Workflows

    Docker enables efficient, consistent machine learning environment setup across local development and cloud deployment, avoiding many pitfalls of virtual machines and manual dependency management. It streamlines system reproduction, resource allocation, and GPU access, supporting portability and simplified collaboration for ML projects. Machine learning engineers benefit from using pre-built Docker images tailored for ML, allowing seamless project switching, host OS flexibility, and straightforward deployment to cloud platforms like AWS ECS and Batch, resulting in reproducible and maintainable workflows.

    Links
    • Notes and resources at ocdevel.com/mlg/mla-12
    • Try a walking desk stay healthy & sharp while you learn & code
    Traditional Environment Setup Challenges
    • Traditional machine learning development often requires configuring operating systems, GPU drivers (CUDA, cuDNN), and specific package versions directly on the host machine.
    • Manual setup can lead to version conflicts, resource allocation issues, and difficulty reproducing environments across different systems or between local and cloud deployments.
    • Tools like Anaconda and "pipenv" help manage Python and package versions, but they often fall short in managing system-level dependencies such as CUDA and cuDNN.
    Virtual Machines vs Containers
    • Virtual machines (VMs) like VirtualBox or VMware allow multiple operating systems to run on a host, but they pre-allocate resources (RAM, CPU) up front and have limited access to host GPUs, restricting usability for machine learning tasks.
    • Docker uses containerization to package applications and dependencies, allowing containers to share host resources dynamically and to access the GPU directly, which is essential for ML workloads.
    Benefits of Docker for Machine Learning
    • Dockerfiles describe the entire guest operating system and software environment in code, enabling complete automation and repeatability of environment setup.
    • Containers created from Dockerfiles use only the necessary resources at runtime and avoid interfering with the host OS, making it easy to switch projects, share setups, or scale deployments.
    • GPU support in Docker allows machine learning engineers to leverage their hardware regardless of host OS (with best results on Windows and Linux with Nvidia cards).
    • On Windows, enabling GPU support requires switching to the Dev/Insider channel and installing specific Nvidia drivers alongside WSL2 and Nvidia-Docker.
    • Macs are less suitable for GPU-accelerated ML due to their AMD graphics cards, although workarounds like PlaidML exist.
    Cloud Deployment and Reproducibility
    • Deploying machine learning models traditionally required manual replication of environments on cloud servers, such as EC2 instances, which is time-consuming and error-prone.
    • With Docker, the same Dockerfile can be used locally and in the cloud (AWS ECS, Batch, Fargate, EKS, or SageMaker), ensuring the deployed environment matches local development exactly.
    • AWS ECS is suited for long-lived container services, while AWS Batch can be used for one-off or periodic jobs, offering cost-effective use of spot instances for GPU workloads.
    Using Pre-Built Docker Images
    • Docker Hub provides pre-built images for ML environments, such as nvcr.io's CUDA/cuDNN images and HuggingFace's transformers setups, which can be inherited in custom Dockerfiles.
    • These images ensure compatibility between key ML libraries (PyTorch, TensorFlow, CUDA, cuDNN) and reduce setup friction.
    • Custom kitchen-sink images, like those in the "ml-tools" repository, offer a turnkey solution for getting started with machine learning in Docker.
    Project Isolation and Maintenance
    • With Docker, each project can have a fully isolated environment, preventing dependency conflicts and simplifying switching between projects.
    • Updates or configuration changes are tracked and versioned in the Dockerfile, maintaining a single source of truth for the entire environment.
    • Modifying the Dockerfile to add dependencies or update versions ensures that local and cloud environments remain synchronized.
    Host OS Recommendations for ML Development
    • Windows is recommended for local development with Docker, offering better desktop experience and driver support than Ubuntu for most users, particularly on laptops.
    • GPU-accelerated ML is not practical on Macs due to hardware limitations, while Ubuntu is suitable for advanced users comfortable with system configuration and driver management.
    Useful Links
    • Docker
    • Instructions: Windows Dev Channel & WSL2 with nvidia-docker support
    • Nvidia's guide for CUDA on WSL2
    • WSL2 & Docker odds-and-ends
    • nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04 Docker Image
    • huggingface/transformers-gpu
    • ml-tools kitchen-sink Dockerfiles
    • Machine learning hardware guidance
    • Front-end stack + cloud-hosting info
    • ML cloud-hosting info
    32 min
  • MLG 032 Cartesian Similarity Metrics

    Try a walking desk to stay healthy while you study or work!

    Show notes at ocdevel.com/mlg/32.

    L1/L2 norm, Manhattan, Euclidean, cosine distances, dot product

    Normed distances link

    • A norm is a function that assigns a strictly positive length to each vector in a vector space. link
    • Minkowski is generalized. p_root(sum(xi-yi)^p). "p" = ? (1, 2, ..) for below.
    • L1: Manhattan/city-block/taxicab. abs(x2-x1)+abs(y2-y1). Grid-like distance (triangle legs). Preferred for high-dim space.
    • L2: Euclidean. sqrt((x2-x1)^2+(y2-y1)^2. sqrt(dot-product). Straight-line distance; min distance (Pythagorean triangle edge)
    • Others: Mahalanobis, Chebyshev (p=inf), etc

    Dot product

    • A type of inner product. Outer-product: lies outside the involved planes. Inner-product: dot product lies inside the planes/axes involved link. Dot product: inner product on a finite dimensional Euclidean space link

    Cosine (normalized dot)

    42 min
  • MLA 011 Practical Clustering Tools

    Primary clustering tools for practical applications include K-means using scikit-learn or Faiss, agglomerative clustering leveraging cosine similarity with scikit-learn, and density-based methods like DBSCAN or HDBSCAN. For determining the optimal number of clusters, silhouette score is generally preferred over inertia-based visual heuristics, and it natively supports pre-computed distance matrices.

    Links
    • Notes and resources at ocdevel.com/mlg/mla-11
    • Try a walking desk stay healthy & sharp while you learn & code
    K-means Clustering
    • K-means is the most widely used clustering algorithm and is typically the first method to try for general clustering tasks.
    • The scikit-learn KMeans implementation is suitable for small to medium-sized datasets, while Faiss's kmeans is more efficient and accurate for very large datasets.
    • K-means requires the number of clusters to be specified in advance and relies on the Euclidean distance metric, which performs poorly in high-dimensional spaces.
    • When document embeddings have high dimensionality (e.g., 768 dimensions from sentence transformers), K-means becomes less effective due to the limitations of Euclidean distance in such spaces.
    Alternatives to K-means for High Dimensions
    • For text embeddings with high dimensionality, agglomerative (hierarchical) clustering methods are preferable, particularly because they allow the use of different similarity metrics.
    • Agglomerative clustering in scikit-learn accepts a pre-computed cosine similarity matrix, which is more appropriate for natural language processing.
    • Constructing the pre-computed distance (or similarity) matrix involves normalizing vectors and computing dot products, which can be efficiently achieved with linear algebra libraries like PyTorch.
    • Hierarchical algorithms do not use inertia in the same way as K-means and instead rely on external metrics, such as silhouette score.
    • Other clustering algorithms exist, including spectral, mean shift, and affinity propagation, which are not covered in this episode.
    Semantic Search and Vector Indexing
    • Libraries such as Faiss, Annoy, and HNSWlib provide approximate nearest neighbor search for efficient semantic search on large-scale vector data.
    • These systems create an index of your embeddings to enable rapid similarity search, often with the ability to specify cosine similarity as the metric.
    • Sample code using these libraries with sentence transformers can be found in the UKP Lab sentence-transformers examples directory.
    Determining the Optimal Number of Clusters
    • Both K-means and agglomerative clustering require a predefined number of clusters, but this is often unknown beforehand.
    • The "elbow" method involves running the clustering algorithm with varying cluster counts and plotting the inertia (sum of squared distances within clusters) to visually identify the point of diminishing returns; see kmeans.inertia_.
    • The kneed package can automatically detect the "elbow" or "knee" in the inertia plot, eliminating subjective human judgment; sample code available here.
    • The silhouette score, calculated via silhouette_score, considers both inter- and intra-cluster distances and allows for direct selection of the number of clusters with the maximum score.
    • The silhouette score can be computed using a pre-computed distance matrix (such as from cosine similarities), making it well-suited for applications involving non-Euclidean metrics and hierarchical clustering.
    Density-Based Clustering: DBSCAN and HDBSCAN
    • DBSCAN is a hierarchical clustering method that does not require specifying the number of clusters, instead discovering clusters based on data density.
    • HDBSCAN is a more popular and versatile implementation of density-based clustering, capable of handling various types of data without significant parameter tuning.
    • DBSCAN and HDBSCAN can be preferable to K-means or agglomerative clustering when automatic determination of cluster count or robustness to noise is important.
    • However, these algorithms may not perform well with all types of high-dimensional embedding data, as illustrated by the challenges faced when clustering 768-dimensional text embeddings.
    Summary Recommendations and Links
    • For low- to medium-sized, low-dimensional data, use K-means with silhouette score to choose the optimal number of clusters: scikit-learn KMeans, silhouette_score.
    • For very large data or vector search, use Faiss.kmeans.
    • For high-dimensional data using cosine similarity, use Agglomerative Clustering with a pre-computed square matrix of cosine similarities; sample code.
    • For density-based clustering, consider DBSCAN or HDBSCAN.
    • Exploratory code and further examples can be found in the UKP Lab sentence-transformers examples.
    35 min
  • MLA 010 NLP packages: transformers, spaCy, Gensim, NLTK

    The landscape of Python natural language processing tools has evolved from broad libraries like NLTK toward more specialized packages such as Gensim for topic modeling, SpaCy for linguistic analysis, and Hugging Face Transformers for advanced tasks, with Sentence Transformers extending transformer models to enable efficient semantic search and clustering. Each library occupies a distinct place in the NLP workflow, from fundamental text preprocessing to semantic document comparison and large-scale language understanding.

    Links
    • Notes and resources at ocdevel.com/mlg/mla-10
    • Try a walking desk stay healthy & sharp while you learn & code
    Historical Foundation: NLTK
    • NLTK ("Natural Language Toolkit") was one of the earliest and most popular Python libraries for natural language processing, covering tasks from tokenization and stemming to document classification and syntax parsing.
    • NLTK remains a catch-all "Swiss Army knife" for NLP, but many of its functions have been supplemented or superseded by newer tools tailored to specific tasks.
    Specialized Topic Modeling and Phrase Analysis: Gensim
    • Gensim emerged as the leading library for topic modeling in Python, most notably via its LDA Topic Modeling implementation, which groups documents according to topic distributions.
    • Topic modeling workflows often use NLTK for initial preprocessing (tokenization, stop word removal, lemmatization), then vectorize with scikit-learn's TF-IDF, and finally model topics with Gensim's LDA.
    • Gensim also provides effective Bigrams/Trigrams, allowing the detection and combination of commonly-used word pairs or triplets (n-grams) to enhance analysis accuracy.
    Linguistic Structure and Manipulation: SpaCy and Related Tools
    • spaCy is a deep-learning-based library for high-performance linguistic analysis, focusing on tasks such as part-of-speech tagging, named entity recognition, and syntactic parsing.
    • SpaCy supports integrated sentence and word tokenization, stop word removal, and lemmatization, but for advanced lemmatization and inflection, LemmInflect can be used to derive proper inflections for part-of-speech tags.
    • For even more accurate (but slower) linguistic tasks, consider Stanford CoreNLP via SpaCy integration as spacy-stanza.
    • SpaCy can examine parse trees to identify sentence components, enabling sophisticated NLP applications like grammatical corrections and intent detection in conversation agents.
    High-Level NLP Tasks: Hugging Face Transformers
    • huggingface/transformers provides interfaces to transformer-based models (like BERT and its successors) capable of advanced NLP tasks including question answering, summarization, translation, and sentiment analysis.
    • Its Pipelines allow users to accomplish over ten major NLP applications with minimal code.
    • The library's model repository hosts a vast collection of pre-trained models that can be used for both research and production.
    Semantic Search and Clustering: Sentence Transformers
    • UKPLab/sentence-transformers extends the transformer approach to create dense document embeddings, enabling semantic search, clustering, and similarity comparison via cosine distance or similar metrics.
    • Example applications include finding the most similar documents, clustering user entries, or summarizing clusters of text.
    • The repository offers application examples for tasks such as semantic search and clustering, often using cosine similarity.
    • For very large-scale semantic search (such as across Wikipedia), approximate nearest neighbor (ANN) libraries like Annoy, FAISS, and hnswlib enable rapid similarity search with embeddings; practical examples are provided in the Sentence Transformers documentation.
    Additional Resources and Library Landscape
    • For a comparative overview and discovery of further libraries, see Analytics Steps Top 10 NLP Libraries in Python, which reviews several packages beyond those discussed here.
    Summary of Library Roles and Use Cases
    • NLTK: Foundational and comprehensive for most classic NLP needs; still covers a broad range of preprocessing and basic analytic tasks.
    • Gensim: Best for topic modeling and phrase extraction (bigrams/trigrams); especially useful in workflows relying on document grouping and label generation.
    • SpaCy: Leading tool for syntactic, linguistic, and grammatical analysis; supports integration with advanced lemmatizers and external tools like Stanford CoreNLP.
    • Hugging Face Transformers: The standard for modern, high-level NLP tasks and quick prototyping, featuring simple pipelines and an extensive model hub.
    • Sentence Transformers: The main approach for embedding text for semantic search, clustering, and large-scale document comparison, supporting ANN methodologies via companion libraries.
    27 min
  • MLA 009 Charting and Visualization Tools for Data Science

    Python charting libraries - Matplotlib, Seaborn, and Bokeh - explaining, their strengths from quick EDA to interactive, HTML-exported visualizations, and clarifies where D3.js fits as a JavaScript alternative for end-user applications. It also evaluates major software solutions like Tableau, Power BI, QlikView, and Excel, detailing how modern BI tools now integrate drag-and-drop analytics with embedded machine learning, potentially allowing business users to automate entire workflows without coding.

    Links
    • Notes and resources at ocdevel.com/mlg/mla-9
    • Try a walking desk stay healthy & sharp while you learn & code
    Core Phases in Data Science Visualization
    • Exploratory Data Analysis (EDA):
      • EDA occupies an early stage in the Business Intelligence (BI) pipeline, positioned just before or sometimes merged with the data cleaning ("munging") phase.
      • The outputs of EDA (e.g., correlation matrices, histograms) often serve as inputs to subsequent machine learning steps.
    Python Visualization Libraries 1. Matplotlib
    • The foundational plotting library in Python, supporting static, basic chart types.
    • Requires substantial boilerplate code for custom visualizations.
    • Serves as the core engine for many higher-level visualization tools.
    • Common EDA tasks (like plotting via .corr(), .hist(), and .scatter() methods on pandas DataFrames) depend on Matplotlib under the hood.
    2. Pandas Plotting
    • Pandas integrates tightly with Matplotlib and exposes simple, one-line commands for common plots (e.g., df.corr(), df.hist()).
    • Designed to make quick EDA accessible without requiring detailed knowledge of Matplotlib's verbose syntax.
    3. Seaborn
    • A high-level wrapper around Matplotlib, analogous to how Keras wraps TensorFlow.
    • Sets sensible defaults for chart styles, fonts, colors, and sizes, improving aesthetics with minimal effort.
    • Importing Seaborn can globally enhance the appearance of all Matplotlib plots, even without direct usage of Seaborn's plotting functions.
    4. Bokeh
    • A powerful library for creating interactive, web-ready plots from Python.
    • Enables user interactions such as hovering, zooming, and panning within rendered plots.
    • Exports visualizations as standalone HTML files or can operate as a server-linked app for live data exploration.
    • Supports advanced features like cross-filtering, allowing dynamic slicing and dicing of data across multiple axes or columns.
    • More suited for creating reusable, interactive dashboards rather than quick, one-off EDA visuals.
    5. D3.js
    • Unlike previous libraries, D3.js is a JavaScript framework for creating complex, highly customized data visualizations for web and mobile apps.
    • Used predominantly on the client-side to build interactive front-end graphics for end users, not as an EDA tool for analysts.
    • Common in production-grade web apps, but not typically part of a Python-based data science workflow.
    Dedicated Visualization and BI Software Tableau
    • Leading commercial drag-and-drop BI tool for data visualization and dashboarding.
    • Connects to diverse data sources (CSV, Excel, databases), auto-detects column types, and suggests default chart types.
    • Users can interactively build visualizations, cross-filter data, and switch chart types without coding.
    Power BI
    • Microsoft's BI suite, similar to Tableau, supporting end-to-end data analysis and visualization.
    • Integrates data preparation, visualization, and increasingly, built-in machine learning workflows.
    • Focused on empowering business users or analysts to run the BI pipeline without programming.
    QlikView
    • Another major BI offering is QlikView, emphasizing interactive dashboards and data exploration.
    Excel
    • Still widely used for basic EDA and visualizations directly on spreadsheets.
    • Offers limited but accessible charting tools for histograms, scatter plots, and simple summary statistics.
    • Data often originates from Excel/CSV files before being ingested for further analysis in Python/pandas.
    Trends & Insights
    • Workflow Integration: Modern BI tools are converging, adding both classic EDA capabilities and basic machine learning modeling, often through a code-free interface.
    • Automation Risks and Opportunities: As drag-and-drop BI tools increase in capabilities (including model training and selection), some data science coding work traditionally required for BI pipelines may become accessible to non-programmers.
    • Distinctions in Use:
      • Python libraries (Matplotlib, Seaborn, Bokeh) excel in automating and scripting EDA, report generation, and static analysis as part of data pipelines.
      • BI software (Tableau, Power BI, QlikView) shines for interactive exploration and democratized analytics, integrated from ingestion to reporting.
      • D3.js stands out for tailored, production-level, end-user app visualizations, rarely leveraged by data scientists for EDA.

    Key Takeaways

    • For quick, code-based EDA: Use Pandas' built-in plotters (wrapping Matplotlib).
    • For pre-styled, pretty plots: Use Seaborn (with or without direct API calls).
    • For interactive, shareable dashboards: Use Bokeh for Python or BI tools for no-code operation.
    • For enterprise, end-user-facing dashboards: Choose BI software like Tableau or build custom apps using D3.js for total control.
    25 min
  • MLA 008 Exploratory Data Analysis (EDA)

    Exploratory data analysis (EDA) sits at the critical pre-modeling stage of the data science pipeline, focusing on uncovering missing values, detecting outliers, and understanding feature distributions through both statistical summaries and visualizations, such as Pandas' info(), describe(), histograms, and box plots. Visualization tools like Matplotlib, along with processes including imputation and feature correlation analysis, allow practitioners to decide how best to prepare, clean, or transform data before it enters a machine learning model.

    Links
    • Notes and resources at ocdevel.com/mlg/mla-8
    • Try a walking desk stay healthy & sharp while you learn & code
    EDA in the Data Science Pipeline
    • Position in Pipeline: EDA is an essential pre-processing step in the business intelligence (BI) or data science pipeline, occurring after data acquisition but before model training.
    • Purpose: The goal of EDA is to understand the data by identifying:
      • Missing values (nulls)
      • Outliers
      • Feature distributions
      • Relationships or correlations between variables
    Data Acquisition and Initial Inspection
    • Data Sources: Data may arrive from various streams (e.g., Twitter, sensors) and is typically stored in structured formats such as databases or spreadsheets.
    • Loading Data: In Python, data is often loaded into a Pandas DataFrame using commands like pd.read_csv('filename.csv').
    • Initial Review:
      • df.info(): Displays data types and counts of non-null entries by column, quickly highlighting missing values.
      • df.describe(): Provides summary statistics for each column, including count, mean, standard deviation, min/max, and quartiles.
    Handling Missing Data and Outliers
    • Imputation:
      • Missing values must often be filled (imputed), as most machine learning algorithms cannot handle nulls.
      • Common strategies: impute with mean, median, or another context-appropriate value.
      • For example, missing ages can be filled with the column's average rather than zero, to avoid introducing skew.
    • Outlier Strategy:
      • Outliers can be removed, replaced (e.g., by nulls and subsequently imputed), or left as-is if legitimate.
      • Treatment depends on whether outliers represent true data points or data errors.
    Visualization Techniques
    • Purpose: Visualizations help reveal data distributions, outliers, and relationships that may not be apparent from raw statistics.
    • Common Visualization Tools:
      • Matplotlib: The primary Python library for static data visualizations.
      • Visualization Methods:
        • Histogram: Ideal for visualizing the distribution of a single variable (e.g., age), making outliers visible as isolated bars.
        • Box Plot: Summarizes quartiles, median, and range, with 'whiskers' showing min/max; useful for spotting outliers and understanding data spread.
        • Line Chart: Used for time-series data, highlighting trends and anomalies (e.g., sudden spikes in stock price).
        • Correlation Matrix: Visual grid (often of scatterplots) comparing each feature against every other, helping to detect strong or weak linear relationships between features.
    Feature Correlation and Dimensionality
    • Correlation Plot:
      • Generated with df.corr() in Pandas to assess linear relationships between features.
      • High correlation between features may suggest redundancy (e.g., number of bedrooms and square footage) and inform feature selection or removal.
    • Limitations:
      • While correlation plots provide intuition, automated approaches like Principal Component Analysis (PCA) or autoencoders are typically superior for feature reduction and target prediction tasks.
    Data Transformation Prior to Modeling
    • Scaling:
      • Machine learning models, especially neural networks, often require input features to be scaled (normalized or standardized).
      • StandardScaler (from scikit-learn): Standardizes features, but is sensitive to outliers.
      • RobustScaler: A variant that compresses the influence of outliers, keeping data within interquartile ranges, simplifying preprocessing steps.
    Summary of EDA Workflow
    • Initial Steps:
      • Load data into a DataFrame.
      • Examine data types and missing values with df.info().
      • Review summary statistics with df.describe().
    • Visualization:
      • Use histograms and box plots to explore feature distributions and detect anomalies.
      • Leverage correlation matrices to identify related features.
    • Data Preparation:
      • Impute missing values thoughtfully (e.g., with means or medians).
      • Decide on treatment for outliers: removal, imputation, or scaling with tools like RobustScaler.
    • Outcome:
      • Proper EDA ensures that data is cleaned, features are well-understood, and inputs are suitable for effective machine learning model training.
    26 min
  • MLA 007 Jupyter Notebooks

    Jupyter Notebooks, originally conceived as IPython Notebooks, enable data scientists to combine code, documentation, and visual outputs in an interactive, browser-based environment supporting multiple languages like Python, Julia, and R. This episode details how Jupyter Notebooks structure workflows into executable cells - mixing markdown explanations and inline charts - which is essential for documenting, demonstrating, and sharing data analysis and machine learning pipelines step by step.

    Links
    • Notes and resources at ocdevel.com/mlg/mla-7
    • Try a walking desk stay healthy & sharp while you learn & code
    Overview of Jupyter Notebooks
    • Historical Context and Scope

      • Jupyter Notebooks began as IPython Notebooks focused solely on Python.
      • The project was renamed Jupyter to support additional languages - namely Julia ("JU"), Python ("PY"), and R ("R") - broadening its applicability for data science and machine learning across multiple languages.
    • Interactive, Narrative-Driven Coding

      • Jupyter Notebooks allow for the mixing of executable code, markdown documentation, and rich media outputs within a browser-based interface.
      • The coding environment is structured as a sequence of cells where each cell can independently run code and display its output directly underneath.
      • Unlike traditional Python scripts, which output results linearly and impermanently, Jupyter Notebooks preserve the stepwise development process and its outputs for later review or publication.
    Typical Workflow Example
    • Stepwise Data Science Pipeline Construction
      • Import necessary libraries: Each new notebook usually starts with a cell for imports (e.g., matplotlib, scikit-learn, keras, pandas).
      • Data ingestion phase: Read data into a pandas DataFrame via read_csv for CSVs or read_sql for databases.
      • Exploratory analysis steps: Use DataFrame methods like .info() and .describe() to inspect the dataset; results are rendered below the respective cell.
      • Model development: Train a machine learning model - for example using Keras - and output performance metrics such as loss, mean squared error, or classification accuracy directly beneath the executed cell.
      • Data visualization: Leverage charting libraries like matplotlib to produce inline plots (e.g., histograms, correlation matrices), which remain visible as part of the notebook for later reference.
    Publishing and Documentation Features
    • Markdown Support and Storytelling

      • Markdown cells enable the inclusion of formatted explanations, section headings, bullet points, and even inline images and videos, allowing for clear documentation and instructional content interleaved with code.
      • This format makes it simple to delineate different phases of a pipeline (e.g., "Data Ingestion", "Data Cleaning", "Model Evaluation") with descriptive context.
    • Inline Visual Outputs

      • Outputs from code cells, such as tables, charts, and model training logs, are preserved within the notebook interface, making it easy to communicate findings and reasoning steps alongside the code.
      • Visualization libraries (like matplotlib) can render charts directly in the notebook without the need to generate separate files.
    • Reproducibility and Sharing

      • Notebooks can be published to platforms like GitHub, where the full code, markdown, and most recent cell outputs are viewable in-browser.
      • This enables transparent workflow documentation and facilitates tutorials, blog posts, and collaborative analysis.
    Practical Considerations and Limitations
    • Cell-based Execution Flexibility

      • Each cell can be run independently, so developers can repeatedly rerun specific steps (e.g., re-trying a modeling cell after code fixes) without needing to rerun the entire notebook.
      • This is especially useful for iterative experimentation with large or slow-to-load datasets.
    • Primary Use Cases

      • Jupyter Notebooks excel at "storytelling" - presenting an analytical or modeling process along with its rationale and findings, primarily for publication or demonstration.
      • For regular development, many practitioners prefer traditional editors or IDEs (like PyCharm or Vim) due to advanced features such as debugging, code navigation, and project organization.
    Summary

    Jupyter Notebooks serve as a central tool for documenting, presenting, and sharing the entirety of a machine learning or data analysis pipeline - combining code, output, narrative, and visualizations into a single, comprehensible document ideally suited for tutorials, reports, and reproducible workflows.

    17 min

About Machine Learning Guide

From the publisher's feed

Machine learning audio course, teaching the fundamentals of machine learning and artificial intelligence. It covers intuition, models (shallow and deep), math, languages, frameworks, etc. Where yourโ€ฆ

Best of Machine Learning Guide

Ranked by our users in the last 21 days

  1. Number 2: MLG 022 Deep NLP 1
    50 min

More shows like Machine Learning Guide

The Changelog: Software Development, Open Source by Changelog Media

The Changelog: Software Development, Open Source

286 Listeners

Data Skeptic by Kyle Polich

Data Skeptic

477 Listeners

Software Engineering Daily by Software Engineering Daily

Software Engineering Daily

623 Listeners

Talk Python To Me by Michael Kennedy

Talk Python To Me

581 Listeners

Super Data Science: ML & AI Podcast with Jon Krohn by Jon Krohn

Super Data Science: ML & AI Podcast with Jon Krohn

302 Listeners

NVIDIA AI Podcast by NVIDIA

NVIDIA AI Podcast

339 Listeners

Syntax - Tasty Web Development Treats by Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

Syntax - Tasty Web Development Treats

983 Listeners

AI Today Podcast by AI & Data Today

AI Today Podcast

153 Listeners

DataFramed by DataCamp

DataFramed

265 Listeners

Practical AI by Daniel Whitenack and Chris Benson

Practical AI

205 Listeners

Google DeepMind: The Podcast by Hannah Fry

Google DeepMind: The Podcast

203 Listeners

The Real Python Podcast by Real Python

The Real Python Podcast

140 Listeners

Machine Learning Street Talk (MLST) by Machine Learning Street Talk (MLST)

Machine Learning Street Talk (MLST)

97 Listeners

This Day in AI Podcast by Michael Sharkey, Chris Sharkey

This Day in AI Podcast

221 Listeners

The AI Daily Brief: Artificial Intelligence News and Analysis by Nathaniel Whittemore

The AI Daily Brief: Artificial Intelligence News and Analysis

679 Listeners