Subscribe to DSC Newsletter

Data science cookbook style code reference in Python for beginners

Here is another resource I use for teaching my students at AI for Edge computing course. I like this resource because I like the cookbook style of learning to code. The resource is based on the book Machine Learning With Python Cookbook. and also Machine Learning Flashcards by the same author (both of which I recommend and I have bought)

I like the approach of using a simple simulated dataset like we see in LDA for dimensionality reduction  and pandas functions. This link contains others such as linux, postgres etc which I have not tried. The ones below I have used because they related to machine learning and deep learning

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

Preprocessing Structured Data

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

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 Dates And Times

  • Break Up Dates And Times Into Multiple Features
  • Calculate Difference Between Dates And Times
  • Convert Strings To Dates
  • Convert pandas Columns Time Zone
  • 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

  • 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
  • SVC Parameters When Using RBF Kernel
  • Support Vector Classifier

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
  • Meanshift Clustering
  • Mini-Batch k-Means Clustering
  • k-Means Clustering

Deep Learning

Keras

  • Adding Dropout
  • Convolutional Neural Network
  • Feedforward Neural Network For Binary Classification
  • Feedforward Neural Network For Multiclass Classification
  • Feedforward Neural Networks For Regression
  • 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
  • k-Fold Cross-Validating Neural Networks

Data Wrangling

  • 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
  • Columns Shared By Two Data Frames
  • Construct A Dictionary From Multiple Lists
  • Convert A CSV Into Python Code To Recreate It
  • Convert A Categorical Variable Into Dummy Variables
  • Convert A Categorical Variable Into Dummy Variables
  • 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 Pipeline In Pandas
  • Create A pandas Column With A For Loop
  • Create Counts Of Items
  • Create a Column Based on a Conditional in pandas
  • 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
  • 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
  • pandas Data Structures
  • pandas Time Series Basics

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

Views: 5613

Comment

You need to be a member of Data Science Central to add comments!

Join Data Science Central

Videos

  • Add Videos
  • View All

© 2020   TechTarget, Inc.   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service