Companies need data scientists. They need people who are able to take large amounts of data and make it usable. The national average salary for a Data Scientist in the United States is $117,212. Data Scientist roles in Australia were typically advertised between $110k and $140k in the last 3 months. Follow along and learn the 50 most common and advanced Data Scientist Interview Questions and Answers (PDF download ready) you must know before your next Machine Learning and Data Science interview.
Essentially, Machine Learning is a method of teaching computers to make and improve predictions or behaviors based on some data. Machine Learning introduces a class of algorithms which is data-driven, i.e. unlike "normal" algorithms it is the data that "tells" what the "good answer" is. Machine learning creates a model based on sample data and use the model to make some prediction.
More rigid explanation: Machine Learning is a field of computer science, probability theory, and optimization theory which allows complex tasks to be solved for which a logical/procedural approach would not be possible or feasible.
Dimensionality Reduction is typically choosing a basis or mathematical representation within which you can describe most but not all of the variance within your data, thereby retaining the relevant information, while reducing the amount of information necessary to represent it.
There are a variety of techniques for doing this including but not limited to PCA, ICA, and Matrix Feature Factorization.
These will take existing data and reduce it to the most discriminative components. These all allow you to represent most of the information in your dataset with fewer, more discriminative features.
MSE = (1/n) * Σ(actual – forecast)2
The curse of dimensionality refers to various phenomena that arise when analyzing and organizing data in high-dimensional spaces that do not occur in low-dimensional settings. The common theme of these problems is that when the dimensionality increases, the volume of the space increases so fast that the available data become sparse.
Let's say you have a straight line 100 yards long and you dropped a penny somewhere on it. It wouldn't be too hard to find. You walk along the line and it takes two minutes.
Now let's say you have a square 100 yards on each side and you dropped a penny somewhere on it. It would be pretty hard, like searching across two football fields stuck together. It could take days.
Now a cube 100 yards across. That's like searching a 30-story building the size of a football stadium. Ugh.
The difficulty of searching through the space gets a lot harder as you have more dimensions. You might not realize this intuitively when it's just stated in mathematical formulas, since they all have the same "width". That's the curse of dimensionality.
p unit vectors, where the i-th vector is the direction of a line that best fits the data while being orthogonal to the i - 1 vectors. The best-fitting line is defined as the line that minimizes the average squared distance from the points to the line.68 - 95 - 99.7 rule for Normal Distribution?The rule states that 68%, 95%, and 99.7% of the values lie within one, two, and three standard deviations of the mean, respectively.
Supervised learning is when the data you feed your algorithm with is tagged or labelled, to help your logic make decisions.
Example: a hypothetical non-machine learning algorithm for face detection in images would try to define what a face is (round skin-like-colored disk, with dark area where you expect the eyes etc). A machine learning algorithm would not have such coded definition, but would "learn-by-examples": you'll show several images of faces and not-faces and a good algorithm will eventually learn and be able to predict whether or not an unseen image is a face.
Unsupervised learning are types of algorithms that try to find correlations without any external inputs other than the raw data (your examples are not labeled, i.e. you don't say anything). In such a case the algorithm itself cannot "invent" what a face is, but it can try to cluster the data into different groups, e.g. it can distinguish that faces are very different from landscapes, which are very different from horses.
Although the task we are targeting in logistic regression is a classification, logistic regression does not actually individually classify things for you: it just gives you probabilities (or log odds ratios in the logit form).
The only way logistic regression can actually classify stuff is if you apply a rule to the probability output. For example, you may round probabilities greater than or equal to 50% to 1, and probabilities less than 50% to 0, and that’s your classification.
Gradient descent is performed by the update rule:
yielding new parameters which should give a smaller loss . The quantity is the learning rate. \
The gradient descent rule requires the gradient to be defined, so the loss function must be differentiable. \
In most texts on calculus or mathematical analysis you'll find the result that if a function is differentiable at a point x, it is also continuous at x. Obviously, there is no hope that we could perform this procedure without knowing the gradient. \
In principle, differentiability is sufficient to run gradient descent. That said, unless L is convex, gradient descent offers no guarantees of convergence to a global minimizer. In practice, neural network loss functions are rarely convex anyway.
f becomes non-differentiable.The applicability of batch or stochastic gradient descent depends on the error manifold expected.
One benefit of SGD is that it's computationally a whole lot faster. Large datasets often can't be held in RAM, which makes vectorization much less efficient. Rather, each sample or batch of samples must be loaded, worked with, the results stored, and so on. Minibatch SGD, on the other hand, is usually intentionally made small enough to be computationally tractable. Usually, this computational advantage is leveraged by performing many more iterations of SGD, making many more steps than conventional batch gradient descent. This usually results in a model that is very close to that which would be found via batch gradient descent, or better.
Hence, there is a tradeoff between overfitting and underfitting and we have to maintain a balance while choosing the value of K in KNN, K should not be too small or too large.
When something unlikely happens, we say it's big news. Also, when we say something predictable, it's not really interesting. So to quantify this `interestingness, the function should satisfy
one bit of information.One natural measure that satisfies the constraints is
I(X) = -log_2(p)
where p is the probability of the event X. And the unit is in bit, the same bit computer uses. 0 or 1.
A computer program is said to learn from experience with respect to some class of tasks if its performance in these tasks, with respect to some performance measure, improves with experience.
A High Variance model is due to a complex model and can be easily identified when you see:
To fix a high variance model, you can:
Binary targets: In this case, the observed value is drawn from -1 to 1. The loss function for this case is shown as follows:
Where, is the predicted output. y is the observed output.
This type of loss function implements a machine learning method known as logistic regression.
Categorical targets: If y are the probabilities of k classes, and rth class is the ground truth class, the loss function for a single instance is defined as follows:
This type of loss function implements multinomial logistic regression, and it is called cross-entropy loss.
Binary logistic regression is similar to multinomial logistic regression with the value of k set to 2.
d polynomials, the polynomial kernel is defined as:where x and y are vectors in the input space.
There are three types of gradient descent methods based on the amount of data used to calculate the gradient:
Some challenges faced when using a supervised regression model are:
Machine Learning
Data Mining
Pattern Recognition
Overlap and Associations
The two branches of dimensionality reduction are:
The basic definition of entropy is a measure of disorder. The equation of entropy is as follows:
where,
is the probability of frequentist probability of the element i in the data.
In machine learning models, the goal is to decrease uncertainties. Thus, the models should have less entropy.
Y given X from the entropy of just Y. E(Y|X) corresponds to the information of Y that we already know. So, E(Y|X) is not new information for the model.The matrix gives the following outputs:
In probability theory, the Central Limit Theorem (CLT) states that the distribution of a sample variable approximates a normal distribution (i.e., a “bell curve”) as the sample size becomes larger, assuming that all samples are identical in size, and regardless of the population's actual distribution shape.
Put another way, CLT is a statistical premise that, given a sufficiently large sample size from a population with a finite level of variance, the mean of all sampled variables from the same population will be approximately equal to the mean of the whole population.
Mathematically, the Central Limit Theorem (CLT) is a statement about the cumulative distribution function of the random variable
where the are independent identically distributed random variables with mean and standard deviation . The CLT asserts that for each , ,
as .
Long story short, I would say that:
A loss function is a part of a cost function which is a type of an objective function.
These are not very strict terms and they are highly related. However:
All that being said, thse terms are far from strict, and depending on context, research group, background, can shift and be used in a different meaning. With the main (only?) common thing being "loss" and "cost" functions being something that want wants to minimise, and objective function being something one wants to optimise (which can be both maximisation or minimisation).
If you have high variance problem:
How would you identify each one and what is their importance?
We can identify each case by plotting the residual values vs the fitted values of a linear regression model.
The importance of each one case relies on the context of the ordinary least squares (OLS) estimator, which is a common way to perform linear regression. In OLS, we must satisfy the assumption of homoskedasticity in order to get an efficient estimation.
All three are so-called "meta-algorithms": approaches to combine several machine learning techniques into one predictive model in order to decrease the variance (bagging), bias (boosting) or improving the predictive force (stacking alias ensemble).
Bagging (stands for Bootstrap Aggregating) is a way to decrease the variance of your prediction by generating additional data for training from your original dataset using combinations with repetitions to produce multisets of the same cardinality/size as your original data. By increasing the size of your training set you can't improve the model predictive force, but just decrease the variance, narrowly tuning the prediction to expected outcome.
Boosting is a two-step approach, where one first uses subsets of the original data to produce a series of averagely performing models and then "boosts" their performance by combining them together using a particular cost function (=majority vote). Unlike bagging, in the classical boosting the subset creation is not random and depends upon the performance of the previous models: every new subsets contains the elements that were (likely to be) misclassified by previous models.
Stacking is a similar to boosting: you also apply several models to your original data. The difference here is, however, that you don't have just an empirical formula for your weight function, rather you introduce a meta-level and use another model/approach to estimate the input together with outputs of every model to estimate the weights or, in other words, to determine what models perform well and what badly given these input data.
the Interquartile Range tells you the spread of the middle half of your distribution.
Quartiles segment any distribution that’s ordered from low to high into four equal parts. The interquartile range (IQR) contains the second and third quartiles, or the middle half of your data set.
The interquartile range is the best measure of variability for skewed distributions or data sets with outliers. Because it’s based on values that come from the middle half of the distribution, it’s unlikely to be influenced by outliers.
This depends on your loss function. In many circumstances it makes sense to give more weight to points further away from the mean:
10 is more than twice as bad as being off by 5. In such cases, RMSE is a more appropriate measure of error.10 is just twice as bad as being off by 5, then MAE is more appropriate.Another situation when you want to use (R)MSE instead of MAE: when your observations' conditional distribution is asymmetric and you want an unbiased fit. The (R)MSE is minimized by the conditional mean, the MAE by the conditional median. So if you minimize the MAE, the fit will be closer to the median and biased.
PCA on large datasets or there is a better alternative?The PCA object is very useful but has certain limitations for large datasets. The biggest limitation is that PCA only supports batch processing, which means all of the data to be processed must fit in the main memory.
A better alternative to use with large dataset is IncrementalPCA, this object uses a different form of processing and allows for partial computations which almost exactly match the results of PCA while processing the data in a minibatch fashion.
IncrementalPCA has the parameter batch_size to specify the number of samples to use for each batch and only stores estimates of component and noise variances, in order to update explained_variance_ratio_ incrementally. The memory usage depends on the number of samples per batch, rather than the number of samples to be processed in the dataset.
Therefore depending on the size of the input data, this algorithm can be much more memory efficient than a PCA, and allows sparse input.
Prepare for AI developer and engineer interviews with 19 answered OpenClaw questions covering Gateway architecture, channels, agent workspaces, memory, MCP, model failover, multi-agent routing, security, sandboxing, approvals, and remote operations....
Prepare for AI agent developer interviews with 15 Model Context Protocol (MCP) questions covering tools, resources, prompts, JSON-RPC, transports, roots, sampling, security, and practical MCP server design....
Amazone runs the internet as we know it. Amazon Web Services (AWS) offers a comprehensive suite of machine learning (ML) services that cater to various needs and expertise levels. Follow along and learn the 23 most common AWS machine-learning intervi...