Search

Featured blog posts

Three Big Data Viz Myths, Busted

With data science and machine learning having gone mainstream, there is a ballooning of interest and expectations. However, many of these expectations... Read More

How to Build Large-Scale Web Applications

Identifying the right architecture for your web product is crucial. It should be scalable and be able to handle high loads, especially if you’re... Read More

Fighting Covid-19 Using Data Science, AI, and Machine Learning

The world is suffering from a pandemic, the emergence of the novel Coronavirus has left the world in turbulence. COVID-19, the disease caused by the v... Read More

How to Keep Your Project Moving During the Coronavirus Outbreak

The Coronavirus outbreak has put the world into testing times and quite a frustrating one as well. People are being laid-off from work due to companie... Read More

Machine Learning Models Explained

Definition of Machine LearningLet’s start with defining machine learning to a five-year-old: Machine learning is when you load lots of data into... Read More

Measuring outcomes, not IT availability

The service level agreement (SLA) model has always served as a guarantee of a service in the IT world.Traditionally, SLAs have sought to measure what ... Read More

ITIL 4: Embedding safety culture and behavior

How well prepared are organizations for information security and risk management in an increasingly cloud computing-based world that is also volatil... Read More

Four Ways to Agile Your Tech Team

Agile organizations fared substantially better than their non-agile counterparts in performance metrics as per research from the Project Management In... Read More

Emotional Intelligence for Project Management Practitioners

Economic figures indicate a significant and growing need for innovation in today's global economy. In order to achieve a sustainable competitive a... Read More

Lean Six Sigma Tools To Use With DMAIC

An organization requires good quality information to operate. It also needs the processes to meet these requirements. Organizations look for ways to i... Read More

Topics

Latest Posts

Learn AngularJs Expressions With Examples

AngularJS is a dynamic and robust JavaScript-based MVW (Model View Whatever) Framework. One of the most popular open-source web application frameworks, Angular has been super-powered by Google since 2010. It is a toolset used for building the framework most suited to single page application development; but can also be utilized to work for other categories of web pages. Fully extensible, Angular works well with other web-based libraries. All its features can be modified and can even be replaced to suit your unique development workflow and web feature needs.   Since AngularJS is a pure JavaScript framework, it can be added to an HTML page with a normal  tag with src attribute pointing to the source framework library, just like other JavaScript libraries.  AngularJS extends HTML attributes using Directives.  It binds data to HTML using Expressions. AngularJS can be downloaded from https://angularjs.org/. If you’re new to AngularJS, it is better to get introductory information from http://angularjs.org. This site provides the basic information required to start working with AngularJS. It has various features including MVC Architecture, Directives, Expressions, Controllers, Filters, HTML DOM, Modules, Views, AJAX, Scopes, Services, Dependency Injection, and Internationalization. We will deal with Expressions in the following section. Introduction  Expressions In AngularJS, expressions are used to bind application data to HTML. AngularJS resolves the expression, and returns the result exactly where the expression is written. We will learn about each type of Expression in detail. The topics we will go through in this article are: Introduction to Expressions AngularJS Examples AngularJS using Numbers AngularJS using Strings AngularJS using Objects AngularJS using Arrays AngularJS Expression Capabilities and Limitations. Expressions in AngularJS Expressions are used to bind application data to html, and are written inside double braces in this manner: {{ expression}}. They behave in the same way as ng-bind directives. AngularJS application expressions are pure JavaScript expressions and output the data where they are used. They have the following qualities: Can be written inside double braces: {{ expression }}. Can also be written inside a directive: ng-bind="expression". AngularJS will resolve the expression, and return the result exactly where the expression is written. Much like JavaScript expressions, they can contain literals, operators, and variables. Example {{ 5 + 5 }} or {{ firstName + " " + lastName }} * Note: The ng-bind directive tells AngularJS to replace the content of an HTML element with the value of a given variable, or expression. If the value of the given variable or expression changes, the content of the specified HTML element will be changed as well. AngularJS Expressions and JavaScript expressions Let us compare Expressions in AngularJS and JavaScript. Similarity between AngularJS Expressions and JavaScript expressions: AngularJS expressions and JavaScript expressions can both contain literals, operators and variables. Differences between AngularJS Expressions and JavaScript expressions: Context: JavaScript expressions are evaluated against the global window. In AngularJS, expressions are evaluated against a scope object. AngularJS expressions do not have direct access to global variables like window, document or location. This restriction is intentional. It prevents accidental access to the global state – a common source of subtle bugs. Instead use services like $window and $location in functions on controllers, which are then called from expressions. Such services provide mockable access to globals. It is possible to access the context object using the identifier this and the locals object using the identifier $locals. AngularJS does not use JavaScript's eval() to evaluate expressions. Instead AngularJS's $parse service processes these expressions. Forgiving: In JavaScript, trying to evaluate undefined properties generates ReferenceError or TypeError. In AngularJS, expression evaluation is forgiving to undefined and null. In JavaScript, evaluating a.b.c throws an exception if a is not an object. While this makes sense for a general-purpose language, the expression evaluations are primarily used for data binding, which often look like this: {{a.b.c}} It makes more sense to show nothing than to throw an exception if a is undefined (perhaps we are waiting for the server response, and it will become defined soon). If expression evaluation wasn't forgiving, we'd have to write bindings that clutter the code, for example: {{((a||{}).b||{}).c}} Similarly, invoking a function a.b.c() on undefined or null simply returns undefined. Filters: You can use filters within expressions to format data before displaying it. No Control Flow Statements: You cannot use the following in an AngularJS expression: conditionals, loops, or exceptions. Apart from the ternary operator (a ? b : c), you cannot write a control flow statement in an expression. The reason behind this is core to the AngularJS philosophy that application logic should be in controllers, not the views. If you need a real conditional, loop, or to throw from a view expression, delegate to a JavaScript method instead. No Function Declarations: You cannot declare functions in an AngularJS expression, even inside ng-init directive. No RegExp Creation with Literal Notation: You cannot create regular expressions in an AngularJS expression. An exception to this rule is ng-pattern which accepts valid RegExp. No Object Creation with New Operator: You cannot use new operator in an AngularJS expression. No Bitwise, Comma, And Void Operators: You cannot use Bitwise, or void operators in an AngularJS expression. Citation: https://docs.angularjs.org/guide/expression (Docs from AngularJS) Thus, summarizing the JavaScript and AngularJS Expressions, we get the following main points: AngularJS expressions can be written inside HTML, while JavaScript expressions cannot. AngularJS expressions support filters, while JavaScript expressions do not. AngularJS expressions do not support conditionals, loops, and exceptions, while JavaScript expressions do. AngularJS expression cannot contain conditions, loops, exceptions or regular expressions e.g. if-else, ternary, for loop, while loop etc. AngularJS expression cannot declare functions. AngularJS expression cannot contain comma or void. AngularJS expression cannot contain return keyword. There are several categories in which Expressions operate. Some of the Expression Types are: Expressions Using numbers. Example: Expense on Books : {{cost * quantity}} Rs Expressions Using strings. Example: Hello {{student.firstname + " " + student.lastname}}! Expressions Using object. Example: Roll No: {{student.rollno}} Expressions Using array. Example: Marks(Math): {{marks[3]}} Let us go through each category in detail. Expression using Numbers Expression using numbers states that if any expression is using the number as variable or constant and the operators (like +, -, *, /, %, etc.) then those expressions are called number expressions.   Say if we use the expression as:               My first expression: {{ 5 + 5 }} Then AngularJS will understand that this is a number expression. It will evaluate the expression and result in:              My first expression: 10 We will understand more about the use of number expression in AngularJS with examples. Example: Considering you have already downloaded the latest AngularJS file from https://angularjs.org/ (here we are using the minified version of AngularJS as angular.min.js). We can even use the AngularJS CDN for the same provided by Google: https://ajax.googleapis.com/ajax/libs/angularjs/1.8.0/angular.min.js Example Using Curly Braces {{ }} for expressions:       Number Expression of AngularJs      var app = angular.module('myApp', [])  app.controller("myController", function ($scope) {  $scope.expr1 = 10;  $scope.expr2 = 20  });            Number Expression  The Result of Addition is : {{expr1 + expr2}}         Now run the number expressions as an HTML file and check the output, which will look like this:Example Using ng-init and ng-bind for number expressions:       Number Expression of AngularJs                  The Result of Addition is :                Now run the number expressions with ng-init and ng-bind as an HTML file and check the output, which will look like this: Expression using String Expression using String in AngularJS is a unit of code to perform operations on string values like + operator for concatenation of String, or the angular.isString() function.   * Note: The angular.isString() function in AngularJS is used to determine whether the parameter inside isString function is a string or not. It returns true if the reference is a string; and otherwise returns false.  For example: var obj1 = 123;   var obj2 = "A String value";   $scope.isString1 = angular.isString(obj1);   $scope.isString2 = angular.isString(obj2);  isString1 returns false while isString2 returns true. We will see how to use string expressions in detail in AngularJS with the following example: Example:       String Expressions of AngularJS      var app = angular.module('myApp', [])  app.controller("myController", function ($scope) {  $scope.expr1 = "Hello ";  $scope.expr2 = "World";  $scope.expr3 = 100;  var nexpr = $scope.expr3;  var sexpr = $scope.expr1;  $scope.isString1 = angular.isString(sexpr);  $scope.isString2 = angular.isString(nexpr);  });            String Expression    The Result of Concatenation of {{expr1}} and {{expr2}} is :   {{expr1 + expr2}}      The Result of angular.isString() for parameter   {{expr1}} is : {{isString1}}      The Result of angular.isString() for parameter   {{expr3}} is : {{isString2}}           Now run the String expressions as an HTML file and check the output, which will look like this: Expression using Object The object expressions in AngularJS hold object properties in them. AngularJS Objects and their fields are then evaluated at the view where they are used. For understanding AngularJS Objects, let’s go through the following section:  Objects in AngularJS Before moving forth we need to understand objects in AngularJS.  AngularJS objects are the same as JavaScript objects, and consist of a name-value pair. AngularJs objects have two parts: the object name and the object definition. The object name is the name by which we identify the object. The object definition consists of field to value pair, which defines the complete object. For Example: Considering an object as AngularTraining with fields as Trainer, noOfStd, noOfHours, it can be defined as: $scope.AngularTraining = {  Trainer: ‘Monica’,  noOfStd: 10,  noOfHours: 24  };  To use an object, we use  a .(dot) operator. Eg: to get the name of the trainer in the above example, we identify by AngularTraining.Trainer which gives a value of Monica in this case. Note that $scope in AngularJS is a built-in object which basically binds the “controller” and the “view”. One can define member variables in the $scope within the controller which can later be accessed by the view. We will see how to use object expressions in detail in AngularJS with the following example: Example:       String Expressions of AngularJS      var app = angular.module('myApp', [])  app.controller("myController", function ($scope) {  $scope.AngularTraining = {  Trainer: 'Monica',  noOfStd: 10,  noOfHours: 24  };   });                Pure JSON object contains key value pairs as Object Expression        The AngularTraining Object is:    AngularTraining.Trainer: {{ AngularTraining.Trainer}}     AngularTraining.noOfStd: {{ AngularTraining. noOfStd}}     AngularTraining. noOfHours: {{ AngularTraining. noOfHours}}             Now run the Object expressions as an HTML file and check the output, which will look like this:Objects with ng-init definition: We can define the objects at ng-init as shown in the following example:       String Expressions of AngularJS                Pure JSON object contains key value pairs as Object Expression        The AngularTraining Object is:    AngularTraining.Trainer: {{ AngularTraining.Trainer}}     AngularTraining.noOfStd: {{ AngularTraining. noOfStd}}     AngularTraining. noOfHours: {{ AngularTraining. noOfHours}}             Now run the Object expressions as an HTML file and check the output, which will look like this: Expression using Array Arrays in AngularJS are the variables that hold a group of data just like any other programming language. The Expressions using Arrays evaluate these array objects and provide the output. Arrays in AngularJS An array is a group of values with a group name, with the values separated by commas.  An array is a special data type which can store multiple values of different data types sequentially using a special syntax. For example: marks = [95, 52, 65, 98, 55, 35]; We will see how to use array expressions in AngularJS with the following example: Example:       String Expressions of AngularJS      var app = angular.module('myApp', [])  app.controller("myController", function ($scope) {  $scope.name = "Monica";  $scope.leave = [1, 2, 0];  });                Array Expression      The Leave Report for the first quarter for Employee:   {{name}} is:    January: {{ leave[0] }}     February: {{ leave[1] }}      March: {{ leave[2] }}      Total Leave for the first Quarter is:  {{ leave[0] + leave[1] + leave[2] }}            Now run the Array expressions as an HTML file and check the output, which will look like this:Defining Arrays with ng-init definition: We can define the arrays at ng-init as shown in the following example:       String Expressions of AngularJS                Array Expression      The Leave Report for the first quarter for Employee:   {{name}} is:    January: {{ leave[0] }}     February: {{ leave[1] }}      March: {{ leave[2] }}      Total Leave for the first Quarter is:  {{ leave[0] + leave[1] + leave[2] }}            Now run the Array expressions as an HTML file and check the output, which will look like this: Complete Example Summarizing the different types of AngularJS Expressions, we can understand that numbers and strings can be evaluated, while objects and arrays are converted to either numbers or strings first and then evaluated in AngularJS A complete example of AngularJS expression is:              AngularJS Expressions                  Expression    Hello {{student.firstname + " " + student.lastname}}!  Expense on Books : {{cost * quantity}} Rs  Roll No: {{student.rollno}}  Marks(Math): {{marks[3]}}          Now run the Expressions as an HTML file and check the output, which will look like this: AngularJS Expression capabilities and Limitations AngularJS Expression capabilities Angular expressions have the same power and flexibility as JavaScript expressions.  In JavaScript, when you try to evaluate undefined properties or objects or arrays, it generates a ReferenceError or TypeError. However, in AngularJS, expressions evaluation is forgiving and it generates an undefined or null value. In AngularJS expressions you can use filters within expressions to format data before displaying it. Angular JS Expression limitations Unlike JavaScript expressions, there is currently no availability to use conditionals, loops, or exceptions in an AngularJS expression You cannot declare functions in an AngularJS expression, not even inside ng-init directive. You cannot create regular expressions in an AngularJS expression. A regular expression is a combination of symbols and characters, which are used to search for strings such as : . * \ $ etc. Such expressions cannot be used within AngularJS expressions. Also you cannot use Bitwise, comma (,) or void operators in an AngularJS expression. Conclusion (Summary) AngularJS Expressions are used to evaluate values out of Numbers, Number variable, String variable, Objects or Arrays. AngularJS expressions are JavaScript-like code snippets that are mainly placed in interpolation bindings such as {{ textBinding }}. Some valid expressions are: 1+2, a+b, user.name, items[index] . Thus, we can say that Expressions are variables which were evaluated in the double braces {{ }}. It can be number Expressions, String Expressions, Object Expressions or Array Expressions. 
Rated 4.0/5 based on 11 customer reviews
9149
Learn AngularJs Expressions With Examples

AngularJS is a dynamic and robust JavaScript-ba... Read More

Role of Statistics in Data Science

Takeaways from this article In this article, we understand why data is important, and talk about the importance of statistics in data analysis and data science. We also understand some basic statistics concepts and terminologies. We see how statistics and machine learning work in sync to give deep insights into data.  We understand the fundamentals behind Bayesian thinking and how Bayesian theorem works. Introduction Data plays a huge role in today’s tech world. All technologies are data-driven, and humongous amounts of data are produced on a daily basis. A data scientist is a professional who is able to analyse data sources, clean and process the data, understand why and how such data has been generated, take insights from it, and make changes such that they profit the organization. These days, everything revolves around data.  Data Cleaning: It deals with gathering the data and structuring it so that it becomes easy to pass this data as input to any machine learning algorithm. This way, redundant, irrelevant data and noise can also be eliminated.  Data Analysis: This deals with understanding more about the data, why the data has yielded certain results, and what can be done to improve it. It also helps calculate certain numerical values like mean, variance, the distributions, and the probability of a certain prediction.  How the basics of statistics will serve as a foundation to manipulate data in data scienceThe basics of statistics include terminologies, and methods of applying statistics in data science. In order to analyze the data, the important tool is statistics. The concepts involved in statistics help provide insights into the data to perform quantitative analysis on it. In addition to this, as a foundation, the basics and working of linear regression and classification algorithms must also be known to a data science aspirant.  Terminologies associated with statistics Population: It is an entire pool of data from where a statistical sample is extracted. It can be visualized as a complete data set of items that are similar in nature.  Sample: It is a subset of the population, i.e. it is an integral part of the population that has been collected for analysis.  Variable: A value whose characteristics such as quantity can be measured, it can also be addressed as a data point, or a data item.  Distribution: The sample data that is spread over a specific range of values.  Parameter: It is a value that is used to describe the attributes of a complete data set (also known as ‘population’). Example: Average, Percentage  Quantitative analysis: It deals with specific characteristics of data- summarizing some part of data, such as its mean, variance, and so on.  Qualitative analysis: This deals with generic information about the type of data, and how clean or structured it is.  How does analyzing data using statistics help gain deep insights into data? Statistics serve as a foundation while dealing with data and its analysis in data science. There are certain core concepts and basics which need to be thoroughly understood before jumping into advanced algorithms.  Not everyone understand the performance metrics of machine learning algorithms like f-score, recall, precision, accuracy, root mean squared error, and so on. Instead, visual representation of the data and the performance of the algorithm on the data serves as a good metric for the layperson to understand the same.  Also, visual representation helps identify outliers, specific trivial patterns, and certain metric summary such as mean, median, variance, that helps in understanding the middlemost value, and how the outlier affects the rest of the data.  Statistical Data Analysis Statistical data analysis deals with the usage of certain statistical tools that need knowledge of statistics. Software can also help with this, but without understanding why something is happening, it is impossible to get considerable work done in statistics and data science.  Statistics deals with data variables that are either univariate or multivariate. Univariate, as the name suggests deals with single data values, whereas multivariate data deals with the multiple number of values. Discriminant data analysis, factor data analysis can be performed on multivariate data. On the other hand, univariate data analysis, Z-test, F-test can be performed if we are dealing with univariate data.  Data associated with statistics is of many types. Some of them have been discussed below. Categorical data represents characteristics of people, such as marital status, gender, food they like, and so on. It is also known as ‘qualitative data’ or ‘yes/no data’. It takes numerical values like ‘1’, ‘2’, where these numbers indicate one or other type of characteristics. These numbers are not mathematically significant, which means it can’t be associated with each other. Continuous data deals with data that is immeasurable, and can’t be counted, which basically continual forms of values are. Predictions from a linear regression are continuous in nature. It is a continuous distribution that is also known as probability density function. On the other hand, discrete values can be measured, counted, and are discontinuous. Predictions from logistic regression are considered to be discrete in nature. Discrete data is non-continuous, and density concept doesn’t come into the picture here. The distribution is known as probability mass function. The Best way to Learn Statistics for Data Science The best way to learn anything is by implementing it, by working on it, by making mistakes and again learning from it.  It is important to understand the concepts, either by going through standard books or well-known websites, before implementing them.  Before jumping into data science, the core statistics concepts like such as regression, maximum likelihood, distributions, priors, posteriors, conditional probability, Bayesian theorem and basics of machine learning have to be understood clearly. Core statistics concepts Descriptive statistics: As the name suggests, it uses the data to give out more information about every aspect of the data with the help of graphs, plots, or numbers. It organizes the data into a structure, and helps think about the attributes that highlight the important parts of the data. Inferential statistics: It deals with drawing inferences/conclusions on the sample data set which is obtained from the population (entire data set) based on the relationship identified between data points in the data set. It helps in generalizing the relationship to the entire dataset. It is important to remember that the dataset drawn from the population is relevant and represents the population accurately. Regression: The term ‘regression’ which is a part of statistics and machine learning, talks about how data can be fit to a line, and how every point from the straight line gives some insights. In terms of machine learning, it can be understood as tasks that can be solved without explicitly being programmed. They discuss how a line can be fit to a given set of data points, and how it can be further extrapolated for the predictions to be done.  Maximum likelihood: It is a method that helps in finding values of parameters for a specific model. The values of the parameters have to be such that the likelihood of the predictions that occur have to be maximum in comparison to the data values that were actually observed. This means the difference between the actual and predicted value has to be less, thereby reducing the error and increasing the accuracy of the predictions.  Note: This concept is generally used with Logistic regression when we are trying to find the output as 0 or 1, yes or no, wherein the maximum likelihood tells about how likely a data point is near to 0 or 1.  Bayesian thinking Bayesian thinking deals with using probability to model the process of sampling, and being able to quantify the uncertainty associated with the data that would be collected.  This is known as prior probability- which means the level of uncertainty that is associated with the data before it is collected to be analysed.  Posterior probability deals with the uncertainty that occurs after the data has been collected.  Machine learning algorithms are usually focussed on giving the best predictions as output with minimal errors, exact probabilities of specific events occurring and so on. Bayes theorem is a way of calculating the probability of a hypothesis (a situation, which might not have occurred in reality) based on our previous experiences and the knowledge we have gained by it. This is considered as a basic concept that needs to be known.  Bayes theorem can be stated as follows: P(hypo | data) = (P(data | hypo) * P(hypo)) / P(data)In the above equation,   P(hypo | data) is the probability of a hypothesis ‘hypo’ when data ‘data’ is given, which is also known as posterior probability.   P(data | hypo) is the probability of data ‘data’ when the specific hypothesis ‘hypo’ is known to be true.   P(hypo) is the probability of a hypothesis ‘hypo’ being true (irrespective of the data in hand), which is also known as prior probability of ‘hypo’.   P(data) is the probability of the data (irrespective of the hypothesis). The idea here is to get the value of the posterior probability, given other data. The posterior probability for a variety of different hypotheses has to be found out, and the probability that has the highest value is selected. This is known as the maximum probable hypothesis, and is also known as the maximum a posteriori (MAP) hypothesis.MAP(hypo) = max(P(hypo | data))If the value of P(hypo | data) is replaced with the value we saw before, the equation would become:MAP(hypo) = max((P(data | hypo) * P(hypo)) / P(data))P(data) is considered as a normalizing term that helps in determining the probability. This value can be safely ignored when required, since it is a constant value. Naïve Bayes classifier   It is an algorithm that can be used with binary or multi-class classification problems. It is a simple algorithm wherein the probability for every hypothesis is simplified.   This is done in order to make the data more traceable. Instead of calculating value of every attribute like P(data1, data2,..,datan|hypo), we assume that every data point is independent of every other data point in the data set when the respective output is given.   This way, the equation becomes:P(data1 | hypo) * P(data2 |hypo) * … * P(data-n| hypo).This way, the attributes would be independent of each other. This classifier performs quite well even in the real world with real data when the assumption of data points being independent of each other doesn’t hold good.  Once a Naïve Bayes classifier has learnt from the data, it stores a list of probabilities in a data structure. Probabilities such as ‘class probability’ and ‘condition probability’ are stored. Training such a model is quick since the probability of every class and its associated value needs to be determined, and this doesn’t involve any optimization processes or changing of coefficient to give better predictions.   Class probability: It tells about the probability of every class that is present in the training dataset. It can be calculated by finding the frequency of values that belongs to each class divided by the total number of values.  Class probability = (number of classes/(number of classes of group 0 + number of classes of group 1)) Conditional probability: It talks about the conditional probability of every input that is associated with a class value. It can be calculated by finding the frequency of every data attribute in the data for a given class, and this can be determined by the number of data values that have that data label/class value.  Conditional probability P(condition | result ) = number of ((values with that condition and values with that result)/ (number of values with that result)) Not just the concept, once the user understands the way in which a data scientist needs to think, they will be able to focus on getting cleaner data, with better insights that would lead to performing better analysis, which in turn would give great results.  Introduction to Statistical Machine Learning The methods used in statistics are important to train and test the data that is used as input to the machine learning model. Some of these include outlier/anomaly detection, sampling of data, data scaling, variable encoding, dealing with missing values, and so on.  Statistics is also essential to evaluate the model that has been used, i.e. see how well the machine learning model performs on a test dataset, or on data that it has never seen before.  Statistics is essential in selecting the final and appropriate model to deal with that specific data in a predictive modelling situation.  It is also needed to show how well the model has performed, by taking various metrics and showing how the model has fared.  Metrics used in Statistics Most of the data can be fit to a common pattern that is known as Gaussian distribution or normal distribution. It is a bell-shaped curve that can be used to summarize the data with the below mentioned two parameters:  Mean: It is understood as the central most value when the data points are arranged in a descending or ascending order, or the most likely value.Mode: It can be understood as the data point that occurs the greatest number of times, i.e. The frequency of the value in the dataset would be very high.  Median: It is a measure of central tendency of the data set. It is the middle number, that can be found by sorting all the data points in a dataset and picking the middle-most element. If the number of data points in a dataset is odd, one single middle value is picked up, whereas two middle values are picked and their mean is calculated if the number of data points in a dataset is even. Range: It refers to the value that is calculated by finding the difference between the largest and the smallest value in a dataset. Quartile: As the name suggests, quartiles are values that divide the data points in a dataset into quarters. It is calculated by sorting the elements in order and then dividing the dataset into 4 equal parts. Three quartiles are identified: The first quartile that is the 25th percentile, the second quartile which is the 50th percentile and the third quartile that is the 75th percentile. Each of these quartiles tells about the percentage of data that is smaller or larger in comparison to other percentiles of data. Example: 25th percentile suggests that 25 percent of the data set is smaller than the remaining 75 percent of the data set. Quartile helps understand how the data is distributed around the median (which is the 50th percentile/second quartile). There are other distributions as well, and it depends on the type of data we have and the insights we need from that data, but Gaussian is considered as one of the basic distributions. Variance: The average of the difference between every value and the mean of that specific distribution.  Standard deviation: It can be understood as the measure that indicates the dispersion that occurs in the data points of the input data.  Conclusion In this post, we understood why and how statistics is important to understand and work with data science. We saw a few terminologies of statistics that are essential in understanding the insights which statistics would end up giving to data scientist. We also saw a few basic algorithms that every data scientist needs to know, in order to learn other advanced algorithms.  
Rated 4.0/5 based on 11 customer reviews
5421
Role of Statistics in Data Science

Takeaways from this article In this article, we u... Read More

Why You Should Use Angular JS

Takeaways from this articleIn this post, we will understand the prominence of Angular JS and how it plays an important role in front-end web development.  We will understand the applications of Angular JS, along with its usage.  We will also see how it works in comparison to other frameworks that are used for the same purpose.  What is Angular JS Angular JS is a JavaScript framework, that is currently being maintained by tech giant Google. It is used to build single page applications and web-based mobile applications that have interactivity with the users. It is simply an extension of the DOM model, making the application more user-friendly and robust. It is also an MVC framework implementation.  What are the applications of Angular JS? Menu creation Menu is trivial in almost all websites, be it single page, or multi-page. A menu is a navigation tool that responds to an input sent by a user- this could be a click, or a touch. It includes designs to make the web page more visible, or to make the user-experience better. Angular JS can be used to improve the user friendliness of the application. Elements from CSS can be added to the already present HTML (in the AngularJS framework) to improve the overall view of the page, thereby improving the user experience.  Interactive single page application There are various advantages when using a web page that behaves like a single page application. Instead of having to load and fetch separate pages from the memory as and when requested by the user every time they visit the site, a single page website would mean less overload on the memory and improved quality of user-experience. This is because all the code required by the web application can be retrieved in one go or can be dynamically loaded as and when required by the user. This behaves more like a desktop application, rather than like a multi-page application on the website.  10 advantages of Angular JS with respect to its peers Easy to implement MVC framework Many applications implement MVC frameworks, and Angular JS is one of them. The highlight of using Angular JS is the fact that MVC is implemented by splitting up the web application into various parts of MVC wherein every part will automatically perform its own remaining work. The MVC elements are managed by Angular JS without explicitly specifying so, and this acts as a pipeline that integrates them into separate elements. It is an intermediate point of contact that makes sure that the components fit and integrate properly. This way, the developer can concentrate on building quality applications without worrying about integration.  Interactive user interface Angular JS uses HTML to define the user-interface of the mobile application, and since HTML is simple to use, easy to understand and a declarative language, the entire application is simple. It is easier to use HTML than JavaScript to define the elements of the interface.  HTML is recognizable the moment it is encountered due to its format, tags, etc, in comparison to understanding that the language that has been used to implement the interface is JavaScript. In addition to this, HTML can be used to understand the flow of control of the application (HTML can be used with controllers in the MVC framework as well). Easy to understand directives A directive is a concept that can be used to work with Angular JS with the aim of embedding additional functionality into HTML, without making it more complicated. A limitless number of elements can be added to HTML, to improve the functionality of the application, without making it messy or complicated or difficult to maintain.  Angular JS facilitates directives that help the developer in building customized HTML tags. They can be identified with the help of their prefit ‘ng’. These newly built customized tags can be used as customized widgets. In addition to this, they can be used to manipulate the attributes of the DOM. There are certain default directives as well. The application maps the newly customized/default directives (which are also known as special attributes) to the elements of HTML so that it will generate the respective functionality for the application. This is achieved after creating the directives (customized or default attributes/HTML tags) and attaching that specific attribute/tag to the DOM element where it is required. With the help of data binding, changes to the application will be directly reflected in the ‘view’ section of the application.  Working with DOM is simple In general, the view part of MVC framework extends to the DOM in order to display the data, and at this point in time, the DOM is played with, in order to add extra functionality. The directives present in Angular JS can be used to bind the application data with the customized/default special attributes of HTML DOM elements. This means views are interpreted as HTML pages that come with placeholders which are later replaced with relevant values when dynamic data comes in, by Angular JS. This is a convenient way since it helps integrate the view with the website design. This will eliminate the complexity and messiness of the code.  POJO POJO simply means Plain Old JavaScript Object, which indicates that the Angular JS’s data models are simple, plain, easy to understand as well as implement. This also means that functions such as ‘getters’ and ‘setters’ are not required. The characteristics of the application can be changed directly. The presence of directives and DOM elements can be conveniently used to add the required functionalities.  Writing messy code is avoided The need to write too many lines of messy code can be avoided while using Angular JS. The need to write code for MVC pipeline is eliminated, thereby reducing considerable amount of overhead. The data model can be specified without the need to use other extra features or embedding other features. The concept of data binding makes sure that new data is not added into the view portion manually. It has to be integrated into the view with the help of DOM and directives. This way, the entire procedure is simple and easy.  Directives are different, and they are not a part of the code base of the application. This means a directive can be written in parallel without worrying about integrating it with other parts of the code, since this part will be taken care of by Angular JS itself. The time saved can be productively used to improve the quality and features of the Angular JS application instead of worrying about integrating the code with other parts of the application. As a result, there is more flexibility and the ability to extend the code when trying to build high-end web-based applications.  Filters in the data As the name suggests, it is a method that is used to filter the data before it reaches the view part of the application. It helps add filters such as formatting to decimal places, filtering an array based on a specific parameter, reversing the order of ranges, or implementing the concept of pagination for web pages in the application.  Filters can be created to make sure that the functions work properly and have been separated from the application. It also ensures that the functions are only associated with the data transformations with respect to the data and not the entire code of the application itself.  Communications know the context The Publisher-Subscriber system, which is also known as PubSub system is a common model that is used for a separate communication system. Most of the tools that implement Publisher-Subscriber model over the internet wouldn’t be aware of the context in which they are being used. But it is important to ensure that MVC elements that are not related to the same context are not placed together. When Angular JS is combined with Publisher Subscriber model, the context can be specifically mentioned, thereby addressing a specific part of the application. This ensures that the MVC part remains aloof. The remaining parts of the application won’t receive this context/message which means there won’t be any communication. This is easy to implement and simple to use with respect to communication that happens between controllers. Data binding is a technique that helps in the synchronization of the model and the view of the MVC framework. It helps to change, manipulate and work with the model and the view, and also changes their properties and data. With the help of data binding, any changes in the model would be directly reflected in the ‘view’ portion of the framework without the requirement to manipulate DOM or event handlers.  Service providers The scope of the code can be manipulated with the help of controllers in Angular JS. This means data can be placed prior to the code that would be used to implement the business logic or the server code. Controllers perform most of the heavy lifting, since Angular binds specific services to them. This way, the specific service of one controller wouldn’t get mixed with other parts of the application or with the MVC. An API is created to expose the functionality that needs to be used. The offline data can also be managed by synchronizing it with the server, and using various methods to pull or push data to and from a server. It can also be used to create a data sharing resource service that will ensure that different controllers share the same resources at that particular point in time.  Unit Testing capabilities  Angular JS was built by keeping the testing requirements in mind. This is because testing plays an important role, and can prove to be a significant step in identifying loopholes and issues. It also helps understand the overall application from a different perspective. For this change in perspective, end-to-end testing is performed on the Angular JS application. In Angular JS, unit testing can be performed with or without the help of Karma framework. Unit testing is usually performed separately on controllers and directives of Angular JS. The Angular JS application can also be tested by setting up individual test pages that would help create a specific component of the application, and then adding interactivity to it and checking if it works fine or not.  Dependency Injection (DI) The Angular JS application is bound with the help of Dependency Injection (DI). This is because Angular JS contains a built-in DI system. DI is basically a design pattern that discusses the components and their dependencies. DI helps the developers in creating components, working on their dependencies and facilitating the developers with the components that are required. It ensures that controllers are managed within their respective scopes easily. This is because the controllers depend on DI for data to be passed on to it. Why Angular JS should be used Angular JS is an open source framework that binds the data in two ways- the view and the model of the application are synchronized with each other when a user interaction takes place via the interface. This happens automatically so that the DOM gets updated accordingly. It is considered to be budget-friendly, and easy to create.  The highlight of using Angular JS is the fact that MVC is implemented by splitting up the application into parts of MVC that automatically perform the remaining work respectively. The MVC elements are managed by Angular JS without explicitly specifying, and acts as a pipeline that integrates their separate elements. It is an intermediate point of contact that makes sure that the components fit and integrate properly. Adding new functionalities isn’t a difficult task anymore; the view is not a part of DOM, which means new functions can be added and can be integrated with the application by making sure DOM interacts with the directive and the HTML page.  Conclusion In this post, we understood the significance of using AngularJS, how it can be applied in the real-world, and how it is advantageous in comparison to other frameworks with respect to its implementation, DOM model, simple coding capabilities, unit testing abilities and much more. Angular JS applications are simple to build, easy to use (user-friendly) as well as maintain. Since the amount of code that needs to be written is less, the developer can concentrate on building better and more interactive applications thereby improving consumer experience.  
Rated 4.0/5 based on 16 customer reviews
8464
Why You Should Use Angular JS

Takeaways from this articleIn this post, we will u... Read More