chrisalbon.com Open in urlscan Pro
2606:4700:3031::6815:bf8  Public Scan

Submitted URL: http://chrisalbon.com/
Effective URL: https://chrisalbon.com/
Submission: On May 18 via api from GB — Scanned from GB

Form analysis 0 forms found in the DOM

Text Content

Chris Albon
 * Notes
   Machine Learning Engineering Management Self
 * Code
   Machine Learning Deep Learning ML Engineering Python Docker Statistics Scala
   Snowflake PostgreSQL Command Line Regular Expressions AWS Git & GitHub PHP
 * About
   About Chris Twitter ML Book ML Flashcards
 * RSS


NOTES ON USING
DATA SCIENCE & MACHINE LEARNING
TO FIGHT FOR THINGS THAT MATTER

I am the Director of Machine Learning at the Wikimedia Foundation. I have spent
over a decade applying statistical learning, artificial intelligence, and
software engineering to political, social, and humanitarian efforts.

Learning machine learning? Check out my Machine Learning Flashcards and my book,
(Machine Learning With Python Cookbook).


NOTES - EXPLANATIONS, IDEAS, AND LESSONS LEARNED


MACHINE LEARNING




ENGINEERING MANAGEMENT

 * What I Said To My Team At The Start Of COVID-19


SELF

 * What I Learned Tracking My Time At Techstars


CODE TUTORIALS - SHORT ANNOTATED CODING GUIDES


MACHINE LEARNING

BASICS

 * Loading Features From Dictionaries
 * Loading scikit-learn's Boston Housing Dataset
 * Loading scikit-learn's Digits Dataset
 * Loading scikit-learn's Iris Dataset
 * Make Simulated Data For Classification
 * Make Simulated Data For Clustering
 * Make Simulated Data For Regression
 * Perceptron In Scikit
 * Saving Machine Learning Models

VECTORS, MATRICES, AND ARRAYS

 * Adding And Subtracting Matrices
 * Apply Operations To Elements
 * Calculate Dot Product Of Two Vectors
 * Calculate The Average, Variance, And Standard Deviation
 * Calculate The Determinant Of A Matrix
 * Calculate The Trace Of A Matrix
 * Converting A Dictionary Into A Matrix
 * Create A Matrix
 * Create A Sparse Matrix
 * Create A Vector
 * Describe An Array
 * Find The Maximum And Minimum
 * Find The Rank Of A Matrix
 * Flatten A Matrix
 * Getting The Diagonal Of A Matrix
 * Invert A Matrix
 * Reshape An Array
 * Selecting Elements In An Array
 * Transpose A Vector Or Matrix

PREPROCESSING STRUCTURED DATA

 * Convert Pandas Categorical Data For Scikit-Learn
 * Delete Observations With Missing Values
 * Deleting Missing Values
 * Detecting Outliers
 * Discretize Features
 * Encoding Ordinal Categorical Features
 * Handling Imbalanced Classes With Downsampling
 * Handling Imbalanced Classes With Upsampling
 * Handling Outliers
 * Impute Missing Values With Means
 * Imputing Missing Class Labels
 * Imputing Missing Class Labels Using k-Nearest Neighbors
 * Normalizing Observations
 * One-Hot Encode Features With Multiple Labels
 * One-Hot Encode Nominal Categorical Features
 * Preprocessing Categorical Features
 * Preprocessing Iris Data
 * Rescale A Feature
 * Standardize A Feature

PREPROCESSING IMAGES

 * Binarize Images
 * Blurring Images
 * Cropping Images
 * Detect Edges
 * Enhance Contrast Of Color Image
 * Enhance Contrast Of Greyscale Image
 * Harris Corner Detector
 * Installing OpenCV
 * Isolate Colors
 * Load Images
 * Remove Backgrounds
 * Save Images
 * Sharpen Images
 * Shi-Tomasi Corner Detector
 * Using Mean Color As A Feature

PREPROCESSING TEXT

 * Bag Of Words
 * Parse HTML
 * Remove Punctuation
 * Remove Stop Words
 * Replace Characters
 * Stemming Words
 * Strip Whitespace
 * Tag Parts Of Speech
 * Term Frequency Inverse Document Frequency
 * Tokenize Text

PREPROCESSING DATES AND TIMES

 * Break Up Dates And Times Into Multiple Features
 * Calculate Difference Between Dates And Times
 * Convert pandas Columns Time Zone
 * Convert Strings To Dates
 * Encode Days Of The Week
 * Handling Missing Values In Time Series
 * Handling Time Zones
 * Lag A Time Feature
 * Rolling Time Window
 * Select Date And Time Ranges

FEATURE ENGINEERING

 * Dimensionality Reduction On Sparse Feature Matrix
 * Dimensionality Reduction With Kernel PCA
 * Dimensionality Reduction With PCA
 * Feature Extraction With PCA
 * Group Observations Using K-Means Clustering
 * Selecting The Best Number Of Components For LDA
 * Selecting The Best Number Of Components For TSVD
 * Using Linear Discriminant Analysis For Dimensionality Reduction

FEATURE SELECTION

 * ANOVA F-value For Feature Selection
 * Chi-Squared For Feature Selection
 * Drop Highly Correlated Features
 * Recursive Feature Elimination
 * Variance Thresholding Binary Features
 * Variance Thresholding For Feature Selection

MODEL EVALUATION

 * Accuracy
 * Create Baseline Classification Model
 * Create Baseline Regression Model
 * Cross Validation Pipeline
 * Cross Validation With Parameter Tuning Using Grid Search
 * Cross-Validation
 * Custom Performance Metric
 * F1 Score
 * Generate Text Reports On Performance
 * Nested Cross Validation
 * Plot The Learning Curve
 * Plot The Receiving Operating Characteristic Curve
 * Plot The Validation Curve
 * Precision
 * Recall
 * Split Data Into Training And Test Sets

MODEL SELECTION

 * Find Best Preprocessing Steps During Model Selection
 * Hyperparameter Tuning Using Grid Search
 * Hyperparameter Tuning Using Random Search
 * Model Selection Using Grid Search
 * Pipelines With Parameter Optimization

LINEAR REGRESSION

 * Adding Interaction Terms
 * Create Interaction Features
 * Effect Of Alpha On Lasso Regression
 * Lasso Regression
 * Linear Regression
 * Linear Regression Using Scikit-Learn
 * Ridge Regression
 * Selecting The Best Alpha Value In Ridge Regression

LOGISTIC REGRESSION

 * Fast C Hyperparameter Tuning
 * Handling Imbalanced Classes In Logistic Regression
 * Logistic Regression
 * Logistic Regression On Very Large Data
 * Logistic Regression With L1 Regularization
 * One Vs. Rest Logistic Regression

TREES AND FORESTS

 * Outlier Detection With Isolation Forests
 * Adaboost Classifier
 * Decision Tree Classifier
 * Decision Tree Regression
 * Feature Importance
 * Feature Selection Using Random Forest
 * Handle Imbalanced Classes In Random Forest
 * Random Forest Classifier
 * Random Forest Classifier Example
 * Random Forest Regression
 * Select Important Features In Random Forest
 * Titanic Competition With Random Forest
 * Visualize A Decision Tree

NEAREST NEIGHBORS

 * Identifying Best Value Of k
 * K-Nearest Neighbors Classification
 * Radius-Based Nearest Neighbor Classifier

SUPPORT VECTOR MACHINES

 * Calibrate Predicted Probabilities In SVC
 * Find Nearest Neighbors
 * Find Support Vectors
 * Imbalanced Classes In SVM
 * Plot The Support Vector Classifiers Hyperplane
 * Support Vector Classifier
 * SVC Parameters When Using RBF Kernel

NAIVE BAYES

 * Bernoulli Naive Bayes Classifier
 * Calibrate Predicted Probabilities
 * Gaussian Naive Bayes Classifier
 * Multinomial Logistic Regression
 * Multinomial Naive Bayes Classifier
 * Naive Bayes Classifier From Scratch

CLUSTERING

 * Agglomerative Clustering
 * DBSCAN Clustering
 * Evaluating Clustering
 * k-Means Clustering
 * Meanshift Clustering
 * Mini-Batch k-Means Clustering


DEEP LEARNING

SETUP

 * Prevent Ubuntu 18.06 And Nvidia Drivers From Updating

KERAS

 * Adding Dropout
 * Convolutional Neural Network
 * Feedforward Neural Network For Binary Classification
 * Feedforward Neural Network For Multiclass Classification
 * Feedforward Neural Networks For Regression
 * k-Fold Cross-Validating Neural Networks
 * LSTM Recurrent Neural Network
 * Neural Network Early Stopping
 * Neural Network Weight Regularization
 * Preprocessing Data For Neural Networks
 * Save Model Training Progress
 * Tuning Neural Network Hyperparameters
 * Visualize Loss History
 * Visualize Neural Network Architecutre
 * Visualize Performance History

PYTORCH

 * Check If PyTorch Is Using The GPU


PYTHON

BASICS

 * Using Iterable As Function Arguments
 * Handling Long Lines Of Code
 * Tuples Vs. Named Tuples
 * Append Using The Operator
 * Function Example
 * List All Files Of Certain Type In A Directory
 * Add Padding Around String
 * All Combinations For A List Of Objects
 * any(), all(), max(), min(), sum()
 * Apply Operations Over Items In A List
 * Applying Functions To List Items
 * Arithmetic Basics
 * Assignment Operators
 * Basic Operations With NumPy Array
 * Breaking Up String Variables
 * Brute Force D20 Roll Simulator
 * Cartesian Product
 * Chain Together Lists
 * Cleaning Text
 * Compare Two Dictionaries
 * Concurrent Processing
 * Continue And Break Loops
 * Convert HTML Characters To Strings
 * Converting Strings To Datetime
 * Create A New File Then Write To It
 * Create A Temporary File
 * Data Structure Basics
 * Date And Time Basics
 * Dictionary Basics
 * Display JSON
 * Display Scientific Notation As Floats
 * Exiting A Loop
 * Find The Max Value In A Dictionary
 * Flatten Lists Of Lists
 * For Loop
 * Formatting Numbers
 * Function Annotation Examples
 * Function Basics
 * Functions Vs. Generators
 * Generating Random Numbers With NumPy
 * Generator Expressions
 * Hard Wrapping Text
 * How To Use Default Dicts
 * if and if else
 * If Else On Any Or All Elements
 * Indexing And Slicing NumPy Arrays
 * Indexing And Slicing NumPy Arrays
 * Iterate An Ifelse Over A List
 * Iterate Over Multiple Lists Simultaneously
 * Iterating Over Dictionary Keys
 * Lambda Functions
 * Logical Operations
 * Looping Over Two Lists
 * Mathematical Operations
 * Mocking Functions
 * Nested For Loops Using List Comprehension
 * Nesting Lists
 * Numpy Array Basics
 * Parallel Processing
 * Partial Function Applications
 * Priority Queues
 * Queues And Stacks
 * Recursive Functions
 * repr vs. str
 * Scheduling Jobs In The Future
 * Select Random Element From A List
 * Selecting Items In A List With Filters
 * Set The Color Of A Matplotlib Plot
 * Sort A List Of Names By Last Name
 * Sort A List Of Strings By Length
 * Store API Credentials For Open Source Projects
 * String Formatting
 * String Indexing
 * String Operations
 * Swapping Variable Values
 * Try, Except, and Finally
 * Unpacking A Tuple
 * Unpacking Function Arguments
 * Use Command Line Arguments In A Function
 * Using Named Tuples To Store Data
 * while Statement
 * 

DATA WRANGLING

 * Columns Shared By Two Data Frames
 * Apply Functions By Group In Pandas
 * Apply Operations To Groups In Pandas
 * Applying Operations Over pandas Dataframes
 * Assign A New Column To A Pandas DataFrame
 * Break A List Into N-Sized Chunks
 * Breaking Up A String Into Columns Using Regex In pandas
 * Construct A Dictionary From Multiple Lists
 * Convert A Categorical Variable Into Dummy Variables
 * Convert A Categorical Variable Into Dummy Variables
 * Convert A CSV Into Python Code To Recreate It
 * Convert A String Categorical Variable To A Numeric Variable
 * Convert A Variable To A Time Variable In pandas
 * Count Values In Pandas Dataframe
 * Create a Column Based on a Conditional in pandas
 * Create A pandas Column With A For Loop
 * Create A Pipeline In Pandas
 * Create Counts Of Items
 * Creating Lists From Dictionary Keys And Values
 * Crosstabs In pandas
 * Delete Duplicates In pandas
 * Descriptive Statistics For pandas Dataframe
 * Dropping Rows And Columns In pandas Dataframe
 * Enumerate A List
 * Expand Cells Containing Lists Into Their Own Variables In Pandas
 * Filter pandas Dataframes
 * Find Largest Value In A Dataframe Column
 * Find Unique Values In Pandas Dataframes
 * Geocoding And Reverse Geocoding
 * Geolocate A City And Country
 * Geolocate A City Or Country
 * Group A Time Series With pandas
 * Group Data By Time
 * Group Pandas Data By Hour Of The Day
 * Grouping Rows In pandas
 * Hierarchical Data In pandas
 * Join And Merge Pandas Dataframe
 * List Unique Values In A pandas Column
 * Load A JSON File Into Pandas
 * Load An Excel File Into Pandas
 * Load Excel Spreadsheet As pandas Dataframe
 * Loading A CSV Into pandas
 * Long To Wide Format
 * Lower Case Column Names In Pandas Dataframe
 * Make New Columns Using Functions
 * Map External Values To Dataframe Values in pandas
 * Missing Data In pandas Dataframes
 * Moving Averages In pandas
 * Normalize A Column In pandas
 * pandas Data Structures
 * pandas Time Series Basics
 * Pivot Tables In pandas
 * Quickly Change A Column Of Strings In Pandas
 * Random Sampling Dataframe
 * Ranking Rows Of Pandas Dataframes
 * Regular Expression Basics
 * Regular Expression By Example
 * Reindexing pandas Series And Dataframes
 * Rename Column Headers In pandas
 * Rename Multiple pandas Dataframe Column Names
 * Replacing Values In pandas
 * Saving A pandas Dataframe As A CSV
 * Search A pandas Column For A Value
 * Select Rows When Columns Contain Certain Values
 * Select Rows With A Certain Value
 * Select Rows With Multiple Filters
 * Selecting pandas DataFrame Rows Based On Conditions
 * Simple Example Dataframes In pandas
 * Sorting Rows In pandas Dataframes
 * Split Lat/Long Coordinate Variables Into Separate Variables
 * Streaming Data Pipeline
 * String Munging In Dataframe
 * Using List Comprehensions With pandas
 * Using Seaborn To Visualize A pandas Dataframe

DATA VISUALIZATION

 * Back To Back Bar Plot In MatPlotLib
 * Bar Plot In MatPlotLib
 * Color Palettes in Seaborn
 * Creating A Time Series Plot With Seaborn And pandas
 * Creating Scatterplots With Seaborn
 * Group Bar Plot In MatPlotLib
 * Histograms In MatPlotLib
 * Making A Matplotlib Scatterplot From A Pandas Dataframe
 * Matplotlib, A Simple Example
 * Pie Chart In MatPlotLib
 * Scatterplot In MatPlotLib
 * Stacked Percentage Bar Plot In MatPlotLib

WEB SCRAPING

 * Beautiful Soup Basic HTML Scraping
 * Drilling Down With Beautiful Soup
 * Monitor A Website For Changes With Python

TESTING

 * Simple Unit Test
 * Test Code Speed
 * Test For A Specific Exception
 * Test If Output Is Close To A Value
 * Testable Documentation

LOGGING

 * Basic Logging

CLEAN CODE

 * Annotate Functions
 * Annotate Nested Function Parameters
 * Static Typing Checking

OTHER

 * Generate Tweets Using Markov Chains
 * Mine Twitter's Stream For Hashtags Or Words
 * Simple Clustering With SciPy
 * What Is The Probability An Economy Class Seat Is An Aisle Seat?


STATISTICS

BASICS

 * Linear Interpolation
 * Trimmed Mean

FREQUENTIST

 * Bessels Correction
 * Demonstrate The Central Limit Theorem
 * Pearsons Correlation Coefficient
 * Probability Mass Functions
 * Spearmans Rank Correlation
 * T-Tests
 * Variance And Standard Deviation


SCALA

 * Break A Sequence Into Groups
 * Change Data Type
 * Chunk Sequence In Equal Sized Groups
 * Compare Two Floats
 * Create A Range
 * Extract Substrings Using Regex
 * Filter A Sequence
 * Find Largest Key Or Value In A Map
 * Flatten Sequence Of Sequences
 * For Loop A Map
 * For Looping
 * Format Numbers As Currency
 * If Else
 * Increment And Decrement Numbers
 * Insert Variables Into Strings
 * Iterate Over A Map
 * Loop A Collection
 * Make Numbers Pretty
 * Mapping A Function To A Collection
 * Matching Conditions
 * Mutable Maps
 * N Dimension Arrays
 * Partial Functions
 * Random Integer Between Two Values
 * Replacing Parts Of Strings
 * Search A Map
 * Search Strings
 * Search Strings Using Regex
 * Set Operations On Sequences
 * Sorting Sequences
 * Split Strings
 * Try, Catch, Finally
 * Variables And Values
 * Zip Together Two Lists


REGULAR EXPRESSIONS

 * Match A Symbol
 * Match A Unicode Character
 * Match A Word
 * Match Any Character
 * Match Any Of A List Of Characters
 * Match Any Of A Series Of Options
 * Match Any Of A Series Of Words
 * Match Dates
 * Match Email Addresses
 * Match Exact Text
 * Match Integers Of Any Length
 * Match Text Between HTML Tags
 * Match Times
 * Match URLs
 * Match US and UK Spellings
 * Match US Phone Numbers
 * Match Words With A Certain Ending
 * Match ZIP Codes


SNOWFLAKE

BASICS



TABLES




POSTGRESQL

BASICS

 * Create PostgreSQL Database With Python
 * Apply Operation To Column
 * Compare Values To Subquery
 * Copy Rows From One Table To Another
 * Count Rows
 * Count Unique Values
 * Create Column Index
 * Create Subquery
 * Create View
 * Delete View
 * Examine A Query
 * Group Rows
 * Group Rows With Conditions
 * If Else
 * List Index Columns
 * List Tables In Database
 * Rename Columns In Views
 * Replace Missing Values
 * Retrieve Only A Few Rows
 * Retrieve Random Subset Of Rows
 * Retrieve Row
 * Retrieve Rows Based On Condition
 * Retrieve Rows Based On Multiple Condition
 * Retrieve Subset Of Columns
 * Retrieving Missing Values
 * Save Queries As Variables
 * Select Highest Value In Each Group
 * Select Values Between Two Values
 * Sort Rows
 * Sort Rows In Groups
 * Test If Rows Exist In Subquery
 * Use Column Aliases With Where Clause
 * Value Matches Element Of A List
 * View Unique Values

ADD, DELETE, CHANGE ROWS

 * Add Column
 * Change Values
 * Create Column Aliases
 * Create Column Conditional On Another Column
 * Create Column Of Values
 * Create Primary Key
 * Delete All Rows
 * Delete Duplicates
 * Delete Primary Key
 * Delete Rows
 * Delete Rows That Don't Exist In Another Table
 * Export To CSV
 * Import CSV
 * Insert Rows
 * Update Rows Based On Another Table

MERGING AND JOINING

 * All Unique Values In Two Tables
 * Cartesian Product Of Tables
 * Concatenate Multiple Table
 * Find Values In Both Tables
 * Find Values In One Table And Not Another
 * Inner Join Tables
 * Join Multiple Table
 * Left Join Tables
 * Outer Join Tables
 * Right Join Tables
 * Self Join Table
 * Stack Tables

TABLES

 * Copy Table Structure
 * Create Table
 * Create Table With Default Values
 * Create Table With UUIDs
 * Create Temporary Table
 * Delete Table
 * Delete Table With Views
 * Duplicate Table
 * List Columns In Table
 * Show Column Information
 * View Size Of Table

TEXT

 * Concatenate Values
 * Extract Characters From Strings
 * Lower And Upper Case
 * Partial String Match

NUMERIC

 * Calculate Max, Min, Or Average Of Column
 * Calculate Running Total
 * Calculate Sum Of Column
 * Convert Floats To Integers
 * Mathematical Operations On Columns

DATES

 * Adding Or Substracting Time
 * Calculate Time Duration

INTERVIEW QUESTIONS

 * Calculate Requests Sent
 * Sort By Natural Ordering
 * What Happens When You Add NULL And Integer


AWS

 * Run Project Jupyter Notebooks On Amazon EC2
 * Create Bucket
 * List Buckets


LINUX COMMAND LINE

BASICS

 * Close A Program
 * End Standard Input Entry
 * Copy Files And Directories
 * Delete Files And Directories
 * Delete Files And Directories In Current Directory
 * Modify File Permissions
 * Move Files And Directories
 * Rename File
 * See Disk Drive Space
 * View Disk Information
 * Archive And Unarchive Files
 * Change Permissions
 * Changing Directories
 * Check Current Date And Time
 * Create Command
 * Create Directory
 * Create File
 * Create Sequential List Of Files And Directories
 * Create Symbolic Links
 * Exit Terminal Session
 * Get Help With A Command
 * Get Information On A File
 * List Avaliable Commands
 * List The Contents Of A Directory
 * Multiple Commands On One Line
 * Ping Website
 * See Free Memory
 * See Who Is Logged Into A System
 * Select Files Based On Filename
 * Synchronize Files And Directories
 * Track Route Of Network Traffic
 * View A File's Type
 * View A Text File's Contents
 * View Current Working Directory
 * View First And Last Parts Of Files
 * View The Version Of A Package
 * Zip And Unzip Directories
 * Zip And Unzip Files

INPUTS AND OUTPUTS

 * Append Error To File
 * Append File Contents To Another File
 * Append Output To File
 * Append Outputs And Errors To File
 * Chain Multiple Commands
 * Concatenate Multiple Files
 * Save Output To File In Middle Of Command Chain
 * Silence Errors
 * Sort Rows
 * Write Errors To File
 * Write Output To File

SEARCH

 * Find Directories
 * Find Files
 * Find Files Based On Multiple Conditions
 * Find Files By Filename
 * Find Files By Size
 * Find Program's Location
 * Find Symbolic Links
 * Search Contents Of All Files Of Certain Type
 * Search Filenames
 * Search The Contents Of A File

TEXT

 * Add Columns To Text
 * Count Unique Rows
 * Extract Text
 * Find And Replace
 * Adding Line Numbers
 * Comparing Text Files
 * Join And Sort Text
 * Join Columns
 * Quickly View File Contents

FLOW CONTROL

 * For Loops
 * If Else For Integers
 * If Else For Strings
 * If Else With Multiple Conditions

PROCESSES

 * Measure How Long A Process Takes
 * List Processes
 * Monitor Processes

SHELL SCRIPTS

 * Arguments
 * Conditionals
 * Double Vs. Single Quotes
 * Simple Shell Script


GIT AND GITHUB

 * Stop Git From Asking For Password Every Push And Pull From GitHub
 * GitHub Cheatsheet


MACHINE LEARNING ENGINEERING

YAML

 * Fundamentals Of Software Architecture
 * Basic YAML File
 * Comments
 * Key-Value Pairs
 * Lists
 * Multiline Strings
 * Strings

KUBEFLOW

 * Fundamentals Of Software Architecture
 * Installing Kubeflow On Ubuntu


DOCKER

COMMAND LINE

 * Automatically Generate Human-Readable Container Names
 * Automatically Restart Containers
 * Connect Container's Filesystem To Computer's Filesystem
 * Create A Container
 * Create An Image
 * Create Read-Only Filesystems In Containers
 * Export All Files And Folders Out Of A Container
 * Get Bash Shell In A Container
 * Inspect A Container
 * Inspect An Image
 * List Containers
 * Publish To Docker Hub
 * Pull An Image From A Repository
 * Remove An Image
 * Rename A Container
 * Restart A Container
 * Run A Detached Container
 * Save A Container's Bash History
 * Saving An Image As A File
 * Set Container To Run A Bash Command On Start
 * Start A Container
 * Stop A Container
 * Use Environment Variables
 * View All Changes To A Container
 * View Container Logs
 * View Image Size
 * Watch Container Logs Live
 * Work In A Container

DOCKERFILES

 * Add A File From A URL To Images
 * Add A Volume
 * Add Comments
 * Add Environment Variables
 * Add Files And Folders To Images
 * Add Metadata
 * Expose A Port
 * Ignore Files While Building
 * Run Command When Container Starts
 * Run Command While Building Image
 * Run Commands As A User
 * Run Many Commands While Building Image
 * Set A Default Working Directory
 * Set Default Working Directory


PHP

 * Simple Example

License. All 699 notes and articles are available on GitHub.