Post

Visualizzazione dei post con l'etichetta Insight

Welford Algorithm

Immagine
The variance is the expectation of the squared deviation of a random variable form its mean.  Informally, it measures how far a set of (random) numbers are spread out from their average value. The variance is the square of the standard deviation, the second central moment of a distribution and the covariance of the random variable with itself, and it is often represented by Var(X), σ 2 , s 2 . One of the most widely known formula for computing the variance is: where x-bar is the mean of the sample. The definition given above can be converted into an algorithm that computed the variance and the standard deviation in two passes: 1. Compute the mean                            (O(n)) 2. Compute the square differences       (O(n)) Output the variance Even though this algorithm seems working properly, it may become too expensive on some input instances. Just consider a sampling procedu...

Insight 7 -- Montecarlo techniques

Monte Carlo Methods Monte Carlo methods (aka experiments) are a broad class of computational algorithms that rely on repeated random  sampling to obtain numerical results. Their essential idea is using randomness  to solve problems that might be deterministic in principle. Monte Carlo methods are typically used to solve problems which belongs to the following 'classes': optimisation; numerical integration; generating draws from probability distribution . In principle, Monte Carlo methods can be used to solve any problem having a probabilistic interpretation. In fact, since there is no known consensus on how Monte Carlo should be defined, we can say that a Monte Carlo method is just a technique to solve a mathematical/statistical problem whereas a Monte Carlo simulation is the actual Monte Carlo simulation/experiment (e.g. repeatedly sample from a specific population in order to compute the empirical mean and/or other statistics in interest). To put it simpler, pouri...

Insight 6 -- Machine Epsilon

Rounding is a procedure for choosing the representation of a real number in a floating point number system. The machine epsilon, which is also called macheps or unit roundoff, is the maximum relative error of the chosen rounding procedure. Recall that a real number x can be represented as a floating-point number: x  = σ •  y  • b e where     •  σ = ± 1 is the sign     • e  is an integer, the exponent     • 1 ≤ y  < b , the significand or mantissa With the use of such a floating-point system, is important to note that the numbers we can store are not  equally spaced even though a wide range of variably-spaced numbers can be represented exactly. For instance, 2.125 = 2 1 + 2 -3 has an exact representation in binary whereas 3.1 does not: 3.1 ≈ 2 1 + 2 0 + 2 -4 + 2 -5 + 2 -8 + ...  And, of course, there are numbers (like π) that have no finite representation in either decimal or binary nu...

Insight 1 -- Most used programming languages within VS.NET

Microsoft Visual Studio is an integrated development environment (IDE) developed by Microsoft. It can be used to develop computer programs as well as websites, web applications, web services and mobile apps. Visual Studio includes a code editor supporting IntelliSense as well as code refactoring and, furthermore, it has an integrated debugger which works both as a source-level debugger and as a machine-level debugger. Visual Studio supports 36 different programming languages and allows the code editor and debugger to support nearly any programming language. Most famous programming languages that are supported include C, C++, Visual Basic .NET, C#, JavaScript, XML, HTML, and CSS. Support for other programming languages (such as Python and Ruby) is available through plug-ins. Online Translators A source-to-source compiler (or transcompiler) is a type of computer that takes the source code of a program written in one programming language as input and produces the equivalent source...

Insight 5 - Floating Point Representation and their Computational Issues

Immagine
Floating-point representation In computing, a floating-point representation is an approximation which allows modern computers to support the trade-off between range and precision when handling real numbers. Representing numbers as integers in a fixed number of bits has some notable limitations. It cannot handle numbers that have a fraction and it's not suitable for very large numbers that don't fit into (e.g.) 32 bits. In general, a number is represented by an approximation to a fixed number of significant digits (the significant) and scaled using an exponent for some fixed base; the base for the scaling is normally two, ten, or sixteen. A number that can be represented exactly has the following form: where significand, base, and exponent are all integers and the base is greater than or equal to two. As an example, consider 12345 x 10 -4 = 1.2345, or 11111 x 10 -1 = 1111.1. The term floating point refers to the fact that a number's radix point (decimal point or...

Insight 4 - Kahan and Neumaier Summation

Immagine
Algorithms for 'online data stream' arithmetic mean Data streams can be denoted as an ordered sequence of points that must be accessed sequentially and can be read only once or a small number of times. Efficient processing over massive data sets has taken an increased importance in the last few decades due to the growth of the data traffic and storage required by even more applications. In particular, monitoring huge and rapidly changing streams of data has emerged as an important data management problem. Some applications are the analysis of network traffic, transaction logs, telephone call records and many more. Since data streams have potentially unbounded size, when the amount of computation memory is limited it may be impossible to produce an exact result. Here the challenge is to produce high quality approximated answers, that is, answers as correct as possible. Let's take the arithmetic mean as an example. Considering a huge data stream and by using the...

Insight 3 - Bayes' Theorem

Before giving the Bayes theorem statement is important to define the conditional probability. Once done, the Bayes theorem is easy to derive. Conditional Probability The conditional probability measures the likelihood of an event given that another event has occurred. For instance, assuming that  A  is the event of interest and that  B consists of a different event which has already occurred. The probability of the event  A  to occur, given the occurrence of B , (written as)  P ( A  | B ), can be computed as detailed by the following equality. P(A | B) = P(A ∩ B) / P(B)        P( B ) > 0                               (1) It is defined as the quotient of the probability of the joint events A  and B  and the probability of B . Now consider P(B | A), which is equals to P(B ∩ A) / P(A). Since P(B ∩ A) =  P(A ∩ B), then the fo...

Insight 2 - Kolmogorov Axioms and Relative Frequency

Immagine
Probability theory is a branch of mathematics concerned with the analysis of phenomena, characterised by randomness or uncertainty, in order to model/predict the behaviour of defined systems. Although there are several different probability interpretations, such as the propensity interpretation or the subjective one, the most used and established probability theory is due to Andrey N. Kolmogorov, a Russian mathematician which combined previous studies on the field and presented his axiom system for probability theory in 1933. This blog post is intended to introduce the reader to the main axioms and rules regarding the Kolmogorov's theory. Let S  denote a sample space with a probability measure P  defined over it, such that the probability of any event E ⊂ S  is given by P(E) . Then, the probability measure obeys the following axioms: AXIOM 1 - The probability of an event is a non-negative real number: P(E)  ∈   ℝ,   P(E) ≥ 0   ...