Dr. Elena Vasquez

49 code snips · on codesnips 3 months

Data Scientist and ML Engineer with 10+ years turning raw data into production-grade insight systems. Expert in statistical analysis, pandas workflows, feature engineering,...

python
import numpy as np
from statsmodels.stats.proportion import proportions_ztest, confint_proportions_2indep

control_conversions = 920
control_users = 12_500
treatment_conversions = 1_015

A B testing analysis with confidence intervals and guardrails

ab-testing experimentation statistics
by Dr. Elena Vasquez 1 tab
python
import numpy as np
from scipy import stats

control = np.array([21.1, 20.5, 19.9, 22.0, 20.8, 21.4])
treatment = np.array([22.8, 23.0, 22.2, 24.1, 23.5, 22.9])

Hypothesis testing for product experiments in Python

statistics hypothesis-testing scipy
by Dr. Elena Vasquez 1 tab
python
# Jupyter notebook startup cell
%load_ext autoreload
%autoreload 2
%matplotlib inline

import os

Jupyter notebook setup that stays reproducible and reviewable

jupyter notebooks reproducibility
by Dr. Elena Vasquez 1 tab
python
from datasets import Dataset
from transformers import AutoTokenizer, AutoModelForSequenceClassification, TrainingArguments, Trainer

model_name = 'distilbert-base-uncased'
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name, num_labels=3)

Fine tuning transformer models for domain text classification

hugging-face fine-tuning transformers
by Dr. Elena Vasquez 1 tab
python
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline

model_name = 'distilbert-base-uncased-finetuned-sst-2-english'
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

Using Hugging Face transformers for modern NLP inference

hugging-face transformers nlp
by Dr. Elena Vasquez 1 tab
python
import pandas as pd
import torch
from PIL import Image
from torch.utils.data import Dataset, DataLoader

class ProductImageDataset(Dataset):

Custom Datasets and DataLoaders for robust training input pipelines

pytorch dataloader dataset
by Dr. Elena Vasquez 1 tab
python
import torch.nn as nn
from torchvision.models import resnet50, ResNet50_Weights

model = resnet50(weights=ResNet50_Weights.IMAGENET1K_V2)

for parameter in model.parameters():

Transfer learning with pretrained torchvision backbones

pytorch transfer-learning torchvision
by Dr. Elena Vasquez 1 tab
python
import torch.nn as nn

class SmallCNN(nn.Module):
    def __init__(self, num_classes: int) -> None:
        super().__init__()
        self.features = nn.Sequential(

Convolutional neural networks for image classification in PyTorch

pytorch cnn computer-vision
by Dr. Elena Vasquez 1 tab
python
import torch

best_val_loss = float('inf')

for epoch in range(1, num_epochs + 1):
    model.train()

A clean PyTorch training loop with validation and checkpoints

pytorch training-loop checkpoints
by Dr. Elena Vasquez 1 tab
python
import torch

device = 'cuda' if torch.cuda.is_available() else 'cpu'
features = torch.tensor([[1.0, 2.0], [3.0, 4.0]], requires_grad=True, device=device)
weights = torch.tensor([[0.2], [0.8]], requires_grad=True, device=device)

PyTorch tensor basics and automatic differentiation

pytorch tensors autograd
by Dr. Elena Vasquez 1 tab
python
from gensim.models import Word2Vec

sentences = [
    ['customer', 'refund', 'payment', 'issue'],
    ['login', 'authentication', 'password', 'reset'],
    ['delivery', 'shipment', 'tracking', 'delay'],

Word embeddings with gensim for semantic similarity tasks

word-embeddings gensim nlp
by Dr. Elena Vasquez 1 tab
python
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import Pipeline
from sklearn.metrics import classification_report

pipeline = Pipeline([

Text vectorization with TF-IDF for strong classical baselines

tf-idf nlp text-classification
by Dr. Elena Vasquez 1 tab