By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Feature types and statistics (descriptive and inferential) are the foundation of any ML pipeline. Descriptive statistics (mean, variance, distributions) help you understand your data, while inferential statistics (hypothesis testing, confidence intervals) help you generalize findings from samples to populations. In AWS ML workflows, these concepts are critical for: - Feature engineering (e.g., normalizing numerical features, encoding categorical variables).- Data validation (e.g., detecting drift in SageMaker Model Monitor).- Model interpretability (e.g., explaining feature importance in SageMaker Clarify).
Real-world scenario:A fintech company builds a fraud detection model using Amazon SageMaker. Before training, they use descriptive statistics (e.g., histograms of transaction amounts, correlation matrices) to identify outliers and skewed features. After deployment, they use inferential statistics (e.g., Kolmogorov-Smirnov tests in SageMaker Model Monitor) to detect feature drift (e.g., a sudden spike in high-value transactions) and trigger retraining.
merchant_type=[0,1,0]
risk_rating=[1,2,3]
Goal: Understand feature distributions, missing values, and outliers.Steps:1. Load data into SageMaker Data Wrangler (or a SageMaker Notebook with pandas).2. Compute descriptive stats: - Numerical: df.describe() (mean, std, min/max, quartiles). - Categorical: df['category'].value_counts().3. Visualize distributions: - Histograms (numerical), bar plots (categorical), box plots (outliers). - Use SageMaker Data Wrangler’s built-in visualizations or matplotlib/seaborn.4. Handle missing data: - Drop rows/columns (df.dropna()) or impute (mean/median for numerical, mode for categorical). - Use SageMaker Processing for large-scale imputation.
df.describe()
df['category'].value_counts()
df.dropna()
Goal: Transform raw data into features usable by ML models.Steps:1. Encode categorical features: - One-hot encoding (for nominal categories) → pd.get_dummies(). - Label encoding (for ordinal categories) → sklearn.preprocessing.LabelEncoder. - Target encoding (for high-cardinality categories) → Use SageMaker Processing to avoid leakage.2. Scale numerical features: - Standardization (z-score) → sklearn.preprocessing.StandardScaler. - Normalization (min-max) → sklearn.preprocessing.MinMaxScaler.3. Create new features: - Time-based: Extract day/month/year from timestamps. - Aggregations: Rolling averages (for time-series). - Text: TF-IDF or embeddings (via SageMaker JumpStart or Amazon Comprehend).4. Store features in SageMaker Feature Store: - Create a Feature Group (online/offline). - Ingest data via SageMaker Processing or AWS Glue. - Query features for training/inference via FeatureStore SDK.
pd.get_dummies()
sklearn.preprocessing.LabelEncoder
sklearn.preprocessing.StandardScaler
sklearn.preprocessing.MinMaxScaler
FeatureStore
Goal: Monitor features for drift in production.Steps:1. Set up SageMaker Model Monitor: - Attach a Monitoring Schedule to a SageMaker endpoint. - Configure baseline statistics (from training data).2. Define drift thresholds: - KS test (numerical features): Default threshold = 0.01 (p-value). - PSI (categorical features): Default threshold = 0.25 (moderate drift).3. Run drift analysis: - Model Monitor compares current data (inference) vs. baseline (training). - Generates CloudWatch alerts if drift exceeds thresholds.4. Take action: - Retrain model if drift is detected. - Investigate root cause (e.g., data pipeline changes).
user_id
sklearn.impute.IterativeImputer
gender
A retail company uses SageMaker to train a demand forecasting model. After deployment, they notice that the model’s predictions are consistently off for high-value items. SageMaker Model Monitor reports a KS test p-value of 0.001 for the item_price feature. What does this indicate, and what action should they take?
item_price
Answer:The KS test p-value of 0.001 indicates statistically significant drift in the item_price feature (p < 0.01). The team should retrain the model with updated data and investigate why the price distribution changed (e.g., new pricing strategy, data pipeline error).
A data scientist is building a fraud detection model using SageMaker XGBoost. They have a categorical feature merchant_category with 50 unique values. Which encoding method should they use to avoid the curse of dimensionality, and why?
merchant_category
Answer:They should use target encoding (with smoothing) or embeddings (for deep learning). One-hot encoding would create 50 new features, leading to sparse data and poor model performance. Target encoding replaces categories with the mean of the target variable (fraud rate per category), reducing dimensionality.
A team is using SageMaker Feature Store to serve features for a real-time recommendation system. During inference, they notice that online feature retrieval latency is high. What are two possible causes, and how can they fix them?
Answer:1. Cause: The Feature Group is not optimized for online access (e.g., too many features or large feature values). Fix: Use smaller feature groups or compress feature values (e.g., use float32 instead of float64).2. Cause: The Feature Store TTL (Time-to-Live) is too short, causing frequent cache misses. Fix: Increase the TTL (default = 1 hour) to reduce backend queries.
float32
float64
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.