Workflow of Machine Learning Projects

This Workflow can guide you through your Machine Learning Projects. There are eight main steps:

  1. Frame the problem and look at the big picture.
  2. Get the data.
  3. Explore the data to get insights.
  4. Prepare the data to better expose the underlying data patterns to machine learning algorithms.
  5. Explore many different models and shortlist the best ones.
  6. Fine-tune your models and combine them into a great solution.
  7. Present your solution.
  8. Launch, monitor, and maintain your system.

Obviously, you should feel free to adapt this workflow of machine learning projects to your needs.

Also, read – 10 Machine Learning Projects to Boost your Portfolio.

Frame the Problem and Look at the Big Picture

  1. Define the objective in business terms.
  2. How will your solutions be used?
  3. What are the current solutions?
  4. How should you frame this problem ( supervised/unsupervised, online/offline)?
  5. How should performance be measured?
  6. Is the performance measure aligned with the business objective?
  7. What would be the minimum performance needed to reach the business objective?
  8. What are the comparable problems? Can you rescue experience or tools?
  9. Is human expertise available?
  10. How would you solve the problem manually?
  11. List the assumptions you have made so far.
  12. Verify assumptions if possible.

Get the Data

  1. List the data you need and how much you need.
  2. Find and document where you can get the data.
  3. Check how much space it will take.
  4. Check its legal obligations, and get authorization if necessary.
  5. Create a workplace.
  6. Get the data.
  7. Convert the data to a format you can easily manipulate.
  8. Ensure sensitive information is deleted or protected.
  9. Check the size and type of data.
  10. Sample a test set, put it aside, and never look at it.

Explore the Data

  1. Create a copy of the data for exploration.
  2. Create a Jupyter notebook to keep a record of your data exploration.
  3. Study each attribute and its characteristics:
    • Name
    • Type (categorical, int/float, bounded/unbounded, text, structured, etc)
    • percentage of missing values
    • Noisiness and type of noise (stochastic, outliers, rounding errors, etc)
    • Usefulness of the task.
    • Type of distribution
  4. For supervised learning tasks, identify the target attributes.
  5. Visualize the data.
  6. Study the correlations between attributes.
  7. Study how would you solve the problem manually.
  8. Identify the promising transformations you may want to apply.
  9. Identify extra data that would be useful
  10. Document what you have learned.

Prepare the Data

  1. Data Cleaning
    • Fix or remove outliers (optional).
    • Fill in missing values (e.g., with zero, mean, median) or drop their rows or columns.
  2. Feature Selection
    • Drop the attributes that provide no useful information for the task.
  3. Feature engineering, where appropriate:
    • Discretize continuous features.
    • Decompose features
    • Add promising transformations of features
    • Aggregate features into promising new features.
  4. Feature Scaling
    • Standardize or normalize features.

Shortlist Promising Models

  1. Train many quick-and-dirty models from different categories (e.g., linear, naive Bayes, SVM, Random Forest, neural networks, etc.) using standard parameters.
  2. Measure and compare their performance.
    • For each model, use N-fold cross-validation and compute the mean ans standard deviation of the performance measure of the N-folds.
  3. Analyse the most significant variables for each algorithm.
  4. Analyse the type of errors the model make.
  5. Perform a quick round of feature selection and engineering.
  6. Shortlist the top three to five most promising models, preferring models that make different type of errors.

Fine-Tune the System

  1. Fine-tune the hyperparameters using cross-validation:
    1. Treat your data transformation classes as hyperparameters, especially when you are not sure about then.
    2. Unless there are very few hyperparameter values to explore, prefer random search over grid search. If training is very long, you may prefer a Bayesian optimization approach.
  2. Try Ensemble methods. Combining your best models will often produce better performance than running them individually.
  3. Once you are confident about your final model, measure its performance on the test set to estimate the generalization error.

Present Your Solution

  1. Document what you have done.
  2. Create a nice presentation.
    • Make sure you highlight the big picture first.
  3. Explain why your solution achieves the business objective.
  4. Don’t forget to present interesting points you noticed along the way.
  5. Ensure you key findings are communicated through beautiful visualizations or easy-to-remember statements.

Launch Your Machine Learning Model

  1. Get your solution ready for production.
  2. Write monitoring code to check your system’s live performance at regular intervals and trigger alerts when it drops.
  3. Retrain your machine learning models on a regular basis on fresh data.

Also, read – 19 Machine Learning Interview Questions.

I hope you liked this article on the Workflow of Machine Learning Projects, feel free to ask your questions on the workflow of machine learning projects or any other topic in the comments section below.

Leave a Reply