# AI Algorithms: Traditional Machine Learning vs. Deep Learning

While traditional machine learning algorithms excel with structured data and well-defined problems, deep learning models use neural networks to process and learn from unstructured data.

Machine learning has revolutionised the way we interpret, analyse, and predict from data. While traditional machine learning algorithms have shown remarkable success with structured data, deep learning has emerged as a powerful tool for unstructured data, such as images and texts.

###### Traditional Machine Learning Algorithms

Traditional machine learning algorithms are fundamentally statistical or mathematical models that learn patterns from data. They're typically used when the data is structured and the problem to be solved is relatively simple or well-defined.

**1. Supervised Learning:** This type of algorithm uses labeled data, where both the input and the desired output are provided, to predict outcomes. Examples include linear regression for continuous outcomes, logistic regression and support vector machines (SVMs) for classification tasks, and decision trees and random forests for both regression and classification tasks.

**2. Unsupervised Learning:** In contrast to supervised learning, these algorithms find hidden structures or patterns in unlabelled data. Examples include k-means clustering for grouping similar data points, hierarchical clustering for understanding the hierarchy in data, and principal component analysis (PCA) for reducing the dimensionality of the data.

**3. Reinforcement Learning:** These algorithms learn through trial and error to achieve the best possible reward over time based on reward feedback. They are commonly used in situations where an agent interacts with an environment to make a sequence of decisions, such as in robotics or game playing. Examples include Q-Learning and Sarsa.

**4. Semi Supervised Learning** - Algorithms can use both labelled and unlabelled data.A semi-supervised model is trained on a small amount of labelled data and a large amount of unlabelled data. It uses the labelled data to understand the concepts of the task and the unlabelled data to generalise to new, unseen examples.

###### Deep Learning Algorithms

Deep learning algorithms are a subset of machine learning algorithms that can learn to reach an accurate conclusion without any human intervention. Instead of relying on mathematical models, they mimic the human brain using artificial neural networks with multiple layers of interconnected nodes, hence the term "deep".

Deep learning models are particularly potent for tasks involving unstructured data, like images, audio, or text. Examples include convolutional neural networks (CNNs) for image tasks, recurrent neural networks (RNNs) for sequence tasks, and transformers for various tasks, especially in natural language processing.

###### Hybrid Models and Ensemble Methods

In some instances, elements of both traditional machine learning and deep learning are combined, creating hybrid models. For instance, a model might use deep learning to process image data and then feed the results into a traditional machine learning model.

Ensemble methods, on the other hand, combine multiple machine learning models to improve performance. Techniques include bagging, boosting, and stacking. An example of an ensemble method is the random forest, which combines numerous decision trees.

###### Deep Learning Model Types

Generative AI and LLMs are both subsets of Deep Learning

**Discriminative models **are usually trained on labeled data which allows them to learn the relationship between the features of the data points and their corresponding labels. When it has been trained it can be used to used to classify or predict labels for new data points.

EG If a discriminative model is shown a picture of a cat it can classify it as a cat (rather than a dog).

**Generative models** generate new data based on the data it was trained on. It learns the probability distribution of the data and predicts new outcomes - for example the next word in a sentence.

EG If a generative model is given an input label of dog, it can generate a picture of a dog.

###### Conclusion

In summary, while traditional machine learning algorithms excel with structured data and well-defined problems, deep learning models harness the power of neural networks to process and learn from unstructured data.

The landscape of data analytics and prediction is vast, with both traditional and deep learning models offering unique strengths. As the field evolves, hybrid and ensemble methods also show promise in leveraging the best of both worlds. Choosing the right approach depends on the nature of the problem, the type of data at hand, and the desired outcome.