xiaohongshu
xiaohongshu
data-scientist
Expert in statistical analysis, predictive modeling, machine learning, and data storytelling to drive business insights.
Full skill instructions
Provides statistical analysis and predictive modeling expertise specializing in machine learning, experimental design, and causal inference. Builds rigorous models and translates complex statistical findings into actionable business insights with proper validation and uncertainty quantification.
Goal: Understand data distribution, quality, and relationships before modeling.
Steps:
Load and Profile Data
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
# Load data
df = pd.read_csv("customer_data.csv")
# Basic profiling
print(df.info())
print(df.describe())
# Missing values analysis
missing = df.isnull().sum() / len(df)
print(missing[missing > 0].sort_values(ascending=False))
Univariate Analysis (Distributions)
# Numerical features
num_cols = df.select_dtypes(include=[np.number]).columns
for col in num_cols:
plt.figure(figsize=(10, 4))
plt.subplot(1, 2, 1)
sns.histplot(df[col], kde=True)
plt.subplot(1, 2, 2)
sns.boxplot(x=df[col])
plt.show()
# Categorical features
cat_cols = df.select_dtypes(exclude=[np.number]).columns
for col in cat_cols:
print(df[col].value_counts(normalize=True))
Bivariate Analysis (Relationships)
# Correlation matrix
corr = df.corr()
sns.heatmap(corr, annot=True, cmap='coolwarm')
# Target vs Features
target = 'churn'
sns.boxplot(x=target, y='tenure', data=df)
Data Cleaning
# Impute missing values
df['age'].fillna(df['age'].median(), inplace=True)
df['category'].fillna('Unknown', inplace=True)
# Handle outliers (Example: Cap at 99th percentile)
cap = df['income'].quantile(0.99)
df['income'] = np.where(df['income'] > cap, cap, df['income'])
Verification:
Goal: Analyze results of a website conversion experiment.
Steps:
Define Hypothesis
Load and Aggregate Data
# data: ['user_id', 'group', 'converted']
results = df.groupby('group')['converted'].agg(['count', 'sum', 'mean'])
results.columns = ['n_users', 'conversions', 'conversion_rate']
print(results)
Statistical Test (Proportions Z-test)
from statsmodels.stats.proportion import proportions_ztest
control = results.loc['A']
treatment = results.loc['B']
count = np.array([treatment['conversions'], control['conversions']])
nobs = np.array([treatment['n_users'], control['n_users']])
stat, p_value = proportions_ztest(count, nobs, alternative='larger')
print(f"Z-statistic: {stat:.4f}")
print(f"P-value: {p_value:.4f}")
Confidence Intervals
from statsmodels.stats.proportion import proportion_confint
(lower_con, lower_treat), (upper_con, upper_treat) = proportion_confint(count, nobs, alpha=0.05)
print(f"Control CI: [{lower_con:.4f}, {upper_con:.4f}]")
print(f"Treatment CI: [{lower_treat:.4f}, {upper_treat:.4f}]")
Conclusion
Goal: Estimate impact of a "Premium Membership" on "Spend" when A/B test isn't possible (observational data).
Steps:
Problem Setup
Calculate Propensity Scores
from sklearn.linear_model import LogisticRegression
# P(Treatment=1 | Confounders)
confounders = ['age', 'income', 'tenure']
logit = LogisticRegression()
logit.fit(df[confounders], df['is_premium'])
df['propensity_score'] = logit.predict_proba(df[confounders])[:, 1]
# Check overlap (Common Support)
sns.histplot(data=df, x='propensity_score', hue='is_premium', element='step')
Matching (Nearest Neighbor)
from sklearn.neighbors import NearestNeighbors
# Separate groups
treatment = df[df['is_premium'] == 1]
control = df[df['is_premium'] == 0]
# Find neighbors for treatment group in control group
nn = NearestNeighbors(n_neighbors=1, algorithm='ball_tree')
nn.fit(control[['propensity_score']])
distances, indices = nn.kneighbors(treatment[['propensity_score']])
# Create matched dataframe
matched_control = control.iloc[indices.flatten()]
# Compare outcomes
ate = treatment['spend'].mean() - matched_control['spend'].mean()
print(f"Average Treatment Effect (ATE): ${ate:.2f}")
Validation (Balance Check)
abs(mean_diff) / pooled_std < 0.1 (Standardized Mean Difference).What it looks like:
Why it fails:
Correct approach:
X_train, then transform X_test.Pipeline objects to ensure safety.What it looks like:
Why it fails:
Correct approach:
What it looks like:
Why it fails:
Correct approach:
scale_pos_weight in XGBoost, class_weight='balanced' in Sklearn.Methodology & Rigor:
Code & Reproducibility:
requirements.txt or environment.yml.random_state=42).Interpretation & Communication:
Performance:
Scenario: Product team wants to know if a new recommendation algorithm increases user engagement.
Analysis Approach:
Key Analysis:
# Bootstrap confidence interval for difference in means
from scipy import stats
diff = treatment_means - control_means
ci = np.percentile(bootstrap_diffs, [2.5, 97.5])
Outcome: Feature launched with 95% probability of positive impact
Scenario: Retail chain needs to forecast next-quarter sales for inventory planning.
Modeling Approach:
Results:
| Model | MAPE | 90% CI Width |
|---|---|---|
| ARIMA | 12.3% | ±15% |
| Prophet | 9.8% | ±12% |
| XGBoost | 7.2% | ±9% |
Deliverable: Production model with automated retraining pipeline
Scenario: Marketing wants to understand which channels drive actual conversions vs. appear correlated.
Causal Methods:
Key Findings:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience