class: title-slide .row[ .col-7[ .title[ # APL Viva ] .subtitle[ ## APL Viva ] .author[ ### Laxmikant Soni <br> [blog](https://laxmikants.github.io) <br> [<i class="fab fa-github"></i>](https://github.com/laxmiaknts) [<i class="fab fa-twitter"></i>](https://twitter.com/laxmikantsoni09) ] .affiliation[ ] ] .col-5[ .logo[ <img src="figures/rmarkdown.png" width="480" /> ] ] ] --- # Pre-requisite .pull-top[ ## Introduction to NumPy **Question**: What is NumPy? **Answer**: NumPy is a Python library used for numerical computations, especially for working with arrays and matrices. It provides a powerful array object and functions for performing operations on these arrays efficiently. **Example**: NumPy allows fast calculations on large datasets, such as adding two large matrices. ] --- # Pre-requisite .pull-top[ ## Key Features of NumPy **Question**: What are some key features of NumPy? **Answer**: NumPy offers features like support for n-dimensional arrays, element-wise operations, broadcasting, and an extensive library of mathematical functions, making it essential for data manipulation and analysis. **Example**: Broadcasting allows operations between arrays of different shapes without manual reshaping, simplifying code. ] --- # Pre-requisite .pull-top[ ## Introduction to Pandas **Question**: What is Pandas? **Answer**: Pandas is a Python library for data manipulation and analysis, providing data structures like Series and DataFrames to handle and analyze structured data conveniently. **Example**: Pandas allows loading data from CSV files, cleaning it, and performing complex data transformations easily. ] --- # Pre-requisite .pull-top[ ## Key Features of Pandas **Question**: What are some key features of Pandas? **Answer**: Pandas offers powerful data structures (Series and DataFrames), data alignment, handling missing data, data wrangling, and support for reading/writing data in various formats, making it a go-to library for data analysis. **Example**: Using DataFrames to filter, group, and aggregate data in large datasets for analysis. ] --- # Pre-requisite .pull-top[ ## Basic Operations with NumPy **Question**: What are some basic operations with NumPy? **Answer**: Basic operations include creating arrays, performing element-wise arithmetic, reshaping arrays, and applying mathematical functions like mean, median, and sum to arrays. **Example**: Creating a 3x3 array and calculating the mean of its elements. ] --- # Pre-requisite .pull-top[ ## Basic Operations with Pandas **Question**: What are some basic operations with Pandas? **Answer**: Basic operations include creating Series and DataFrames, selecting and filtering data, handling missing values, and summarizing data with descriptive statistics. **Example**: Loading a CSV into a DataFrame, selecting rows where a value is greater than a threshold, and computing the mean. ] --- # Pre-requisite .pull-top[ ## NumPy Array Manipulation **Question**: How does NumPy handle array manipulation? **Answer**: NumPy allows easy manipulation of arrays through operations like reshaping, slicing, indexing, concatenation, and splitting, providing flexibility in handling array data structures. **Example**: Reshaping a 1D array of 9 elements into a 3x3 2D array. ] --- # Pre-requisite .pull-top[ ## Data Wrangling with Pandas **Question**: What is data wrangling with Pandas? **Answer**: Data wrangling involves cleaning, transforming, and preparing raw data for analysis. Pandas provides tools for handling missing data, transforming columns, merging datasets, and reshaping data. **Example**: Removing NaN values from a dataset, grouping data by a column, and calculating the sum for each group. ] --- # Pre-requisite .pull-top[ ## Working with Time Series in Pandas **Question**: How does Pandas handle time series data? **Answer**: Pandas has built-in support for time series data, including date indexing, resampling, and handling of date and time formats, making it ideal for analyzing temporal data. **Example**: Creating a time series DataFrame and resampling it to analyze weekly trends. ] --- # Pre-requisite .pull-top[ ## Integration of NumPy with Pandas **Question**: How do NumPy and Pandas integrate together? **Answer**: NumPy arrays can be used within Pandas DataFrames for numerical computations, enhancing performance and allowing seamless data manipulation and analysis. Pandas relies on NumPy for its data structures. **Example**: Using NumPy functions like `np.log()` on Pandas DataFrame columns. ] --- # Unit 1 .pull-top[ ## What is Artificial Intelligence (AI)? **Question**: What is Artificial Intelligence? **Answer**: AI is the simulation of human intelligence in machines, allowing them to perform tasks that typically require human intelligence, such as decision-making and language processing. **Example**: Virtual assistants like Siri and Alexa. ] --- # Unit 1 .pull-top[ ## What is Machine Learning (ML)? **Question**: What is Machine Learning? **Answer**: Machine Learning is a subset of AI that focuses on algorithms and statistical models enabling computers to learn from and make predictions based on data, without needing explicit programming. **Example**: Spam filtering in email services. ] --- # Unit 1 .pull-top[ ## AI vs. ML **Question**: What is the difference between AI and ML? **Answer**: AI is the broader concept of machines performing tasks intelligently, while ML is a specific approach within AI where machines learn from data. **Example**: An AI system could be a robot, with ML algorithms used within it to recognize objects. ] --- # Unit 1 .pull-top[ ## Applications of ML **Question**: What are some applications of Machine Learning? **Answer**: Machine Learning is used in various domains like fraud detection, recommendation systems (e.g., Netflix, Amazon), self-driving cars, and predictive maintenance. **Example**: A recommendation system suggesting products based on past purchases. ] --- # Unit 1 .pull-top[ ### Types of Machine Learning Algorithms **Question**: What are the types of Machine Learning algorithms? **Answer**: - **Supervised Learning**: Algorithms learn from labeled data (e.g., classification, regression). - **Unsupervised Learning**: Algorithms find patterns in unlabeled data (e.g., clustering). - **Reinforcement Learning**: Algorithms learn through rewards and punishments (e.g., game AI). ] --- # Unit 1 .pull-top[ ## AI vs. ML vs. Deep Learning (DL) **Question**: What is the difference between AI, ML, and DL? **Answer**: AI is the overarching field, ML is a subset of AI, and DL is a subset of ML that uses neural networks for more complex tasks. **Example**: Face recognition in social media platforms uses DL, a branch within ML under the AI umbrella. ] --- # Unit 1 .pull-top[ ## Data Mining vs. Machine Learning **Question**: How does Data Mining differ from Machine Learning? **Answer**: Data Mining focuses on discovering patterns in large datasets, whereas ML uses these patterns to make predictions and decisions. **Example**: Data mining might find purchase trends, and ML uses these trends to recommend products. ] --- # Unit 1 .pull-top[ ## Big Data Analytics **Question**: What is Big Data Analytics? **Answer**: Big Data Analytics is the process of examining large datasets to uncover hidden patterns, correlations, and insights, often feeding into ML models. **Example**: Analyzing user behavior data to enhance product recommendations. ] --- # Unit 1 .pull-top[ ## Essential Math and Statistics for ML **Question**: What are the essential math and statistics concepts needed for ML? **Answer**: Key areas include probability, linear algebra, calculus, and statistics, which form the foundation for ML algorithms and model evaluation. **Example**: Understanding probability helps in interpreting classification outcomes in ML. ] --- # Unit 2 .pull-top[ ## Introduction to Supervised Learning **Question**: What is Supervised Learning? **Answer**: Supervised learning is a type of machine learning where the model is trained on labeled data, meaning each training example is paired with an output label. **Example**: Predicting house prices based on features like size and location, where the dataset includes the price for each house. ] --- # Unit 2 .pull-top[ ## Linear Regression: Cost Function **Question**: What is the cost function in Linear Regression? **Answer**: The cost function, often Mean Squared Error (MSE), measures the average of the squares of the errors or differences between the predicted and actual values. It helps in determining how well the model fits the data. **Example**: For a line predicting house prices, the cost function calculates how far each prediction is from the actual price. ] --- # Unit 2 .pull-top[ ## Linear Regression: Gradient Descent **Question**: What is Gradient Descent in Linear Regression? **Answer**: Gradient descent is an optimization algorithm used to minimize the cost function by iteratively adjusting model parameters in the direction of the steepest descent. **Example**: Starting with a random line, gradient descent adjusts the slope and intercept to reduce the prediction error. ] --- # Unit 2 .pull-top[ ## Learning Rate **Question**: What is the learning rate in Gradient Descent? **Answer**: The learning rate is a parameter that controls the size of the steps taken during gradient descent. A higher rate may lead to faster convergence but risks overshooting, while a lower rate is more stable but slower. **Example**: Choosing a learning rate too high may cause the model to never reach an optimal solution. ] --- # Unit 2 .pull-top[ ## Classification: Logistic Regression **Question**: What is Logistic Regression? **Answer**: Logistic Regression is a classification algorithm used to predict binary outcomes by estimating probabilities using a logistic function. **Example**: Predicting whether an email is spam or not spam. ] --- # Unit 2 .pull-top[ ## Classification: Nearest-Neighbors **Question**: What is the Nearest-Neighbors algorithm? **Answer**: The Nearest-Neighbors algorithm classifies a data point based on how similar it is to its nearest neighbors in the feature space, usually by finding the majority class among the closest data points. **Example**: Classifying whether a flower is a particular species based on the species of its closest neighbors. ] --- # Unit 2 .pull-top[ ## Classification: Naive Bayes Classifier **Question**: What is the Naive Bayes Classifier? **Answer**: The Naive Bayes Classifier is a probabilistic classifier that applies Bayes’ theorem with the assumption of independence between features. It is particularly useful for text classification. **Example**: Spam detection in emails where the presence of certain words independently contributes to the probability of spam. ] --- # Unit 2 .pull-top[ ## Overfitting and Underfitting **Question**: What are Overfitting and Underfitting? **Answer**: Overfitting occurs when a model learns the training data too well, capturing noise instead of the underlying pattern, leading to poor generalization. Underfitting occurs when the model is too simple, missing important patterns. **Example**: A complex model that memorizes training data may overfit, while a linear model on complex data may underfit. ] --- # Unit 2 .pull-top[ ## Feature Scaling **Question**: What is Feature Scaling? **Answer**: Feature scaling is the process of standardizing or normalizing input features to ensure that they contribute equally to the model. This is essential for algorithms sensitive to the scale of data, like gradient descent. **Example**: Scaling features like age and income to prevent the model from being biased towards features with larger ranges. ] --- # Unit 2 .pull-top[ ## Regularization **Question**: What is Regularization in machine learning? **Answer**: Regularization is a technique to prevent overfitting by adding a penalty to the cost function, discouraging large coefficient values. Common methods include L1 (Lasso) and L2 (Ridge) regularization. **Example**: Applying regularization to reduce the impact of less important features in a regression model. ] --- # Unit 2 .pull-top[ ## Bias and Variance **Question**: What are Bias and Variance in model performance? **Answer**: Bias refers to error due to overly simplistic models, while variance refers to error due to model sensitivity to fluctuations in the training data. A good model balances bias and variance. **Example**: High bias leads to underfitting, while high variance leads to overfitting. ] --- # Unit 2 .pull-top[ ## Decision Trees **Question**: What is a Decision Tree? **Answer**: A Decision Tree is a supervised learning model that splits the data into branches based on feature values to make predictions. Each branch represents a decision rule, leading to a final prediction at the leaf nodes. **Example**: Using a decision tree to classify whether a customer will buy a product based on age and income. ] --- # Unit 2 .pull-top[ ## Introduction to Support Vector Machines **Question**: What is a Support Vector Machine (SVM)? **Answer**: SVM is a classification algorithm that finds the optimal hyperplane that best separates data points of different classes. It aims to maximize the margin between data points of different classes. **Example**: Classifying emails as spam or not spam by finding the optimal decision boundary. ] --- # Unit 2 .pull-top[ ## Applications of Supervised Learning **Question**: What are some applications of Supervised Learning? **Answer**: Supervised learning is widely used in applications such as fraud detection, customer segmentation, recommendation systems, medical diagnosis, and image recognition. **Example**: Predicting customer churn by learning from historical data on customer behavior. ] --- # Unit 3 .pull-top[ ## Introduction to Unsupervised Learning **Question**: What is Unsupervised Learning? **Answer**: Unsupervised learning is a type of machine learning where the model is trained on unlabeled data, aiming to find hidden patterns or groupings within the data without predefined outcomes. **Example**: Segmenting customers into groups based on purchasing behavior without prior labels. ] --- # Unit 3 .pull-top[ ## Clustering: K-Means **Question**: What is the K-Means Clustering algorithm? **Answer**: K-Means is an algorithm used to partition data into K clusters, where each data point belongs to the cluster with the nearest mean. It iteratively adjusts cluster centers to minimize the distance between points and their cluster's mean. **Example**: Grouping customers based on purchasing patterns into clusters for targeted marketing. ] --- # Unit 3 .pull-top[ ## Clustering: Hierarchical Clustering **Question**: What is Hierarchical Clustering? **Answer**: Hierarchical Clustering is a method of clustering that builds a hierarchy of clusters by either starting with each data point as a separate cluster (agglomerative) or all data points in one cluster (divisive), then merging or splitting clusters. **Example**: Building a hierarchy of related news articles based on similarity. ] --- # Unit 3 .pull-top[ ## Association Analysis: Apriori Algorithm **Question**: What is the Apriori Algorithm? **Answer**: The Apriori Algorithm is used in association analysis to find frequent itemsets and generate association rules by identifying combinations of items that appear frequently together in transactions. **Example**: Discovering that customers who buy bread and milk often buy eggs as well. ] --- # Unit 3 .pull-top[ ## Dimensionality Reduction: Subset Selection **Question**: What is Subset Selection in Dimensionality Reduction? **Answer**: Subset Selection is a technique to reduce dimensionality by selecting a subset of the most relevant features from the original dataset, helping to improve model efficiency and performance. **Example**: Selecting the top 5 most important features from a set of 50 variables in a dataset. ] --- # Unit 3 .pull-top[ ## Dimensionality Reduction: Principal Components Analysis (PCA) **Question**: What is Principal Components Analysis (PCA)? **Answer**: PCA is a dimensionality reduction technique that transforms data into a new coordinate system, where the largest variance lies on the first principal component, the second largest on the second component, and so on, reducing the number of features while retaining information. **Example**: Compressing high-dimensional image data while preserving the most significant information. ] --- # Unit 3 .pull-top[ ## Dimensionality Reduction: Linear Discriminant Analysis (LDA) **Question**: What is Linear Discriminant Analysis (LDA)? **Answer**: LDA is a dimensionality reduction technique commonly used for classification, which projects data onto a lower-dimensional space that maximizes the separation between classes. **Example**: Reducing features in a dataset for better classification of emails as spam or not spam. ] --- # Unit 3 .pull-top[ ## Introduction to Reinforcement Learning **Question**: What is Reinforcement Learning? **Answer**: Reinforcement Learning (RL) is a type of machine learning where an agent learns to make decisions by interacting with an environment, receiving rewards or penalties based on its actions, aiming to maximize cumulative rewards over time. **Example**: Training a robot to navigate a maze by rewarding it for reaching the end and penalizing it for hitting walls. ] --- # Unit 3 .pull-top[ ## Applications of Unsupervised Learning **Question**: What are some applications of Unsupervised Learning? **Answer**: Unsupervised learning is used in anomaly detection, customer segmentation, image compression, and recommendation systems, where patterns are identified in unlabeled data. **Example**: Detecting fraudulent transactions by identifying transactions that deviate from normal behavior. ] --- # Unit 4 .pull-top[ ## Ensemble Methods **Question**: What are Ensemble Methods in machine learning? **Answer**: Ensemble methods are techniques that combine predictions from multiple models to improve accuracy and robustness. The idea is that combining diverse models can reduce errors and increase performance. **Example**: Voting among different classifiers like decision trees, SVMs, and logistic regression to make a final prediction. ] --- # Unit 4 .pull-top[ ## Evaluating Machine Learning Algorithms and Model Selection **Question**: How are machine learning algorithms evaluated and selected? **Answer**: Machine learning algorithms are evaluated using metrics like accuracy, precision, recall, F1 score, and AUC-ROC. Cross-validation and testing on unseen data help in selecting the best model for a given problem. **Example**: Using 10-fold cross-validation to ensure the model performs well on various data subsets. ] --- # Unit 4 .pull-top[ ## Ensemble Methods: Mixture Models **Question**: What are Mixture Models in ensemble methods? **Answer**: Mixture models are probabilistic models representing data as a mixture of multiple distributions, allowing for flexible clustering and classification by accounting for data generated by different processes. **Example**: Gaussian Mixture Model (GMM) clusters data assuming it comes from multiple Gaussian distributions. ] --- # Unit 4 .pull-top[ ## Classifier Using Multiple Samples of the Dataset **Question**: How does using multiple samples of the dataset improve classification? **Answer**: By using multiple samples (bootstrap samples), ensemble methods like bagging can reduce variance and increase the stability and accuracy of classifiers. Each sample helps train a model variation, enhancing performance. **Example**: In bagging, different samples are used to train multiple decision trees, which are then combined for a final prediction. ] --- # Unit 4 .pull-top[ ## Improving Classifier by Focusing on Errors **Question**: How can classifiers improve by focusing on errors? **Answer**: Techniques like boosting improve classifiers by iteratively focusing on errors, giving higher weight to misclassified instances in each iteration, which enhances model accuracy. **Example**: In AdaBoost, misclassified points are given more weight, forcing the classifier to learn from its mistakes. ] --- # Unit 4 .pull-top[ ## Weak Learner with a Decision Stump **Question**: What is a weak learner with a decision stump? **Answer**: A weak learner is a model that performs slightly better than random chance. A decision stump, a simple one-level decision tree, is often used as a weak learner in boosting algorithms. **Example**: In AdaBoost, multiple decision stumps are combined to create a stronger classifier. ] --- # Unit 4 .pull-top[ ## Bagging **Question**: What is Bagging in ensemble methods? **Answer**: Bagging, or Bootstrap Aggregating, is an ensemble method that involves training multiple models on different bootstrap samples of the data and averaging their predictions to improve accuracy and reduce variance. **Example**: Random Forest uses bagging with decision trees, training each tree on a different sample. ] --- # Unit 4 .pull-top[ ## Stacking **Question**: What is Stacking in ensemble methods? **Answer**: Stacking is an ensemble method where multiple models are trained to make predictions, and their outputs are then used as input features to a "meta-model" that makes the final prediction. **Example**: Combining predictions from logistic regression, SVM, and decision trees into a final model like a neural network for better accuracy. ] --- # Unit 4 .pull-top[ ## Boosting **Question**: What is Boosting in ensemble methods? **Answer**: Boosting is an ensemble method that creates a strong classifier by sequentially training weak classifiers, each focusing on correcting the errors of its predecessors. **Example**: AdaBoost is a popular boosting technique that adjusts weights for misclassified instances in each iteration. ] --- # Unit 4 .pull-top[ ## Implementing the AdaBoost Algorithm **Question**: What is AdaBoost and how is it implemented? **Answer**: AdaBoost (Adaptive Boosting) is a boosting algorithm that combines multiple weak learners, typically decision stumps, by giving higher weights to instances misclassified by previous learners, creating a strong classifier. **Example**: An AdaBoost model sequentially adds decision stumps, focusing more on instances that previous stumps misclassified. ] --- # Unit 4 .pull-top[ ## Classifying with AdaBoost **Question**: How does AdaBoost perform classification? **Answer**: AdaBoost classifies by aggregating predictions from each weak learner, weighted according to their accuracy. Final predictions are based on a weighted vote from all learners, improving accuracy. **Example**: Using AdaBoost to classify emails as spam or not spam by aggregating weak classifiers' predictions. ] --- # Unit 4 .pull-top[ ## Bootstrapping and Cross Validation **Question**: What are Bootstrapping and Cross-Validation? **Answer**: Bootstrapping is a resampling method that generates multiple datasets by sampling with replacement. Cross-validation splits data into training and testing subsets multiple times to evaluate model stability and performance. **Example**: Using bootstrapping to create multiple training sets for bagging or using k-fold cross-validation for robust model evaluation. ] --- # Unit 5 .pull-top[ ## Introduction to Deep Learning **Question**: What is Deep Learning? **Answer**: Deep Learning is a subset of machine learning focused on neural networks with multiple layers, which can model complex patterns in data. It excels in areas like image and speech recognition due to its ability to learn hierarchical representations. **Example**: Recognizing objects in images using convolutional neural networks. ] --- # Unit 5 .pull-top[ ## Introduction to Neural Networks **Question**: What is a Neural Network? **Answer**: A neural network is a computational model inspired by the human brain, consisting of layers of interconnected nodes (neurons) that process data through weights and activations. Neural networks are fundamental to deep learning. **Example**: A neural network can classify handwritten digits by learning patterns in pixel intensities. ] --- # Unit 5 .pull-top[ ## Perceptron **Question**: What is a Perceptron? **Answer**: A perceptron is the simplest type of neural network, consisting of a single neuron with inputs, weights, and an activation function. It is a basic building block for neural networks, used primarily for binary classification tasks. **Example**: A perceptron can classify data points as belonging to one of two classes based on a linear boundary. ] --- # Unit 5 .pull-top[ ## Feedforward Neural Network **Question**: What is a Feedforward Neural Network? **Answer**: A feedforward neural network is a type of neural network where connections between nodes do not form cycles. Data flows in one direction, from input to output, making it a basic structure for neural networks. **Example**: Predicting house prices based on features using a feedforward neural network. ] --- # Unit 5 .pull-top[ ## Backpropagation **Question**: What is Backpropagation? **Answer**: Backpropagation is an algorithm used to train neural networks by minimizing error through calculating gradients and updating weights in reverse from output to input layers. It enables efficient learning in multi-layer networks. **Example**: Adjusting weights in a neural network for image recognition by backpropagating the error after each training example. ] --- # Unit 5 .pull-top[ ## Backpropagation with Simple Example **Question**: How does Backpropagation work with a simple example? **Answer**: In backpropagation, errors are calculated at the output layer and propagated back through the network to update weights. For example, in a network with one hidden layer, errors at the output are used to adjust weights between the hidden and output layers, then errors at the hidden layer adjust weights from input to hidden layers. **Example**: If a network misclassifies an image, backpropagation updates weights to reduce the chance of the same error in future iterations. ] --- # Unit 5 .pull-top[ ## Convolutional Neural Network (CNN) **Question**: What is a Convolutional Neural Network (CNN)? **Answer**: A CNN is a type of neural network designed for image processing, which uses convolutional layers to detect spatial hierarchies in images. CNNs are widely used for visual tasks like image recognition and object detection. **Example**: A CNN can classify images of animals by learning distinctive features in each image. ] --- # Unit 5 .pull-top[ ## Types of Convolutional Neural Networks (CNNs) **Question**: What are some types of CNN architectures? **Answer**: Types of CNN architectures include LeNet, AlexNet, VGG, ResNet, and Inception, each with unique configurations and optimizations for tasks like image classification and object detection. These models vary in depth, complexity, and processing techniques. **Example**: ResNet uses skip connections to allow deeper networks, which helps prevent the vanishing gradient problem. ] --- class: inverse, center, middle # Thanks