Are you wondering when you should use neural networks rather than other machine learning models? Well then you are in the right place! In this article, we tell you everything you need to know to understand when you should reach for a neural network and when you should stick with another machine learning model.
This article starts out with a discussion of neutral networks and the types of outcome variables they can handle. After that, we go over some of the main advantages and disadvantages of neural networks that you should keep in mind when deciding whether to use a neural network. Finally, we provide examples of situations where you should and should not use neural networks.
Throughout this article, we will focus on simple neural networks. We will not discuss more complicated neural network architectures such as convolutional neural networks or recurrent neural networks.
Types of outcomes neural networks can be used for
What types of outcome variables can you use neural networks to predict? Neural networks are highly flexible and can be used to predict a wide variety of different types of outcome variables. For example, neural networks can be used to predict simple data types like binary outcomes, numeric outcomes, and categorical outcomes. They can also be used to general more complex outputs like images and text.
Advantages and disadvantages of neural networks
Are you wondering what the main advantages of neural networks are? Here are some of the main advantages and disadvantages that you should keep in mind when deciding whether to use a neural network for your next machine learning project.
Advantages of neural networks
- Excellent performance on unstructured data. One of the main advantages of neural networks is that they have very strong performance on unstructured data such as text data and image data. This performance can generally not be beat by other types of models.
- Do not assume linear relationships. Another advantage of neural networks is that they do not assume a linear relationship between the features and the outcome variable. Neural networks can approximate all types of non-linear relationships between variables.
- Do not need to specify interactions. Neural networks can also detect and account for interactions that are not specified in the input data. They can even account for complex interactions between multiple features.
- Somewhat robust to outliers. Another benefit of neural networks is that they are not as easily thrown off by outliers as some other models. There are some cases where they can be thrown off by outliers, but in general they are more robust to outliers than regression models like logistic regression or linear regression models.
- Can natively handle multiclass outcomes. Neural network models can natively handle multiclass outcomes. That means that you can predict these types of outcomes using a single model rather than having to train and combine the outputs of multiple models.
Disadvantages of neural networks
- Require lots of data. One of the main disadvantages of neural networks is that they tend to require a lot of training data. There are some special frameworks that can be used in cases where you do not have large training datasets, but they add multiple steps to the model training process. If you have a limited amount of training data, you may be better using a model that is less data hungry.
- Many hyperparameters to tune. Another disadvantage of neural networks is that they have many hyperparameters that need to be tuned. There are also many architectural choices that you need to make when putting together a neural network model for scratch. This means that you may need to spend more time in the model tuning process.
- Computationally intensive. In addition to having many hyperparameters that need to be tuned by training different models, individual neural network models have many, many parameters that need to be estimated. It requires a lot of work to estimate all of these parameters, so neural networks tend to be very computationally intensive and require long training times or large amounts of resources.
- Generally don’t handle missing data. Neural networks generally do not handle missing data natively. That means that you usually need to preprocess your dataset to address any missing data before you start training your model.
- Difficult to explain. Another disadvantage of neural network models is that they are somewhat difficult to explain and have a reputation for being “black box” models. That means that they are sometimes distrusted by stakeholders who are skeptical of complex models they do not understand.
- No interpretable coefficients. Another disadvantage of neural networks is that they do not provide interpretable coefficients out of the box in the way that other models like linear regression and logistic regression models do.
When to use neural networks
When should you use neural networks for data science projects? Here are some examples of situations where you should consider using neural networks.
- Unstructured data. Neural networks tend to perform exceptionally well on complex problems with unstructured data. If you are using text data, image data, or any other complex data type then you should certainly consider using networks. In these domains, the large improvements in predictive performance that can be gained from using neural networks are worth the additional computational burden.
When not to use neural networks
When should you avoid using neural networks? Here are some examples of situations where you should avoid using neural networks.
- Simple tabular outcomes. You are generally better off avoiding neural networks in cases where you have a simple tabular outcome variable. In these cases, there are simpler models that tend to perform just as well. These other models are often less data computationally intensive and require less hyperparameter tuning. If you have a simple tabular outcome, gradient boosted trees tend to perform just as well, if not better than neural networks.
- Small datasets. You are generally better off avoiding neural networks when you have a small dataset. There are exceptions this rule, such as if you are using a paradigm like transfer learning or semi-supervised. That being said, you should generally avoid using neural networks in these cases if there are other options. Simple models like linear regression and logistic regression tend to perform better on small datasets if they are applicable.
Related articles
- When to use convolutional neural networks
- When to use recurrent neural networks
- When to use logistic regression
- When to use linear regression
- When to use random forests
- When to use ridge regression
- When to use LASSO
- When to use support vector machines
- When to use gradient boosted trees
- When to use poisson regression
- When to use Bayesian regression
Are you trying to figure out which machine learning model is best for your next data science project? Check out our comprehensive guide on how to choose the right machine learning model.