This Workflow can guide you through your Machine Learning Projects. There are eight main steps:
- Frame the problem and look at the big picture.
- Get the data.
- Explore the data to get insights.
- Prepare the data to better expose the underlying data patterns to machine learning algorithms.
- Explore many different models and shortlist the best ones.
- Fine-tune your models and combine them into a great solution.
- Present your solution.
- Launch, monitor, and maintain your system.
Obviously, you should feel free to adapt this workflow of machine learning projects to your needs.
Frame the Problem and Look at the Big Picture
- Define the objective in business terms.
- How will your solutions be used?
- What are the current solutions?
- How should you frame this problem ( supervised/unsupervised, online/offline)?
- How should performance be measured?
- Is the performance measure aligned with the business objective?
- What would be the minimum performance needed to reach the business objective?
- What are the comparable problems? Can you rescue experience or tools?
- Is human expertise available?
- How would you solve the problem manually?
- List the assumptions you have made so far.
- Verify assumptions if possible.
Get the Data
- List the data you need and how much you need.
- Find and document where you can get the data.
- Check how much space it will take.
- Check its legal obligations, and get authorization if necessary.
- Create a workplace.
- Get the data.
- Convert the data to a format you can easily manipulate.
- Ensure sensitive information is deleted or protected.
- Check the size and type of data.
- Sample a test set, put it aside, and never look at it.
Explore the Data
- Create a copy of the data for exploration.
- Create a Jupyter notebook to keep a record of your data exploration.
- Study each attribute and its characteristics:
- 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
- For supervised learning tasks, identify the target attributes.
- Visualize the data.
- Study the correlations between attributes.
- Study how would you solve the problem manually.
- Identify the promising transformations you may want to apply.
- Identify extra data that would be useful
- Document what you have learned.
Prepare the Data
- Data Cleaning
- Fix or remove outliers (optional).
- Fill in missing values (e.g., with zero, mean, median) or drop their rows or columns.
- Feature Selection
- Drop the attributes that provide no useful information for the task.
- Feature engineering, where appropriate:
- Discretize continuous features.
- Decompose features
- Add promising transformations of features
- Aggregate features into promising new features.
- Feature Scaling
- Standardize or normalize features.
Shortlist Promising Models
- Train many quick-and-dirty models from different categories (e.g., linear, naive Bayes, SVM, Random Forest, neural networks, etc.) using standard parameters.
- 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.
- Analyse the most significant variables for each algorithm.
- Analyse the type of errors the model make.
- Perform a quick round of feature selection and engineering.
- Shortlist the top three to five most promising models, preferring models that make different type of errors.
Fine-Tune the System
- Fine-tune the hyperparameters using cross-validation:
- Treat your data transformation classes as hyperparameters, especially when you are not sure about then.
- 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.
- Try Ensemble methods. Combining your best models will often produce better performance than running them individually.
- Once you are confident about your final model, measure its performance on the test set to estimate the generalization error.
Present Your Solution
- Document what you have done.
- Create a nice presentation.
- Make sure you highlight the big picture first.
- Explain why your solution achieves the business objective.
- Don’t forget to present interesting points you noticed along the way.
- Ensure you key findings are communicated through beautiful visualizations or easy-to-remember statements.
Launch Your Machine Learning Model
- Get your solution ready for production.
- Write monitoring code to check your system’s live performance at regular intervals and trigger alerts when it drops.
- Retrain your machine learning models on a regular basis on fresh data.
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.