# data[].attributes.attachment_link.readable_text
UK spies will need to use artificial intelligence (AI) to counter a range of threats, an intelligence report says.

Adversaries are likely to use the technology for attacks in cyberspace and on the political system, and AI will be needed to detect and stop them.

But AI is unlikely to predict who might be about to be involved in serious crimes, such as terrorism - and will not replace human judgement, it says.

The report is based on unprecedented access to British intelligence.

The Royal United Services Institute (Rusi) think tank also argues that the use of AI could give rise to new privacy and human-rights considerations, which will require new guidance.

The UK's adversaries "will undoubtedly seek to use AI to attack the UK", Rusi says in the report - and this may include not just states, but also criminals.

Fire with fire

The future threats could include using AI to develop deep fakes - where a computer can learn to generate convincing faked video of a real person - in order to manipulate public opinion and elections.

It might also be used to mutate malware for cyber-attacks, making it harder for normal systems to detect - or even to repurpose and control drones to carry out attacks.

In these cases, AI will be needed to counter AI, the report argues.

"Adoption of AI is not just important to help intelligence agencies manage the technical challenge of information overload. It is highly likely that malicious actors will use AI to attack the UK in numerous ways, and the intelligence community will need to develop new AI-based defence measures," argues Alexander Babuta, one of the authors.

The independent report was commissioned by the UK's GCHQ security service, and had access to much of the country's intelligence community.

All three of the UK's intelligence agencies have made the use of technology and data a priority for the future - and the new head of MI5, Ken McCallum, who takes over this week, has said one of his priorities will be to make greater use of technology, including machine learning.

However, the authors believe that AI will be of only "limited value" in "predictive intelligence" in fields such as counter-terrorism.

The often-cited fictional reference is the film Minority Report where technology is used to predict those on the path to commit a crime before they have carried it out.

But the report argues this is less likely to be viable in real-life national security situations.

Acts such as terrorism are too infrequent to provide sufficiently large historical datasets to look for patterns - they happen far less often than other criminal acts, such as burglary.

Even within that data set, the background and ideologies of the perpetrators vary so much that it is hard to build a model of a terrorist profile. There are too many variables to make prediction straightforward, with new events potentially being radically different from previous ones, the report argues.

Any kind of profiling could also be discriminatory and lead to new human-rights concerns.

In practice, in fields like counter-terrorism, the report argues that "augmented" - rather than artificial - intelligence will be the norm - where technology helps human analysts sift through and prioritise increasingly large amounts of data, allowing humans to make their own judgements.

It will be essential to ensure human operators remain accountable for decisions and that AI does not act as a "black box", from which people do not understand the basis on which decisions are made, the report says.

Bit by bit

The authors are also wary of some of the hype around AI, and of talk that it will soon be transformative.

Instead, they believe we will see the incremental augmentation of existing processes rather than the arrival of novel futuristic capabilities.

They believe the UK is in a strong position globally to take a lead, with a concentration of capability in GCHQ - and more widely in the private sector, and in bodies like the Alan Turing Institute and the Centre for Data Ethics and Innovation.

This has the potential to allow the UK to position itself at the leading edge of AI use but within a clear framework of ethics, they say.

The deployment of AI by intelligence agencies may require new guidance to ensure safeguards are in place and that any intrusion into privacy is necessary and proportionate, the report says.

Read more from Gordon:

One of the thorny legal and ethical questions for spy agencies, especially since the Edward Snowden revelations, is how justifiable it is to collect large amounts of data from ordinary people in order to sift it and analyse it to look for those who might be involved in terrorism or other criminal activity.

And there's the related question of how far privacy is violated when data is collected and analysed by a machine versus when a human sees it.

Privacy advocates fear that artificial intelligence will require collecting and analysing far larger amounts of data from ordinary people, in order to understand and search for patterns, that create a new level of intrusion. The authors of the report believe new rules will be needed.

But overall, they say it will be important not to become over-occupied with the potential downsides of the use of technology.

"There is a risk of stifling innovation if we become overly-focused on hypothetical worst-case outcomes and speculations over some dystopian future AI-driven surveillance network," argues Mr Babuta.

"Legitimate ethical concerns will be overshadowed unless we focus on likely and realistic uses of AI in the short-to-medium term."

# data[].attributes.attachment_link.title
UK spies need artificial intelligence, report says

# data[].attributes.attachment_link.description
UK spies will need to use artificial intelligence (AI) to counter a range of threats, an intelligence report says. Adversaries are likely to use the technology for attacks in cyberspace and on the political system, and AI will be needed to detect and stop them.

# data[].attributes.attachment_link.readable_text
Comparison tables can be handy when it comes to getting a quick overview of a specific topic. Below are eight comparison tables from the areas of Artificial Intelligence, Data Science, IoT, and Cloud Computing.

1. Comparison of machine learning methods

Machine learning explores the study and construction of algorithms that can learn from and make predictions on data. Such algorithms operate by building a model from an example training set of input observations in order to make data-driven predictions or decisions expressed as outputs, rather than following strictly static program instructions. ( Wikipedia)

2. Comparison of open-source IoT platforms

The Internet of Things (IoT) is a system of interrelated computing devices, mechanical and digital machines, objects, animals or people that are provided with unique identifiers (UIDs) and the ability to transfer data over a network without requiring human-to-human or human-to-computer interaction. ( Wikipedia)

3. The main differences between Data Science and Business Intelligence

Data Science

Data science is a multi-disciplinary field that uses scientific methods, processes, algorithms, and systems to extract knowledge and insights from structured and unstructured data. Data science is the same concept as data mining and big data: "use the most powerful hardware, the most powerful programming systems, and the most efficient algorithms to solve problems" ( Wikipedia)

Business Intelligence

Business intelligence (BI) comprise the strategies and technologies used by enterprises for the data analysis of business information. BI technologies provide historical, current and predictive views of business operations. Common functions of business intelligence technologies include reporting, online analytical processing, analytics, data mining, process mining, complex event processing, business performance management, benchmarking, text mining, predictive analytics, and prescriptive analytics. ( Wikipedia)

4. Comparison of Classification Algorithms

In machine learning and statistics, classification is the problem of identifying to which of a set of categories (sub-populations) a new observation belongs, on the basis of a training set of data containing observations (or instances) whose category membership is known. Examples are assigning a given email to the "spam" or "non-spam" class, and assigning a diagnosis to a given patient based on observed characteristics of the patient (sex, blood pressure, presence or absence of certain symptoms, etc.). Classification is an example of pattern recognition. ( Wikipedia)

5. Comparison of Deep Learning Frameworks

Deep learning (also known as deep structured learning or hierarchical learning) is part of a broader family of machine learning methods based on artificial neural networks. Learning can be supervised, semi-supervised or unsupervised.

Deep learning architectures such as deep neural networks, deep belief networks, recurrent neural networks and convolutional neural networks have been applied to fields including computer vision, speech recognition, natural language processing, audio recognition, social network filtering, machine translation, bioinformatics, drug design, medical image analysis, material inspection and board game programs, where they have produced results comparable to and in some cases superior to human experts. ( Wikipedia)

6. Comparison of pre-trained models

In computer vision, transfer learning is usually expressed through the use of pre-trained models. A pre-trained model is a model that was trained on a large benchmark dataset to solve a problem similar to the one that we want to solve. ( Towards Data Science)

7. AWS, Azure, GCP Comparison

Cloud computing is the on-demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. The term is generally used to describe data centers available to many users over the Internet. Large clouds, predominant today, often have functions distributed over multiple locations from central servers. If the connection to the user is relatively close, it may be designated an edge server. ( Wikipedia)

8. RPA versus Conventional Technology

RPA Robotic process automation (or RPA) is an emerging form of business process automation technology based on the notion of metaphorical software robots or artificial intelligence workers.

In traditional workflow automation tools, a software developer produces a list of actions to automate a task and interface to the back-end system using internal application programming interfaces (APIs) or dedicated scripting language. In contrast, RPA systems develop the action list by watching the user perform that task in the application's graphical user interface (GUI) and then perform the automation by repeating those tasks directly in the GUI. This can lower the barrier to the use of automation in products that might not otherwise feature APIs for this purpose. ( Wikipedia)

Useful Comparison Tables for AI, Data Science, IoT & Cloud #AI #DataScience #IoT #CloudComputing Klick um zu Tweeten

Further reading:

# data[].attributes.attachment_link.title
Useful Comparison Tables for AI, Data Science, IoT & Cloud

# data[].attributes.attachment_link.description
Comparison tables can be handy when it comes to getting a quick overview of a specific topic. Below are eight comparison tables from the areas of Artificial Intelligence, Data Science, IoT, and Cloud Computing. Machine learning explores the study and construction of algorithms that can learn from and make predictions on data.

# data[].attributes.attachment_link.readable_text
Have you ever asked a question, why do we need to calculate the exact Posterior distribution ?

To understand the answer the above question, let us go to -

To understand the answer of the above question, I would like you to re-visit our basic Baye's rule.

Posterior = (Likelihood x Prior) / Evidence

Now to compute the Posterior we have following issues:

If prior is conjugate to likelihood, it is easy to compute the posterior, otherwise not

It is really very hard to compute the evidence of the points

So, what if we try and approximate our posterior!

Will it impact our results? .. let us check out with an example.

Let us suppose we have a probabilistic distribution as shown in the figure:

The computation of the exact posterior of the above distribution is very difficult.

Now suppose we try to approximate the above distribution with a gaussian distribution which looks as follows:

Now from the above figure we can say the error is very small as the gaussian distribution is conveniently satisfying the job. Also, in machine learning problems, we really do not want an exact value of the posterior as far as we can get relative values for decision making.

From the above example we saw that if we have good approximate distribution for the posterior, we are good to go !

The next question arises, how to compute this approximate posterior distribution.

Computing the Approximate Distribution

To compute the approximate distribution, we will have to consider a family of distribution and then we will try to minimize the KL Divergence parameter between the actual posterior and the approximate distribution.

Mathematically speaking,

KL Divergence :

Expanding the above equation, we get :

as q(z) is a probabilistic distribution and Log z is a constant for a given data, therefore It does not play a role in differentiation process of KL divergence to minimize the distance between the approximate posterior distribution and the actual distribution.

So, now we will understand a methodology to do this approximation.

The name suggests a word 'mean', we will see the importance of this later in the blog. Another word 'field' is basically coming from electromagnetism theory of physics, as this approximation methodology incorporates the impact of nearby neighbors in making the decision, thus incorporating the fields impacts of all neighbors.

So, let us start learning the concept behind this approximation.

Step 1 : Suppose the posterior distribution has n dimensions, then we will consider total n different distributions to approximate the posterior.

Step 2 : all the n different distributions will be multiplied together to approximate the posterior. The mathematical expression looks as :

Step 3 : now the expression of KL divergence is used to differentiate and minimize the distance between the posterior and approximation. We use coordinate descent method to differentiate the expression, which differentiates the expression w.r.t to one variable, update the expression and then differentiate w.r.t another variable and so on.

Mathematical Derivation

KL divergence expression :

Now, we only need to differentiate w.r.t k, therefore all the dimensions are constant as per coordinate descent.

By taking q(z k) as common and treating the remain multiplier as a constant and for the second object for P(z*), it becomes as Expected value for the random variable q(z ₁)*q(z ₂) ... q(z i) where i != k.

The final expression we get is :

Now, with a little conversion of the equation, it re occurs in form of KL divergence, and to differentiate and equate it to zero means equating the denominator and numerator. The final expression is as follows:

Now because of the mean impact of remaining dimensions results in th most optimal solution of the k th dimension, we call it mean fields.

Now, what you just saw may be very scary !!! right ..

Let us take a working example to understand the concept of mean field approximation in more practical manner.

Grey scale image de-noising is a very popular use case of MFVI. It uses 2 concepts - Ising model and approximating the ising model using Mean field approximation. Below are the details:

Ising Model : is a mathematical model of ferromagnetism in statistical mechanics.

Core Idea behind Merging two theories : ferromagnetic substances, at their molecular level can have 2 types of spins - clockwise or anticlockwise. If the spins of all the molecules are same and aligned, the object start behaving as a magnet. The spin of any molecule has a significant impact from its neighboring molecules. This impact varies from substance to substance. Thus it makes the occurrence of the spin for each molecule probabilistic. Ising Model defines this behavior mathematically.

Now, we can consider our image as 2-D substance sheet and can consider every pixel of the image as a molecule. In a binary-image, these pixels can take only 2 values i.e. black and white, analogously -1 and 1. This image can be de-noised by considering the same theory that each pixel will take value as per its neighbor. And so we can apply Ising model to re correct the spins/black-white/-1,+1 values of the image, if we control the neighbor impact property of the image.

Now, the joint probabilistic distribution of the Ising model is impossible to evaluate analytically, thus we use Mean Field Approximation theory to evaluate it.

I tried this approach on a grey image of a bird by adding a lot of noise to it and tried to retrieve as much as possible from it. Below are my results :

Noisy Image:

De-noised Image:

That is kind of potential I am talking about, i.e. in the noisy image you can see eventually nothing, and in the de-noised image we see a bird. !!!

Please read more about it, to try this cool stuff.

References:

shttps://github.com/vsmolyakov/experiments_with_python/blob/master/chp02/mean_field_mrf.ipynb
https://en.wikipedia.org/wiki/Ising_model https://en.wikipedia.org/wiki/Mean_field_theory https://www.cs.cmu.edu/~epxing/Class/10708-17/notes-17/10708-scribe...

# data[].attributes.attachment_link.description
Have you ever asked a question, why do we need to calculate the exact Posterior distribution ? To understand the answer the above question, let us go to - To understand the answer of the above question, I would like you to re-visit our basic Baye's rule.

# data[].attributes.body
A collection of books that I own and find useful.

# data[].attributes.body
Reading Resource/Reference in term 2.
By Francois Chollet.
Posted by Carl.H

# data[].attributes.attachment_link.title
Kismet: the Social Robot | PBS LearningMedia

# data[].attributes.attachment_link.description
Researchers in the Artificial Intelligence Laboratory working to engineer smarter robots are now building a machine that interacts socially with people in this video segment adapted from the Massachusetts Institute of Technology.

# data[].attributes.body
https://www.youtube.com/watch?v=kSLJriaOumA&feature=emb_logo

# data[].attributes.attachment_link.readable_text
Bayes Theorem is the extension of Conditional probability. Conditional probability helps us to determine the probability of A given B, denoted by P(A|B). So Bayes' theorem says if we know P(A|B) then we can determine P(B|A), given that P(A) and P(B) are known to us.

In this post I am concentrating on Bayes' theorem assuming you have good understanding of Conditional probability. In case you want to revise your concepts, you may refer my previous post on Conditional probability with examples.

Formula derivation:

From conditional probability we know that

Similarly

P(B|A) = P(B and A)/P(A) = P(A and B)/P(A) [In Joint Probability order does not matter]

P(A and B) = P(A) * P(B|A) -----[2]

From equation [1] and [2],
Which mean if we know P(A|B) then we can easily determine P(B|A) and vice versa. Assuming we know the total probabilities P(A) and P(B). More Generalized Definition:
Let A1, A2, A3... Ak be a collection of mutually exclusive and exhaustive events with probability P(Ai), I = 1, 2, 3...k. Then for any event B for which P(B) > 0

P(Ai|B) = P(Ai and B)/P(B)

= P(B|Ai)*P(Ai)/∑[P(B|Ai)*P(Ai)

Below is the tree representation of the Bayes' Theorem.

Bayes' Theorem using Probability Tree

Now let's solve some example to get a feeling of Bayes' theorem.

Example 1

Technicians regularly make repairs when breakdowns occur on an automated production line. Janak, who services 20% of the breakdowns, makes an incomplete repair 1 time in 20.Tarun, who services 60% of the breakdowns, makes an incomplete repair 1 time in 10. Gautham, who services 15% of the breakdowns, makes an incomplete repair 1 time in 10 and Prasad, who services 5% of the breakdowns, makes an incomplete repair 1 time in 20. For the next problem with the production line diagnosed as being due to an initial repair that was incomplete, what is the probability that this initial repair was made by Janak?

Solution:

First let's try to visualize using probability tree.

Bayes Theorem Example 1

Example 2 Clinical trials

Epidemiologists claim that probability of breast cancer among Caucasian women in their mid-50s is 0.005. An established test identified people who had breast cancer and those that were healthy. A new mammography test in clinical trials has a probability of 0.85 for detecting cancer correctly. In women without breast cancer, it has a chance of 0.925 for a negative result. If a 55-year-old Caucasian woman tests positive for breast cancer, what is the probability that she in fact has breast cancer?

Solution:

P(Cancer) = 0.005

P(Test Positive | Cancer) = 0.85

P(Test Neg|No cancer) = 0.925

P(Cancer|Test Positive)= P(Cancer) * P(Test Positive | Cancer) / P(Test Positive)

Probability Table and Tree Visualization for the given question

Bayes Theorem Example 2

Example 3

SpamAssassin works by having users train the system. It looks for patterns in the words in emails marked as spam by the user. For example, it may have learned that the word "free" appears in 20% of the mails marked as spam. Assuming 0.1% of non-spam mail includes the word "free" and 50% of all mails received by the user are spam, find the probability that a mail is spam if the word "free" appears in it.

Solution

Data Given:

P(Free | Spam) = 0.20

P(Free | Non Spam) = 0.001

P(Spam) = 0.50 => P(Non Spam) = 0.50

P(Spam | Free) = ?

Using Bayes' Theorem:

P(Spam | Free) = P(Spam) * P(Free | Spam) / P(Free)

P(Spam | Free) = 0.50 * 0.20 / (0.50 * 0.20 + 0.50 * 0.001)

P(Spam | Free) = 0.995

Now visualize using probability tree:

Bayes' Theorem Example 3

So that is all about Bayes' Theorem for data Science. In next posts I will be writing about Probability Distributions which will complete the Probability for Data Science Series.

Previous articles from Probability for Data Science Series are:

I hope you enjoyed the post. For any comments, use the below comment section to write back to me or even you can directly write to me using https://ashutoshtripathi.com/contact/. I will try to answer all your queries related to DS, ML and AI.

Thank You!

# data[].attributes.attachment_link.title
Bayes' Theorem with Example for Data Science Professionals

# data[].attributes.attachment_link.description
Bayes Theorem is the extension of Conditional probability. Conditional probability helps us to determine the probability of A given B, denoted by P(A|B). So Bayes' theorem says if we know P(A|B) then we can determine P(B|A), given that P(A) and P(B) are known to us.

# data[].attributes.attachment_link.readable_text
The semantic web focuses on data rather than on documents, making it a much more immersive and detailed way of accessing information compared to the World Wide Web invented by Tim Berners Lee in the late 1980s.

However, Berners-Lee still played a very important role in its inception, developing the idea alongside AI researcher James Hendler and computer scientist Ora Lassila. The idea was first revealed in 2001 in a Scientific America article, where the threesome discussed the idea of connecting information using a network that could be read by machines.

According to the World Wide Web Consortium ( W3C), the semantic web is "a common framework that allows data to be shared and reused across application, enterprise, and community boundaries".

The concept is to offer people the information they're looking for at the time they need it. One of its key philosophies is that although the information presented on the internet is useful, it's not always needed at every point.

Because the majority of data is created using forms and then converted into HTML, there's no way all data can be managed by everyone at all times. The semantic web makes this information more useful to everyone because it can be repurposed.

The semantic web essentially allows for the connection of information using a network that can be easily read by machines - whether computers, IoT devices, mobile phones or other devices commonly used to access information.

It's built on the premise that data within web pages is useful, but not in all circumstances. One of the biggest hurdles of the internet as it stands is that the majority of data is created using forms and there's no unified way of publishing data so anyone can manage it. The way data is presented using HTML can be difficult to handle and so the semantic web takes the idea that if this data can be re-purposed, it's more useful to everyone.

Schema.org has been formed by a number of organisations (notably Google, Bing and Yahoo) to boost the extent of semantic metadata. The goal of this is to answer questions from the best sources on the web, rather than serve up a search page full of document links.

The most important part of semantic web technologies is Resource Description Framework (RDF). This is a common framework for describing resources. It can represent metadata that can be parsed and processed by systems rather than just displayed to users.

Use cases

The semantic web is very useful for solving many of the problems raised with the World Wide Web.

For example, data siloes can be pretty much eradicated, with links between data and the outside world - or even more localised places such as within the organisation - operating seamlessly. The use of semantic metadata tags means the information can all reside in one place, searchable by the tags to make it infinitely easier to uncover.

If the linked data is in a publicly searchable place, such as the wider internet, users are also able to find intricate relationships between the data and the information they own, opening up its meaning to go far beyond the scope of the original data.

Another great use for the semantic web is for media management. For example, the BBC used the semantic web to power its database of player information during the 2010 World Cup and a lot of its website runs on semantic web technologies to make sure it can rapidly update and organise the vast amount information it holds.

In supply chains, the semantic web can be used to keep the rapidly changing data organised, whether that's information supplied by different parts of the chain, such as manufacturers, vendors, distributors, logistics firms, supply chain managers.

Benefits

One of the key benefits of the semantic web is having large amounts of data, knowledge and information made understandable and accessible to machines, especially artificially intelligent bots, virtual assistants and agents.

The simplicity of the RDF data structure and the schema's optional nature mean that it's easy to combine different sets of data. This is particularly useful for big data projects where the variety of data within an organisation can present a challenge.

# data[].attributes.attachment_link.description
The semantic web focuses on data rather than on documents, making it a much more immersive and detailed way of accessing information compared to the World Wide Web invented by Tim Berners Lee in the late 1980s. However, Berners-Lee still played a very important role in its inception, developing the idea alongside AI researcher James Hendler and computer scientist Ora Lassila.

# data[].attributes.attachment_link.readable_text
| Metalog

Many people don't have a clear idea of what the Semantic Web is. The best informal definition is maybe found in the May 2001 Scientific American article "The Semantic Web" (Berners-Lee et al.), that says " The Semantic Web is an extension of the current web in which information is given well-defined meaning, better enabling computers and people to work in cooperation." People who work on the Semantic Web have a more detailed idea of what this broad statement means, and base their work on the famous " semantic web tower", a product of Tim Berners-Lee's inspiring drawing on whiteboards. Even if you are not a geek, you might have read some article on the semantic web, or followed some presentation, and then you will surely have met the tower, which is a drawing like this

The article or presentation might have then continued by explaining what the "layers" of this tower are, starting from the basic bricks (Unicode and URIs), up to XML, and then up to more and more sophisticated layers like RDF, Ontology and so on.

Now, you might have understood how things work, and have been eagerly awaiting for the realization of this plan. Or, you might not have understood this quite, and have been waiting for someone to show you better what they meant. In fact, the plan as shown in the picture is rapidly taking place: many of the slots are filling up (RDF, RDF Schema, Ontology, Digital Signature). So, the picture as shown is getting completed. Still, most of the people are awaiting, and the Semantic Web has not yet taken off. What's the matter here?

The matter comes from the definition of Semantic Web that we have seen earlier: "The Semantic Web is an extension of the current web in which information is given well-defined meaning, better enabling computers and people to work in cooperation." Now, the sole fact that the tower is filling up with established standards corresponds to the first part of the definition, "an extension of the current web". The fact that these standards work corresponds to a piece of the second part of the definition: "enabling computers to work in cooperation". What is missing, is maybe the most crucial part of the definition: the people. Those people who are awaiting.

So, it's of little importance to those people that the slots work with computers: they want to be part of the game, they want the Semantic Web to fulfill its promise, to enable "computers and people to work in cooperation". Filling up the tower with standards reach the first part of the game, and makes computers happy, but not (yet) people. The tower represents the axis of expressive power, where more and more sophisticated semantics can be encoded. This technical axis doesn't much bother to explicitly take into account the other part of the Semantic Web world. Therefore, a different perspective would be to take that component into proper account, abstracting from the expressiveness axis: let's twist the tower, and build up, orthogonally, a new axis:

The "perception" axis is to signify the abstraction/adaptation of the technologies in the tower, towards the people. To enable their perception by the people. In fact, this axis could have been well named as the "People axis", but perception is maybe a more detailed term. In any case, as both perception and people start with P, this can simply be named asthe "P" axis.

The P axis is the one that points towards people, and as such, bases its foundation (talking to computers) in some part of the underlying tower. It is the connection axis between these two worlds, people and computers. This axis is not just made up of applications: just like the expressiveness axis (the "tower") is made by technologies, technologies can well (and should) be first-class citizens in this axis as well. Implementations alone are isolated objects, and can't tell how to communicate with other things. And so, the P axis cannot be left to implementations, leaving the "communication" part just to the underlying tower.

Technologies for the people, in this axis, might sacrifice part of the expressive power given by some underlying technology in the main tower, to build up a technology that is closer to the people. All this, in a standard and interoperable manner. In the overall picture, it's in the P axis that people matter.
[Next to: the PNL interface]

# data[].attributes.attachment_link.description
Metalog Many people don't have a clear idea of what the Semantic Web is. The best informal definition is maybe found in the May 2001 Scientific American article "The Semantic Web" (Berners-Lee et al.), that says " The Semantic Web is an extension of the current web in which information is given well-defined meaning, better enabling computers and people to work in cooperation."

# data[].attributes.headline
Basic video but gives foundations for understanding linked data 

# data[].attributes.subject
Basic video but gives foundations for understanding linked data 

# data[].attributes.attachment_link.readable_text
Following is the difference between the forward chaining and backward chaining:

Forward chaining as the name suggests, start from the known facts and move forward by applying inference rules to extract more data, and it continues until it reaches to the goal, whereas backward chaining starts from the goal, move backward by using inference rules to determine the facts that satisfy the goal.

Forward chaining is called a data-driven inference technique, whereas backward chaining is called a goal-driven inference technique.

Forward chaining is known as the down-up approach, whereas backward chaining is known as a top-down approach.

Forward chaining uses breadth-first search strategy, whereas backward chaining uses depth-first search strategy.

Forward and backward chaining both applies Modus ponens inference rule.

Forward chaining can be used for tasks such as planning, design process monitoring, diagnosis, and classification, whereas backward chaining can be used for classification and diagnosis tasks.

Forward chaining can be like an exhaustive search, whereas backward chaining tries to avoid the unnecessary path of reasoning.

In forward-chaining there can be various ASK questions from the knowledge base, whereas in backward chaining there can be fewer ASK questions.

Forward chaining is slow as it checks for all the rules, whereas backward chaining is fast as it checks few required rules only.

# data[].attributes.attachment_link.title
Difference Between Backward Chaining and Forward Chaining - Javatpoint

# data[].attributes.attachment_link.description
Following is the difference between the forward chaining and backward chaining: Forward chaining as the name suggests, start from the known facts and move forward by applying inference rules to extract more data, and it continues until it reaches to the goal, whereas backward chaining starts from the goal, move backward by using inference rules to determine the facts that satisfy the goal.

# data[].attributes.attachment_link.readable_text
A Self-Organising Map, additionally, uses competitive learning as opposed to error-correction learning, to adjust it weights. This means that only a single node is activated at each iteration in which the features of an instance of the input vector are presented to the neural network, as all nodes compete for the right to respond to the input.

The chosen node - the Best Matching Unit (BMU) - is selected according to the similarity, between the current input values and all the nodes in the grid.

The node with the smallest Euclidean difference between the input vector and all nodes is chosen, along with its neighbouring nodes within a certain radius, to have their position slightly adjusted to match the input vector.

By going through all the nodes present on the grid, the entire grid eventually matches the complete input dataset, with similar nodes grouped together towards one area, and dissimilar ones separated.

A Kohonen model with the BMU in yellow, the layers inside the neighbourhood radius in pink and purple, and the nodes outside in blue.

t is the current iteration

n is the iteration limit, i.e. the total number of iterations the network can undergo

λ is the time constant, used to decay the radius and learning rate

i is the row coordinate of the nodes grid

j is the column coordinate of the nodes grid

d is the distance between a node and the BMU

w is the weight vector

w_ij(t) is the weight of the connection between the nodes i,j in the grid, and the input vector's instance at the iteration t

x is the input vector

x(t) is the input vector's instance at iteration t

α(t) is the learning rate, decreasing with time in the interval [0,1], to ensure the network converges.

β_ij(t) is the neighbourhood function, monotonically decreasing and representing a node i, j's distance from the BMU, and the influence it has on the learning at step t.

σ(t) is the radius of the neighbourhood function, which determines how far neighbour nodes are examined in the 2D grid when updating vectors. It is gradually reduced over time.

1. Initialise each node's weight w_ij to a random value

2. Select a random input vector x_k

3. Repeat point 4. and 5. for all nodes in the map:

4. Compute Euclidean distance between the input vector x(t) and the weight vector w_ij associated with the first node, where t, i, j = 0.

5. Track the node that produces the smallest distance t.

6. Find the overall Best Matching Unit (BMU), i.e. the node with the smallest distance from all calculated ones.

7. Determine topological neighbourhood βij(t) its radius σ(t) of BMU in the Kohonen Map

8. Repeat for all nodes in the BMU neighbourhood: Update the weight vector w_ij of the first node in the neighbourhood of the BMU by adding a fraction of the difference between the input vector x(t) and the weight w(t) of the neuron.

9. Repeat this whole iteration until reaching the chosen iteration limit t=n

Step 1 is the initialisation phase, while step 2-9 represent the training phase.

The updates and changes to the variables are done according to the following formulas:

The weights within the neighbourhood are updated as:

The first equation tells us that the new updated weight w_ij (t + 1) for the node i, j is equal to the sum of old weight w_ij(t) and a fraction of the difference between the old weight and the input vector x(t). In other words, the weight vector is 'moved' closer towards the input vector. Another important element to note is that the updated weight will be proportional to the 2D distance between the nodes in the neighbourhood radius and the BMU.

Furthermore, the same equation 3.1 does not account for the influence of the learning being proportional to the distance a node is from the BMU. The updated weight should take into factor that the effect of the learning is close to none at the extremities of the neighbourhood, as the amount of learning should decrease with distance. Therefore, the second equation adds the extra neighbourhood function factor of βij(t), and is the more precise in-depth one.

The radius and learning rate are both similarly and exponentially decayed with time.

The neighbourhood function's influence β_i(t) is calculated by:

The Euclidean distance between each node's weight vector and the current input instance is calculated by the Pythagorean formula.

The BMU is selected from all the node's calculated distances as the one with the smallest.

# data[].attributes.attachment_link.description
A Self-Organising Map, additionally, uses competitive learning as opposed to error-correction learning, to adjust it weights. This means that only a single node is activated at each iteration in which the features of an instance of the input vector are presented to the neural network, as all nodes compete for the right to respond to the input.

# data[].attributes.attachment_link.readable_text
Introduction

In this post, we will take a look at a few cases, where KMC algorithm does not perform well or may produce unintuitive results. In particular, we will look at the following scenarios:

1. Our guess on the number of (real) clusters is off.

2. Feature space is highly dimensional.

3. The clusters come in strange or irregular shapes.

All of these conditions can lead to problems with K-Means, so let's have a look.

Wrong number of clusters

To make it easier, let's define a helper function compare, which will create and solve the clustering problem for us and then compare the results.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45



from sklearn import datasets
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs , make_circles , make_moons
from mpl_toolkits.mplot3d import Axes3D

import numpy as np
import pandas as pd
import itertools


def compare ( N_features , C_centers , K_clusters , dims = [ 0 , 1 ], * args ):
    data , targets = make_blobs (
        n_samples = n_samples if 'n_samples' in args else 400 ,
        n_features = N_features ,
        centers = C_centers ,
        cluster_std = cluster_std if 'cluster_std' in args else 0.5 ,
        shuffle = True ,
        random_state = random_state if 'random_state' in args else 0 )

    FEATS = [ 'x' + str ( x ) for x in range ( N_features )]
    X = pd . DataFrame ( data , columns = FEATS )
    X [ 'cluster' ] = \
		KMeans ( n_clusters = K_clusters , random_state = 0 ) . fit_predict ( X )

    fig , axs = plt . subplots ( 1 , 2 , figsize = ( 12 , 4 ))
    axs [ 0 ] . scatter ( data [:, dims [ 0 ]], data [:, dims [ 1 ]],
        c = 'white' , marker = 'o' , edgecolor = 'black' , s = 20 )
    axs [ 0 ] . set_xlabel ( 'x{} [a.u.]' . format ( dims [ 0 ]))
    axs [ 0 ] . set_ylabel ( 'x{} [a.u.]' . format ( dims [ 1 ]))
    axs [ 0 ] . set_title ( 'Original dataset' )
    axs [ 1 ] . set_xlabel ( 'x{} [a.u.]' . format ( dims [ 0 ]))
    axs [ 1 ] . set_ylabel ( 'x{} [a.u.]' . format ( dims [ 1 ]))
    axs [ 1 ] . set_title ( 'Applying clustering' )

    colors = itertools . cycle ([ 'r' , 'g' , 'b' , 'm' , 'c' , 'y' ])
    for k in range ( K_clusters ):
        x = X [ X [ 'cluster' ] == k ][ FEATS ] . to_numpy ()
        axs [ 1 ] . scatter (
		x [:, dims [ 0 ]],
		x [:, dims [ 1 ]],
		color = next ( colors ),
		edgecolor = 'k' ,
		alpha = 0.5
	)
    plt . show ()

Too few clusters

Figure 1a. Example of a 2-dimensional dataset with 4 centres, requesting 3 clusters (compare(2, 4, 3)).

Despite having distinct clusters in the data, we underestimated their number. As a consequence, some disjoint groups of data are forced to fit into one larger cluster.

Too many clusters

Figure 1b. Example of a 2-dimensional dataset with 2 centres, requesting 4 clusters (compare(2, 2, 4)).

In contrary to the last situation, trying to wrap the data into too many clusters creates artificial boundaries within real data clusters.

High(er) dimensional data

A dataset does not need to be that high in dimentionality before we begin to see problems. Although visualization and thus somewhat analysis of high dimensional data is already challenging (cursing now...), as KMC is often used to gain insight into the data, it does not help to be presented with ambiguities.

To explain the point, let's generate a three-dimensional dataset with clearly distinct clusters.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



fig = plt . figure ( figsize = ( 14 , 8 ))
ax = fig . add_subplot ( 111 , projection = '3d' )

data , targets = make_blobs (
    n_samples = 400 ,
    n_features = 3 ,
    centers = 3 ,
    cluster_std = 0.5 ,
    shuffle = True ,
    random_state = 0 )

ax . scatter ( data [:, 0 ], data [:, 1 ],
    zs = data [:, 2 ], zdir = 'z' , s = 25 , c = 'black' , depthshade = True )
ax . set_xlabel ( 'x0 [a.u.]' )
ax . set_ylabel ( 'x1 [a.u.]' )
ax . set_zlabel ( 'x2 [a.u.]' )
ax . set_title ( 'Original distribution.' )
plt . grid ()
plt . show ()

Figure 2. Example of a 3-dimensional dataset with 3 centers.

Although there are infinitely many ways we can project this 3D dataset onto 2D, there are three primary orthogonal sub-spaces:

Looking at the x2 : x0 projection, the dataset looks like as if it only had two clusters. The lower-right "supercluster" is, in fact, two distinct groups and even if we guess K right (K = 3), it looks like an apparent error, despite the clusters are very localized.

Figure 3a. Projection on `x0 : x2` shows spurious result (compare(2, 2, 4, dims=[0, 2])).

To be sure, we have to look at the remaining projections to see the problem, literally, from different angles.

Figure 3b. Projection on `x1 : x2` resolves the ambiguity (compare(2, 2, 4, dims=[1, 2])).

Figure 3c. Projection on `x0 : x1` resolves the ambiguity (compare(2, 2, 4, dims=[0, 1])).

This makes more sense!

On the flip side, we had an incredible advantage. First, with three dimensions, we were able to plot the entire dataset. Secondly, the clusters that exist within the dataset were very distinct thus easy to spot. Finally, with three-dimensional dataset, we were facing only three standard 2D projections.

The case of N, N > 3 features, we would not be able to plot the whole dataset, and the number of 2D projections would scale quadratically with N:

not to mention that the dataset may have strangely shaped or non-localized clusters, which is our next challenge.

Irregular datasets

So far we mentioned problems that are on "our side". We looked at a very "well-behaved" dataset and discussed issues on the analytics side. However, what about if the dataset does not fit our solution, or, our solution does not fit the problem? This is exactly the case, where data distribution comes in strange or irregular shapes.

Being presented with just this graph, we may be tricked into believing that there are only two clusters in the data. However, when plotting the remaining projections, we quickly learn that this is not true.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38



fig , axs = plt . subplots ( 1 , 3 , figsize = ( 14 , 4 ))

# unequal variance
X , y = make_blobs ( n_samples = 1400 ,
    cluster_std = [ 1.0 , 2.5 , 0.2 ],
    random_state = 2 )
y_pred = KMeans ( n_clusters = 3 , random_state = 2 ) . fit_predict ( X )
colors = [[ 'r' , 'g' , 'b' ][ c ] for c in y_pred ]

axs [ 0 ] . scatter ( X [:, 0 ], X [:, 1 ],
	color = colors , edgecolor = 'k' , alpha = 0.5 )
axs [ 0 ] . set_title ( "Unequal Variance" )

# anisotropically distributed data
X , y = make_blobs ( n_samples = 1400 , random_state = 156 )
transformation = [
	[ 0.60834549 , - 0.63667341 ],
	[ - 0.40887718 , 0.85253229 ]
]
X = np . dot ( X , transformation )
y_pred = KMeans ( n_clusters = 3 , random_state = 0 ) . fit_predict ( X )
colors = [[ 'r' , 'g' , 'b' ][ c ] for c in y_pred ]

axs [ 1 ] . scatter ( X [:, 0 ], X [:, 1 ],
	color = colors , edgecolor = 'k' , alpha = 0.5 )
axs [ 1 ] . set_title ( "Anisotropicly Distributed Blobs" )

# irregular shaped data
X , y = make_moons ( n_samples = 1400 , shuffle = True ,
	noise = 0.1 , random_state = 120 )
y_pred = KMeans ( n_clusters = 2 , random_state = 0 ) . fit_predict ( X )
colors = [[ 'r' , 'g' , 'b' ][ c ] for c in y_pred ]

axs [ 2 ] . scatter ( X [:, 0 ], X [:, 1 ],
	color = colors , edgecolor = 'k' , alpha = 0.5 )
axs [ 2 ] . set_title ( "Irregular Shaped Data" )

plt . show ()

Figure 4. Misleading clustering results are shown on irregular datasets.

The left graph shows data whose distribution although, Gaussian, does not have equal standard deviation. The middle graph presents anisotropic data, meaning data that is elongated along a specific axis. Finally, the right graph shows data that is completely non-Gaussian, despite organized in clear clusters.

In either case, the irregularity makes KMC algorithm underperform. Since the algorithm treats every data point equally and completely independently from other points, the algorithm fails to spot any possible continuity or local variations within a cluster. What it does is simply taking the same metrics and applying it to every point. As a result, the KMC algorithm may produce strange or counter-intuitive clustering within the data even if we guess K correctly and the features N are not that many.

Conclusions

In this post, we have discussed three main reasons for the K-Means Clustering algorithm to give us wrong answers.

First, as the number of clusters K needs to be decided a priori, there is a high chance that we will guess it wrongly.

Secondly, clustering in higher dimensional space becomes cumbersome from the analytics point of view, in which case KMC will provide us with insights that may be misleading.

Finally, for any irregularly shaped data, KMC is likely to artificial clusters that do not conform to common sense.

Knowing these three fallacies, KMC is still a useful tool, especially when inspecting of the data or constructing labels.

# data[].attributes.attachment_link.title
Top three mistakes with K-Means Clustering during data analysis

# data[].attributes.attachment_link.description
In this post, we will take a look at a few cases, where KMC algorithm does not perform well or may produce unintuitive results. In particular, we will look at the following scenarios: Our guess on the number of (real) clusters is off. Feature space is highly dimensional.

# data[].attributes.attachment_link.readable_text
All around the world, from small-town Illinois in the US to Rochdale in England, from Perth, Australia, to Dumka in northern India, a revolution is under way in how governments treat the poor.

You can't see it happening, and may have heard nothing about it. It's being planned by engineers and coders behind closed doors, in secure government locations far from public view.

Only mathematicians and computer scientists fully understand the sea change, powered as it is by artificial intelligence (AI), predictive algorithms, risk modeling and biometrics. But if you are one of the millions of vulnerable people at the receiving end of the radical reshaping of welfare benefits, you know it is real and that its consequences can be serious - even deadly.

The Guardian has spent the past three months investigating how billions are being poured into AI innovations that are explosively recasting how low-income people interact with the state. Together, our reporters in the US, Britain, India and Australia have explored what amounts to the birth of the digital welfare state.

Their dispatches reveal how unemployment benefits, child support, housing and food subsidies and much more are being scrambled online. Vast sums are being spent by governments across the industrialized and developing worlds on automating poverty and in the process, turning the needs of vulnerable citizens into numbers, replacing the judgment of human caseworkers with the cold, bloodless decision-making of machines.

At its most forbidding, Guardian reporters paint a picture of a 21st-century Dickensian dystopia that is taking shape with breakneck speed. The American political scientist Virginia Eubanks has a phrase for it: "The digital poorhouse."

The Australian government's Department of Human Services website. Photograph: Dave Hunt/AAP

Listen to governments, and you will hear big promises about how new technologies will transform poverty as a noble and benign enterprise. They will speed up benefits payments, increase efficiency and transparency, reduce waste, save money for taxpayers, eradicate human fallibility and prejudice, and ensure that limited resources reach those most in need. But so often, those pledges have fallen flat.

At a time when austerity dominates the political landscape, millions have had their benefits slashed or stopped by computer programs that operate in ways that few seem able to control or even comprehend. Mistakes have become endemic, with no obvious route for the victims of the errors to seek redress.

This week, the automation of poverty will be brought on to the world stage. Philip Alston, a human rights lawyer who acts as the UN's watchdog on extreme poverty, will present to the UN general assembly in New York a groundbreaking report that sounds the alarm about the human rights implications of the rush to digitalize social protection.

Alston's analysis is based partly on his official UN studies of poverty in the UK and US, and partly on submissions from governments, human rights organisations and experts from more than 34 countries. It is likely to provide the definitive snapshot of where the world lies now, and where it is going, addressing the harassment, targeting and punishment of those living in the rapidly expanding digital poorhouse.

Mistakes have become endemic, with no obvious route for the victims to seek redress

In Illinois, the Guardian has found that state and federal governments have joined forces to demand that welfare recipients repay "overpayments" stretching back in some cases 30 years. This system of "zombie debt", weaponized through technology, is invoking fear and hardship among society's most vulnerable.

As one recipient described it: "You owe what you have eaten."

In the UK, we investigate the secure government site outside Newcastle where millions are being spent developing a new generation of welfare robots to replace humans. Private companies including a New York outfit led by the world's first bot billionaire, are supercharging a process which has spawned a whole new jargon: "virtual workforce", "augmented decision-making", "robot process automation".

The government is rushing forward with its digital mission despite the pain already being inflicted on millions of low-income Britons by the country's "digital by default" agenda. Claimants spoke of the hunger, filth, fear and panic that they are enduring.

Activists protesting against the Indian government's decision to link free lunch meals for children with the national Aadhaar biometric cards. Photograph: -/AFP/Getty Images

In Australia, where the Guardian has reported extensively on robodebt, the scheme that has been accused of wrongly clawing back historic debts through a flawed algorithm, we now disclose that the government has opened a new digital front: using automation to suspend millions of welfare payments. Recipients are finding their money cut off without notice.

The most disturbing story comes from Dumka in India. Here, we learn of the horrifying human impact that has befallen families as a result of Aadhaar, a 12-digit unique identification number that the Indian government has issued to all residents in the world's largest biometric experiment.

New high-tech approaches sweep through social services, work, disability and health, often with minimal public debate

Motka Manjhi paid the ultimate price when the computer glitched and his thumbprint - his key into Aadhaar - went unrecognised. His subsistence rations were stopped, he was forced to skip meals and he grew thin. On 22 May, he collapsed outside his home and died. His family is convinced it was starvation.

The Guardian investigations illuminate the shared features of these new systems, whether in developing or developed countries, east or west. The most glaring similarity is that all this is happening at lightning speed, with hi-tech approaches sweeping through social services, work and pensions, disability and health, often with minimal public debate or accountability.

Within that revolution, the human element of the welfare state is being diluted. Instead of talking to a caseworker who personally assesses your needs, you now are channeled online where predictive analytics will assign you a future risk score and an algorithm decide your fate.

In the new world, inequality and discrimination can be entrenched. What happens if you are one of the five million adults in the UK without regular access to the internet and with little or no computer literacy? What if the algorithm merely bakes in existing distortions of race and class, making the gulf between rich and poor, white and black, college-educated and manual worker, even more pronounced?

There is also a chilling Kafkaesque quality that spans the globe. As Manjhi so tragically discovered, mistakes are made. Machines glitch. If there is no one within reach who sees you as a person and not as a 12-digit number to be processed, the results can be fatal.

The computer says "No payments". Now what do you do?
Automating Poverty will run all week. If you have a story to tell about being on the receiving end of the new digital dystopia, email ed.pilkington@theguardian.com

# data[].attributes.attachment_link.title
Digital dystopia: how algorithms punish the poor

# data[].attributes.attachment_link.description
In an exclusive global series, the Guardian lays bare the tech revolution transforming the welfare system worldwide - while penalising the most vulnerable

# data[].attributes.attachment_link.title
K Means Clustering: Pros and Cons of K Means Clustering

# data[].attributes.body
First 25 mins very informative, may want to skip some sections but others really help explain how it works.

# data[].attributes.attachment_link.title
K Means Clustering Algorithm | K Means Clustering Example | Machine Learning Algorithms |Simplilearn

# data[].attributes.body
Nice

# data[].attributes.attachment_link.title
A* Pathfinding (E01: algorithm explanation)

# data[].attributes.attachment_link.readable_text
(Image credit: Getty Images)

Brain.js is a fantastic way to build a neural network. Simply put, a neural network is a method of machine learning that works in a similar way to a human brain. Given the correct answer to a question (like 'which option will this user choose?'), it slowly learns the pattern and relationship between the inputs and answers. One example of a neural network is Facebook's facial recognition system, DeepFace.

But due to the complex domain language of neural networks and seemingly steep learning curve, it can be hard to get started.

In this tutorial, we will distil the theory down to need-to-knows and, importantly, get stuck in with actually using brain.js to create a neural network. By the end, you will have a web app that asks multiple-choice questions about a user's optimism. When they submit, these answers will train a neural network to the probability of our user selecting each option for a brand new question.
Download the files you'll need for this tutorial.
01. Set up the project

Firstly, download and install the necessary dependencies. This tutorial presumes you have a working knowledge of React, or the equivalent mapping to a preferred alternative.

Create a React app using your desired method. You can try Facebook's create-react-app tool, installed using the following:

npm install create-react-app -g

02. Start your app

Now we can build, install brain.js, and start our app:

npx create-react-app optimism-nn cd optimism-nn npm install brainjs npm start

We are going to perform the neural network computation on the browser. Neural networks are resource intensive and should be offloaded to a server. However, this way is quick to set up and fine for our basic needs. Now let's add brain.js to our entry point (in my case, App.js).

import brain from 'brain.js';

03. Define your training questions

We need to define our training questions next. In a separate questions.js file, we'll need a trainingQuestions and validationQuestions array. You can find my list on the Git repo or create your own. The more training questions you have, the more accurate your results. Remember to import these into your entry point.

export const trainingQuestions = [ { id: 'q1', question: 'Do you often see the best in things?', options: [ { id: 'q1a', label: 'Not really', value: 0.2, }, { id: 'q1b', label: 'Always', value: 1.0, }, { id: 'q1c', label: 'Usually, yeah', value: 0.7, }, { id: 'q1d', label: 'Never!', value: 0.0, }, ], }, ];

For both arrays, we need a question, an array of four options that contain a label and an optimism value. This value will be the input for our neural network.

Ensure you vary the order and balance of values, or the neural network may focus too much on the index of the options in the array! Our neural network takes four inputs and gives four outputs. Our training data needs to match this, so in our constructor we need some state for the quiz and the user's options:

this.state = { trainingAnswers: trainingQuestions.map(() => Array(4).fill(0)), training: false, predictions: undefined, };

04. Initialise the neural network

The initialisation of trainingAnswers creates an array for each question containing [0, 0, 0, 0] - our default state with no selection. We're also going to need to initialise our neural network - just a single line with brain.js:

this.net = new brain.NeuralNetwork({ hiddenLayers: [4] });

05. Build the quiz framework

To build the framework for our quiz, we need to loop over our training questions and options. This is quite verbose and not very interesting, so I'll give an example output for you to aim for instead:

render() { return ( <main> <form onSubmit={this.onSubmit}> [. . .] // Iterate over questions & options <div className="question"> <h4>{question}</h4> <div className="options"> <label htmlFor={optionId}> <span>{label}</span> <input type="radio" required name={questionId} id={optionId} checked={() => this.isOptionChecked(questionIndex, optionIndex)} onChange={() => this.onOptionChange(questionIndex, optionIndex)} /> </label> [. . .] </div> </div> [. . .] <button type="submit">Submit</button> </form> </main> ); }

If you're new to React, see the documentation for building forms.

We can write our isOptionChecked and onOptionChange functions next:

isOptionChecked = (questionIndex, optionIndex) => ( this.state.trainingAnswers[questionIndex][optionIndex] !== 0 ); onOptionChange = (questionIndex, optionIndex) => { this.setState(prevState => { const { trainingAnswers } = Object.assign(prevState, {}); trainingAnswers[questionIndex] = Array(4).fill(0); trainingAnswers[questionIndex][optionIndex] = 1; return { trainingAnswers }; }); };

06. Train the neural network

Now, when our user clicks an option, we update the relevant trainingAnswers array to feature a 1 in the selected index and change the state of the radio button to show it as checked.

Time to add our onSubmit function, where we build the training data and train the neural network:

 onSubmit = e => { e.preventDefault(); const { trainingAnswers } = this.state; const trainingData = trainingQuestions.map((q, i) => ({ input: q.options.map(o => o.value), output: trainingAnswers[i], })); this.setState({ training: true, }); this.net.trainAsync(trainingData) .then(res => { console.log(res); // Log the error rate and # iterations this.getPredictions() }); }

Looping over trainingQuestions, we create the input and output arrays we need. We get the input data by taking the optimism value of each option and we get the output data from looking in the trainingAnswers array at the same index as the question.

After that, we update the state with training: true to inform the user that the neural network is learning. Depending on the processing power of the client device and how many questions you have, the process can take seconds, minutes or longer!

Finally, we pass the training data over to our neural network and tell it to train asynchronously. This returns a promise that is fulfilled when the network has found the pattern or given up.

Keep an eye on the error rate we log in trainAsync. Ideally it should be between 0 - 0.05. If it's higher, check your training data.

From there, we can get our predictions:

getPredictions = () => { const predictions = validationQuestions.map(q => ( this.net.run(q.options.map(o => o.value)) )); this.setState({ training: false, predictions, }); }

Using net.run, we ask our newly trained neural network to give us its predictions for each of the validation questions we defined earlier.

For the grand finale, we add our conditional loading logic and present a finding to the user.

render() { const { training, predictions } = this.state; const validationQuestion = validationQuestions[0]; return ( <main> {training && ( <h2>Loading...</h2> )} {!predictions && !training && ( [. . .] // Training questions form )} {predictions && !training && ( <div> <h2>We asked the neural network:</h2> <div className="question"> <h4>{validationQuestion.question}</h4> <div className="options"> {validationQuestion.options.map((o, i) => ( <label key={o.id}> {/* display the label and probability as a round percentage */} <span>{${o.label}: ${Math.round(predictions[0][i] * 100)}%}</span> </label> ))} </div> </div> </div> )} </main> ); } }

07. Extend the network

Now you have the basic framework for the quiz, try extending it with the following:

Find the real error rate of your neural network by letting your user answer your validation questions. See how many times they chose your best guess.

Train the neural network with these additional answers and see if you can improve the accuracy.

Move the neural network calculations over onto a Node server with the brain.js toFunction() and toJSON() methods.
This article originally appeared in issue 321 in Read more: net magazine, the world's leading web design magazine. Buy issue 321 or subscribe to net.

# data[].attributes.attachment_link.description
(Image credit: Getty Images) Brain.js is a fantastic way to build a neural network. Simply put, a neural network is a method of machine learning that works in a similar way to a human brain. Given the correct answer to a question (like 'which option will this user choose?'), it slowly learns the pattern and relationship between the inputs and answers.

# data[].attributes.attachment_link.readable_text
If you're a game developer, you might have always wanted to implement A* as character (or enemy) pathfinding. I know a couple of years ago I did, but with my level of programming at the time I had issues with the current articles out there. I wanted to write this as an easy introduction with a clear source code example to A* pathfinding so anyone can easily pick it up and use it in their game.

One important aspect of A* is f = g + h. The f, g, and h variables are in our Node class and get calculated every time we create a new node. Quickly I'll go over what these variables mean.

F is the total cost of the node.

G is the distance between the current node and the start node.

H is the heuristic - estimated distance from the current node to the end node.

Let's take a look at a quick graphic to help illustrate this.

wow such numbers, very color

Awesome! Let's say node(0) is our starting position and node(19) is our end position. Let's also say that our current node is at the the red square node(4).

G

G is the distance between the current node and the start node.

If we count back we can see that node(4) is 4 spaces away from our start node.

We can also say that G is 1 more than our parent node ( node(3)). So in this case for node(4), currentNode.g = 4.

H

H is the heuristic - estimated distance from the current node to the end node.

So let's calculate the distance. If we take a look we'll see that if we go over 7 spaces and up 3 spaces, we've reached our end node ( node(19)).

Let's apply the Pythagorean Theorem! a² + b² = c². After we've applied this, we'll see that currentNode.h = 7² + 3². Or currentNode.h = 58.
But don't we have to apply the square root to 58? Nope! We can skip that calculation on every node and still get the same output. Clever!
With a heuristic, we need to make sure that we can actually calculate it. It's also very important that the heuristic is always an underestimation of the total path, as an overestimation will lead to A* searching for through nodes that may not be the 'best' in terms of f value.

F

F is the total cost of the node.

So let's add up h and g to get the total cost of our node. currentNode.f = currentNode.g + currentNode.h. Or currentNode.f = 4+ 58. Or currentNode.f = 62.

Alright, so that was a lot of work. Now with all that work, what am I going to use this f value for?

With this new f value, we can look at all our nodes and say, "Hey, is this the best node I can pick to move forward with right now?". Rather than running through every node, we can pick the ones that have the best chance of getting us to our goal.

Here's a graphic to illustrate. On top, we have Dijkstra's Algorithm, which searches without this f value, and below we have A* which does use this f value.

Dijkstra's Algorithm (Wikipedia)
Dijkstra's Algorithm
A* Algorithm (Wikipedia)
A* Algorithm
So taking a look at Dijkstra's algorithm, we see that it just keeps searching. It has no idea which node is ' best', so it calculates paths for them all.

With A*,we see that once we get past the obstacle, the algorithm prioritizes the node with the lowest f and the 'best' chance of reaching the end.

# data[].attributes.attachment_link.description
If you're a game developer, you might have always wanted to implement A* as character (or enemy) pathfinding. I know a couple of years ago I did, but with my level of programming at the time I had issues with the current articles out there.

# data[].attributes.headline
Speech recognition using artificial neural networks and artificial bee colony optimization

# data[].attributes.subject
Speech recognition using artificial neural networks and artificial bee colony optimization

# data[].attributes.attachment_link.readable_text
October 7, 2019 by Ingrid Fadelli, Phys.org

Block diagram of proposed model. Credit: Shukla & Jain.

Over the past decade or so, advances in machine learning have paved the way for the development of increasingly advanced speech recognition tools. By analyzing audio files of human speech, these tools can learn to identify words and phrases in different languages, converting them into a machine-readable format.

While several machine learning-based models have achieved promising results on speech recognition tasks, they do not always perform well in all languages. For instance, when a language has a vocabulary with many similar-sounding words, the performance of speech recognition systems can decline considerably.

Researchers at Mahatma Gandhi Mission's College of Engineering & Technology and Jaypee Institute of Information Technology, in India, have developed a speech recognition system to tackle this problem. This new system, presented in a paper published in Springer Link's International Journal of Speech Technology, combines an artificial neural network (ANN) with an optimization technique known as opposition artificial bee colony (OABC).

"In this work, the default structure of ANNs is redesigned using the Levenberg-Marquardt algorithm to retrieve an optimal prediction rate with accuracy," the researchers wrote in their paper. "The hidden layers and neurons of the hidden layers are further optimized using the opposition artificial bee colony optimization technique."

A unique characteristic of the system developed by the researchers is that it uses an OABC optimization algorithm to optimize the ANN's layers and artificial neurons. As the name would suggest, artificial bee colony (ABC) algorithms are designed to simulate the behavior of honey bees to tackle a variety of optimization problems.

"Generally, optimization algorithms randomly initialize the solutions in the matching domain," the researchers explained in their paper. "But this solution could lie in the opposite direction of the best solution, thereby increasing the computational overhead significantly. Hence this opposition-based initialization is termed as OABC."

The system developed by the researchers considers individual words spoken by different people as an input speech signal. Subsequently, it extracts so-called amplitude modulation (AM) spectrogram features, which are essentially sound-specific characteristics.

The features extracted by the model are then used to train the ANN to recognize human speech. After it is trained on a large database of audio files, the ANN learns to predict isolated words in new samples of human speech.

The researchers tested their system on a series of human speech audio clips and compared it with more conventional speech recognition techniques. Their technique outperformed all the other methods, attaining remarkable accuracy scores.

"The sensitivity, specificity, and accuracy of the proposed method are 90.41 percent, 99.66 percent and 99.36 percent, respectively, which is better than all the existing methods," the researchers wrote in their paper.

In the future, the speech recognition system could be used to achieve more effective human-machine communication in a variety of settings. In addition, the approach they used to develop the system could inspire other teams to design similar models, which combine ANNs and OABC optimization techniques.

More information: Shilpi Shukla et al. A novel system for effective speech recognition based on artificial neural network and opposition artificial bee colony algorithm, International Journal of Speech Technology (2019). DOI: 10.1007/s10772-019-09639-0

© 2019 Science X Network

# data[].attributes.attachment_link.keywords[]
electronics and technology advances news

# data[].attributes.attachment_link.title
Speech recognition using artificial neural networks and artificial bee colony optimization

# data[].attributes.attachment_link.description
October 7, 2019 by Ingrid Fadelli, Phys.org Over the past decade or so, advances in machine learning have paved the way for the development of increasingly advanced speech recognition tools. By analyzing audio files of human speech, these tools can learn to identify words and phrases in different languages, converting them into a machine-readable format.

# data[].attributes.headline
Video: Building a Simple Neural Network in Excel

# data[].attributes.subject
Video: Building a Simple Neural Network in Excel

# data[].attributes.attachment_link.title
Building a simple neural network in EXCEL

# data[].attributes.headline
Video: Training a single Neurone in Excel

# data[].attributes.subject
Video: Training a single Neurone in Excel

# data[].attributes.attachment_link.title
Artificial Neural Network - Training a single Neuron using Excel

# data[].attributes.body
Online Editor for writing Prolog code

# data[].attributes.attachment_link.readable_text
This is second in a two-post series on building a neural network using microbits with micropython. In the first post python was used to produce a neural network without the microbits. In this post the network is as shown in figure 1 is developed.
The figure below shows the arrangement of the connections to be built; pin 2 is the output of each neuron. The two micro:bits/neurons on the left of the picture taking in the two same inputs ; the output from these neurons are the two inputs to the output neuron on the right.

All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

# data[].attributes.attachment_link.title
Produce a Microbit python neural network 2: Building a Physical Microbit Neural Network

# data[].attributes.attachment_link.description
This is second in a two-post series on building a neural network using microbits with micropython. In the first post python was used to produce a neural network without the microbits. In this post the network is as shown in figure 1 is developed.