Artificial Intelligence (AI) through the Lens of Islamic Economics – II

Algorithms are essential building blocks of AI. In this blog I introduce the notions of data, algorithms and machine learning against the backdrop of the zakat and Islamic micro finance sectors.

A few responses to my introductory blog on AI seemed to suggest a good-natured attempt to confer human-ness on Sophia. Some wondered (in a spirit of humor, I presume) if Sophia would be answerable to God for her actions in the life hereafter. Else, she may not be treated as a natural person eligible for marriage (nikah). Some asked if a nikah with Sophia would be counted within the permissible quota of four spouses! At the risk of stating the obvious, let me begin with a rather uninteresting but unambiguous statement. Sophia is a machine. Its actions are guided by a computer program. And the program uses data that is shared in a cloud network which allows input and responses to be analyzed with blockchain technology. Well, that seems to be quite a mouthful. So, we are now firmly within the domain of ABCD (Artificial Intelligence, Blockchain, Cloud, Data), familiar territory for proponents of FinTech 2.0, but perhaps alien to the uninitiated. Let us not leave the uninitiated behind. Let us simplify and provide an intuitive understanding of some key technical ideas and concepts.

Artificial Intelligence (AI) is the use of computers to mimic the cognitive functions of us, the humans. We can see. We can listen. We can relate. We can analyze. We can compute. We can make decisions. A computer system that is able to do these things is (artificially) intelligent. So, AI is about machines that can perform tasks that are characteristic of human intelligence.

Let me introduce the notion of data here. What we see is data. What we listen to is data. Data is not just numbers. It has to be seen as a much broader concept. It includes words, texts, images, gestures – anything that conveys information. When we try to relate data, analyze data, compute and make decisions, we use algorithms.

A basic building block in AI is algorithm. At the risk of digressing a bit into Islamic history, I am unable to resist the temptation of going to the roots of this term.  Algorithm is a latinized derivative of al-Khwarizmi (Muḥammad ibn Musa al-Khwarizmi) one of the greatest mathematicians of all times who lived in 9th Century Persia and produced works in mathematics, astronomy, and geography. Al-Khwarizmi’s treatise on algebra (The Compendious Book on Calculation by Completion and Balancing) presented the first systematic solution of linear and quadratic equations.

Algorithm in AI simply means a set/list of rules to follow in order to solve a problem. We need a code to tell a computer what to do. Before we write a code, we need an algorithm. For instance, an algorithm for a simple zakat liability estimation of an individual may appear like this:

Get the values for
Zakatable Assets (ZA): Gold (G), Silver (S), Cash (C), Receivables (R), Investments in Zakatable Assets (I), Business Stock (B) – and Deductible Liabilities (DL)

  • Get the current market price (P) of gold (say per 1kg)
  • Calculate Nisab (NB) = P*0.085
  • Find Sum of all Zakatable Assets [ZA= G+S+C+R+I+B]
  • Find Net Zakatable Assets (NZA) = ZA-DL
  • Compare NZA with NB;
  • If NZA < NB, Zakat Payable = 0;
  • If NZA >= Nisab, Zakat Payable = NZA X 0.025

When all the input data are given, there’s little for the algorithm to do other than just compute the result. It is a given. We may introduce some excitement factor into the scenario by modifying the problem. Let us now try to predict the zakat liability of the individual for the coming year. There is no longer a single answer. Now all the inputs will be the predicted values of zakatable assets and liabilities. The benchmark Nisab will also depend on the future value of gold. We will need another algorithm to predict the future value of gold (e.g. exploring a pattern in the historical values of gold and extrapolating the same into the future). Or, let us say, we introduce some dynamic decision criteria – intention of individual to liquidate his/her investment or hold long-term – based on which the zakatable investments will take different values. We will then be stepping into the domain of machine learning (ML).

Machine learning is simply a way of achieving AI without being explicitly programmed. Without machine learning, AI would require building millions of lines of codes with complex rules and decision-trees. So instead of hard-coding, machine learning is a way of training an algorithm so that it can understand the logic and produce the results. Training involves feeding huge amounts of data to the algorithm and allowing the algorithm to adjust itself and improve. So these are kind of self-reliant algorithms.

What are the chances that a visitor will pay zakat online through the portal or, simply turn away?

Machine learning outcomes can be of two kinds. It can be predictions about the future, about things that are not yet known, but for which existing data can shed some light. For example, what will be the price of gold next month? Given the price in the past few months? There is no single answer. Machine learning outcome can also be about finding patterns in the data that are not entirely obvious because they’re implicit or probabilistic. For instance, it is provided with twitter responses of visitors to a popular zakat crowdfund portal in Indonesia, which are just a bunch of texts. Is there a pattern hidden in such responses? Is the crowdfund providing for what it takes a visitor to turn into a donor? What are the chances that a visitor will pay zakat online through the portal or, simply turn away? Now the machine needs to infer the idea of a satisfied visitor from a bunch of textual data.

But wait. AI is not just about predicting or classifying. AI is a much broader concept than machine learning. Then, there are those special categories of machine learning algorithms which that carry the tag of deep learning. In addition to deep learning there are other approaches to machine learning that include decision tree learning, inductive logic programming, clustering, reinforcement learning, and Bayesian networks, among others.

Deep learning was inspired by the structure and function of the brain, namely the interconnecting of many neurons. Artificial Neural Networks (ANNs) are algorithms that mimic the biological structure of the brain. Deep learning models try to simulate more closely how our human brain works.

In AI, we want the machines to interact the way we humans do. For example, many of us may have been approached at some point in time by strangers seeking a small sadaqa donation or a qard (loan). As humans seeking to act benevolently, we try to infer a few things from his appearance, ask a few questions about his financial conditions, make him speak, seek clues in his dress, countenance, and facial expression. Same data pixels in image, text in speech, numbers can all be used by a machine/computer. Compared to us, the ordinary individuals, Qard funds will perhaps seek more systematic data. There are microfinance institutions (MFIs) that insist that the client must perform salat (mandatory prayer) at the local mosque. With computer vision now fast becoming a part of good mosque management, data on mosque attendance should be available for the MFI as well as for our machine. Additional data can be made available in the form of utility bills, grocery purchases, type of mobile used and what-have-you. Indeed, there is data everywhere.

Our AI-driven machine can be trained on such data to enhance its intelligence and go on to classify the individual as conforming to our criteria of an individual in genuine need or not. For instance, AI can tell us whether or not the individual belongs to one of the eight categories of mustahiq or person eligible to receive zakat in the eyes of Shariah. AI can predict, should it be a case of qard, the probability that the borrower may default or delay repayment. AI can classify the default as a genuine or a willful one. In the former case, the defaulter perhaps needs additional help. The latter case would call for a penalty.

Imagine a similar classification error in the treatment of a Covid-19 patient an infected patient not-diagnosed as one and not receiving the treatment! Fortunately, we are in the domain of Islamic finance and not in healthcare.

There are innumerable ways in which AI can help humans analyze better, predict better and classify better. What needs to be underlined here is this. In AI, there is no known single right answer. We have to accept the possibility of error. There are four possible outcomes. For instance, in case of the above classification problem relating to mustahiq (zakat beneficiaries eligible according to Shariah), our machine may end up classifying (i) a poor as a poor, (ii) a non-poor as a non-poor, (iii) a poor as non-poor and (iv) a non-poor as poor. In the first two cases, it would have done its job properly. In the third case, it would deprive a genuine mustahiq from receiving zakat. In the fourth case, it would ensure a non-mustahiq to receive zakat. The error in the third case is perhaps more serious. Imagine a similar classification error in the treatment of a Covid-19 patient an infected patient not-diagnosed as one and not receiving the treatment! Fortunately, we are in the domain of Islamic finance and not in healthcare. We give the computer a clear objective and we express that as an optimization problem, such as minimizing the probability of error. We provide data to the computer and we ask our machine to optimize based on this data, which contain clues to solving our problem.

(To be continued)

Related Articles


Your email address will not be published. Required fields are marked *