Posts

Showing posts from August, 2020

Decision Tree algorithm

Image
A decision tree is a supervised machine learning algorithm mainly used for Regression and Classification. It breaks down a data set into smaller and smaller subsets while at the same time an associated decision tree is incrementally developed. The final result is a tree with decision nodes and leaf nodes. A decision tree can handle both categorical and numerical data.  

Different kernels in SVM

 There are four types of kernels in SVM. Linear Kernel Polynomial kernel Radial basis kernel Sigmoid kernel

Support Vectors in SVM

Image
  In the diagram, we see that the thinner lines mark the distance from the classifier to the closest data points called the support vectors (darkened data points). The distance between the two thin lines is called the margin.

SVM algorithm

Image
SVM stands for support vector machine, it is a supervised machine learning algorithm which can be used for both Regression and Classification. If you have n features in your training data set, SVM tries to plot it in n-dimensional space with the value of each feature being the value of a particular coordinate. SVM uses hyperplanes to separate out different classes based on the provided kernel function.    

Naive Bayes

The Naive Bayes Algorithm is based on the Bayes Theorem. Bayes’ theorem describes the probability of an event, based on prior knowledge of conditions that might be related to the event. The Algorithm is ‘naive’ because it makes assumptions that may or may not turn out to be correct. 

Eigenvectors and Eigenvalues

Image
Eigenvectors  are used for understanding linear transformations.  In data analysis, we usually calculate the eigenvectors for a correlation or covariance matrix.  Eigenvectors are the directions along which a particular linear transformation acts by flipping, compressing or stretching. Eigenvalue  can be referred to as the strength of the transformation in the direction of eigenvector or the factor by which the compression occurs.

Univariate, bivariate and multivariate analysis

  Univariate  analyses  are descriptive statistical analysis techniques which can be differentiated based on the number of variables involved at a given point of time. For example, the pie charts of sales based on territory involve only one variable and can the analysis can be referred to as univariate analysis. The  bivariate  analysis  attempts to understand the difference between two variables at a time as in a scatterplot.  For example, analyzing the volume of sale and spending can be considered as an example of bivariate analysis. Multivariate analysis  deals with the study of more than two variables to understand the effect of variables on the responses.

Softmax non-linearity function

Image
It is because it takes in a vector of real numbers and returns a probability distribution. Its definition is as follows. Let x be a vector of real numbers (positive, negative, whatever, there are no constraints). Then the i’th component of Softmax( x) is —    It should be clear that the output is a probability distribution: each element is non-negative and the sum over all components is 1.

TF/IDF Vectorization

Image
TF–IDF is short for term frequency-inverse document frequency, is a numerical statistic that is intended to reflect how important a word is to a document in a collection or corpus. It is often used as a weighting factor in information retrieval and text mining. The TF–IDF value increases proportionally to the number of times a word appears in the document but is offset by the frequency of the word in the corpus, which helps to adjust for the fact that some words appear more frequently in general.

Law of Large Numbers

Image
  It is a theorem that describes the result of performing the same experiment a large number of times. This theorem forms the basis of frequency-style thinking. It says that the sample means, the sample variance and the sample standard deviation converge to what they are trying to estimate.

K-Fold Cross Validation

Image
 Cross-validation, sometimes called rotation estimation or out-of-sample testing, is any of various similar model validation techniques for assessing how the results of a statistical analysis will generalize to an independent data set. It is mainly used in settings where the goal is prediction, and one wants to estimate how accurately a predictive model will perform in practice. In a prediction problem, a model is usually given a dataset of known data on which training is run (training dataset), and a dataset of unknown data (or first seen data) against which the model is tested (called the validation dataset or testing set). The goal of cross-validation is to test the model's ability to predict new data that was not used in estimating it, in order to flag problems like overfitting or selection bias and to give an insight on how the model will generalize to an independent dataset (i.e., an unknown dataset, for instance from a real problem).    K-Fold CV is where a given data set is

Over-fitting and under-fitting

Image
In statistics and machine learning, one of the most common tasks is to fit a  model  to a set of training data, so as to be able to make reliable predictions on general untrained data. In overfitting , a statistical model describes random error or noise instead of the underlying relationship. Overfitting occurs when a model is excessively complex, such as having too many parameters relative to the number of observations. A model that has been overfitted, has poor predictive performance, as it overreacts to minor fluctuations in the training data. Underfitting  occurs when a statistical model or machine learning algorithm cannot capture the underlying trend of the data. Underfitting would occur, for example, when fitting a linear model to non-linear data. Such a model too would have poor predictive performance. To combat overfitting and underfitting, you can resample the data to estimate the model accuracy (k-fold cross-validation) and by having a validation dataset to eval

A/B Testing

Image
      It is a hypothesis testing for a randomized experiment with two variables A and B. The goal of A/B Testing is to identify any changes to the web page to maximize or increase the outcome of interest. A/B testing is a fantastic method for figuring out the best online promotional and marketing strategies for your business. It can be used to test everything from website copy to sales emails to search ads An example of this could be identifying the click-through rate for a banner ad.

“long” and “wide” format data

Image
      In the wide-format , a subject’s repeated responses will be in a single row, and each response is in a separate column. In the  long-format , each row is a one-time point per subject. You can recognize data in wide format by the fact that columns generally represent groups.

Confusion matrix

Image
 The confusion matrix is a 2X2 table that contains 4 outputs provided by the   binary classifier . Various measures, such as error-rate, accuracy, specificity, sensitivity, precision and recall are derived from it.   Confusion Matrix     A data set used for performance evaluation is called a test data set . It should contain the correct labels and predicted labels.     The predicted labels will exactly the same if the performance of a binary classifier is perfect.   The predicted labels usually match with part of the observed labels in real-world scenarios.   Basic measures derived from the confusion matrix Error Rate = (FP+FN)/(P+N) Accuracy = (TP+TN)/(P+N) Sensitivity(Recall or True positive rate) = TP/P Specificity(True negative rate) = TN/N Precision(Positive predicted value) = TP/(TP+FP) F-Score(Harmonic mean of precision and recall) = (1+b)(PREC.REC)/(b²PREC+REC) where b is commonly 0.5, 1, 2. Basic measures derived from the confusion matrix Error Rate = (FP+FN)/(P+N) Accuracy =

Bias-variance trade-off

Image
  Bias: Bias is an error introduced in your model due to oversimplification of the machine learning algorithm. It can lead to underfitting. When you train your model at that time model makes simplified assumptions to make the target function easier to understand. Low bias machine learning algorithms — Decision Trees, k-NN and SVM High bias machine learning algorithms — Linear Regression, Logistic Regression Variance: Variance is error introduced in your model due to complex machine learning algorithm, your model learns noise also from the training data set and performs badly on test data set. It can lead to high sensitivity and overfitting. Normally, as you increase the complexity of your model, you will see a reduction in error due to lower bias in the model. However, this only happens until a particular point. As you continue to make your model more complex, you end up over-fitting your model and hence your model will start suffering from high variance.   Bias-Varia

Selection Bias

  Selection bias is a kind of error that occurs when the researcher decides who is going to be studied. It is usually associated with research where the selection of participants isn’t random. It is sometimes referred to as the selection effect. It is the distortion of statistical analysis, resulting from the method of collecting samples. If the selection bias is not taken into account, then some conclusions of the study may not be accurate. The types of selection bias include: Sampling bias : It is a systematic error due to a non-random sample of a population causing some members of the population to be less likely to be included than others resulting in a biased sample. Time interval : A trial may be terminated early at an extreme value (often for ethical reasons), but the extreme value is likely to be reached by the variable with the largest variance, even if all variables have a similar mean. Data : When specific subsets of data are chosen to support a conclusion or

Normal Distribution

Image
  Data is usually distributed in different ways w i th a bias to the left or to the right or it can all be jumbled up. However, there are chances that data is distributed around a central value without any bias to the left or right and reaches normal distribution in the form of a bell-shaped curve.     The random variables are distributed in the form of a symmetrical, bell-shaped curve. Properties of Normal Distribution are as follows; Unimodal -one mode Symmetrical -left and right halves are mirror images Bell-shaped -maximum height (mode) at the mean Mean, Mode, and Median are all located in the center Asymptotic