Posts

Showing posts with the label ML

ML Exam Prep: 10 - Key Algorithms

ML Exam Prep Key Algorithms  Common Algorithms: K-Means algorithm = UL . No e vent planning by 1) K = # of K leaders for people to cluster around, 2) each data point finds closest leader, and 3) the leader moves to the Means = math mean (center) of their group. finds hidden or unlabeled patterns.  KNN algorithm = SL. C lassification . finds absolute distance of data point to class of its neighbors. Ex answers : "Apple", "Orange", "Spam", "Not Spam". Label encoding =  City name  ("Dallas", "Paris", "London") to single column of City of (1, 2, 3).  Linear regression algorithm = SL. predicts "best-fit" line of min diff between input and output.  Can be negative. Answer is continuous range.   D isadv: fails with skewed data.  Logistic regression algorithm = SL. C lassification. e stimates % that input is in category by predicting binary outcome of using Logistic function and Log-odds .  Answer is 0 to 1. O...

ML Exam Prep: 9 - Misc

  ML Exam Prep Misc Search Types 1) Lexical search: matches exact words 2) Semantic search: understands concept   3) Contextual search: adapts results using user data or surrounding conversation Deployment   Types Canary = deploy to alpha sites (small subset of users or servers). A/B testing  = concurrent. some goes to new and rest to production. Shadow =  incoming are mirrored or copied and sent to production and new potential. New potential is logged and analyzed on metrics, but *only* answers from production are returned to end-users. Blue/Green = All goes to “blue“ (production). Once "green" (new version) is ready, traffic switched over. Has a safe rollback mechanism and min downtime. No parallel testing of new model.  Hyperparameters Temperature =  chaos\creative of response Top K = is # of tokens. More tokens = more diverse/chaos of responses. Misc Categorical model = classification model. Data Bias & Security Pre-Training Bias Metr...

ML Exam Prep: 8 - Model Fitting and Tuning

ML Exam Prep Model Fitting and Tuning Problems: 1. Overfitting (Model is too complex) The Problem:   Great on training data since memorizes (including its noise and random errors) or  too many training epochs,  instead of patterns.  Terrible on new data. "High Variance" model. If the  loss curve is affected ( validation loss increases, while training loss decreases), it‘s a strong indicator of overfitting. Fix - Simplify the Model: 1) Early Stopping : Halts when validation loss begins to rise. 2) Increase Regularization : Penalizes extreme values; L1 (Lasso) zeroes out weak features, L2 (Ridge) shrinks them. If L1 and all features go to 0, then decrease regularization parameter. 3) Increase Dropout : Randomly shuts off neurons during training. 4) Fewer Feature Combinations : Removes complex or noisy inputs . 5) Data Augmentation : Tweaks existing training samples (e.g., rotating images) to create new variety. 6) Use Cross-Validation : By rotating t...

ML Exam: 7 - End-to-End Process

Image
ML Exam: 7 - End-to-End Process 1. Define Business Problem and Data Objectives Pick core metric to optimize (e.g., churn rate, fraud detection). See if requires supervised, unsupervised, or reinforcement learning. Map out data availability, regulatory compliance boundaries, and project success metrics. 2. Data Ingestion and Collection Aggregate raw structured, semi-structured, or unstructured data into cloud storage. Use S3 as the centralized data lake landing zone. Import streaming data in real time using Kinesis . Extract relational database data using Glue or DMS . 3. Data Cleansing and Preparation Clean raw datasets by handling missing values, filtering duplicates, and removing outliers. Transform features using SageMaker Data Wrangler to visually profile data quality. Standardize, normalize, and tokenize data text or resize images for computer vision. Store fully processed, reusable data features in the SageMaker Feature Store . 4. Data Labeling and Annotation Add ground-truth ...