<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by DonDuminda on Medium]]></title>
        <description><![CDATA[Stories by DonDuminda on Medium]]></description>
        <link>https://medium.com/@donduminda?source=rss-83223c8be23e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wGw4eoBlraRjQELjTvbIPQ.jpeg</url>
            <title>Stories by DonDuminda on Medium</title>
            <link>https://medium.com/@donduminda?source=rss-83223c8be23e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:26:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@donduminda/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Central Bank Digital Currency : Its ON]]></title>
            <link>https://donduminda.medium.com/central-bank-digital-currency-its-on-1c3a66321610?source=rss-83223c8be23e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c3a66321610</guid>
            <category><![CDATA[central-bank]]></category>
            <category><![CDATA[cbdc]]></category>
            <category><![CDATA[digital-currency]]></category>
            <category><![CDATA[china]]></category>
            <category><![CDATA[digital-transformation]]></category>
            <dc:creator><![CDATA[DonDuminda]]></dc:creator>
            <pubDate>Sun, 05 Sep 2021 07:16:47 GMT</pubDate>
            <atom:updated>2021-09-05T19:23:29.515Z</atom:updated>
            <content:encoded><![CDATA[<h3>Central Bank Digital Currency : Its ON</h3><p><em>Surveys indicate that 80% of central banks are engaging in work on the topic and over 30 central banks have already launched research or design reports. Central Bank of Sri Lanka is also working on a CBDC concept. Meantime after several years of work, the Chinese Government announced the starting of the tests of the country’s central bank digital currency (CBDC), DCEP (Digital Currency Electronic Payment), in four major cities. As per the news, seems the tests in the Mainland have proven to be very successful. Also China plans to test cross border transactions with CBDC along with Hong Kong later this year. As of now it seems that all fintech solutions, central banks and commercial banks needs to adapt in the near future.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*fy92VlZPRrWbqxBzxUpIRw.png" /><figcaption>source : stk.com</figcaption></figure><p>A CBDC is a new form of Central Bank money accessible to the general public, accepted as a means of payment, legal tender, safe store of value by all citizens, businesses and government agencies. This definition means it is recognized by law as a means to settle debts or meet financial obligations such as tax payments. CBDC is actually the third form of central bank money or in other words Fiat Money, alongside physical cash (accessible to the public) and current electronic money /central bank reserves (accessible to many financial institutions).</p><p>CBDC is introduced mainly to cover the loopholes in current fiat money system, to stop people from moving into various crypto’s and also to promote a cashless society. In the meantime CBDC inherits the positive features of fiat system as well. Recent advances in cryptographic and distributed ledger techniques have opened the door to the widespread use of digital currencies. While private initiatives such as Bitcoin, Ethereum, and Libra have led the introduction of these currencies, researchers and policymakers have explored the possibility that central banks could also issue digital currencies, and make them available to the general public.</p><p>With the introduction of crypto blockchain concepts most people would have thought that it will be the end of fiat system. But given the human nature most of the population do not trust a decentralized model which is not backed by a government(atleast I dont). Taking the main reasons which lead to the introduction of blockchain/bitcoin, CBDC is the output of central banks trying to introduce a new currency with a new payment model.</p><p><strong>Background Cash vs Electronic Money vs CBDC</strong></p><p>Understanding the fiat money system in place in important for a better understanding of CBDC. Before CBDC, central banks issue money to the public as <strong>cash, and to banks through reserves/settlement accounts</strong>. This is the mandate for monetary and financial stability. This money acts as a means of payment, unit of account and store of value for jurisdiction. Governments run based on taxations and almost all largest and smallest payments in the economy is carried out using central bank issued money. (a very few people might be still using the bata system, crypto or any other methods which does not involved government issued money)</p><p>Central bank has a direct liability on Cash/Coins. It means that if you have a cash note with you, then the central bank will 100% guarantee the existence of that note. In no point of time you need to be worried <strong><em>unless on exceptional cases where the governments go bankrupt.</em></strong></p><p>Then we have central bank reserves, which are in digital form. Commercial Banks act as a middle layer(intermediary) layer when granting access to the reserves. This is actually the current electronic money. Which is a intermediary representation of money but unlike Cash, CBSL is not fully responsible for that. The commercial banks which you are holding your bank account is responsible for the money saved in the account.</p><p>Bottom line is, reserve money or current electronic money does not exactly represent cash. Current electronic retail money represents a claim on an intermediary(commercial banks), rather than functioning as the digital equivalent of cash. This raises several issues, as the intermediary might run into insolvency, be fraudulent, or suffer technical outages your money saved with a commercial bank might not be accessible to you. Because you don’t hold a legal tender in your checking account but only the “bank’s promise”, so to say, it means that if the bank doesn’t exist anymore, you can’t hold anyone to your claim, and are effectively losing your money.</p><p>Below image will show the liability difference between, Cash and electronic money in today’s two-tier monetary system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/0*_m-5vrdNkgPx5Lep.png" /><figcaption>figure 1 taken from : <a href="https://voxeu.org/article/cbdc-architectures-financial-system-and-central-bank-future">https://voxeu.org/article/cbdc-architectures-financial-system-and-central-bank-future</a></figcaption></figure><p>Figure 1 : Explanation- <em>Cash is a direct claim on the central bank, while deposit accounts are claims on the commercial bank. Commercial banks back some of these claims by holding reserves at the central bank, but such value backing is never full.</em></p><p>In summary,</p><p>CBDC differs from physical cash given the digital representation. CBDC is indeed reasonably similar to the bills in your wallet. But storing and transacting with physical currency is very inefficient and tedious. A digital representation of that value would be much more convenient and efficient.</p><p>CBDC differs from your bank account money since the money you have with the bank is typically not legal tender. A dollar in your bank account is not the same as a dollar bill in your hand. It is much more a promise of the bank to give you a physical dollar upon your request. It is a bank’s liability to fulfill those requests. If the bank ceases to function and goes bankrupt, this distinction makes all the difference. Because you don’t hold a legal tender in your checking account but only the “bank’s promise”, so to say, it means that if the bank doesn’t exist anymore, you can’t hold anyone to your claim, and are effectively losing your money.</p><p><strong>3rd Form of Money : Benefits from CBDC to the government and the public</strong></p><ol><li>Accessibility : It has to be available like cash, a digital form of central bank money that could be used by households and businesses to make payments, hence we are starting to speak about the digital yuan, the future digital euro, and so on.</li><li>Anyone should be able to access : Be accessible without a bank account and be built on an open infrastructure. According to the World Bank’s Global Findex database, globally, 1.7 billion people do not have a bank account, and policymakers struggle to provide affordable, safe and accessible financial services to the unbanked population.</li><li>Direct liability with central banks : CBDCs will also act like cash, where there will be a direct claim with central bank of each country. People dont need to worry on the performance of their respective commercial bank. Since CBDC would have legal tender status and would not be your bank’s liability, you would not have to rely on the bank’s solvency. Your money would be safe, no matter how well the bank does.</li><li>No or less transaction fees : a CBDC should enable cheap, secure and real time transfer of value. As of now, digital transactions are done within commercial banks with payment channels like VISA, MasterCard does have charges involved. Within Sri Lanka we have internal payment networks like Lankpay which facilitates digital payments within commercial banks. If Central Bank of Sri Lanka plans to introduce CBDC, then major changes in the current payment system needs to be introduced. Anyway we will have plenty of DCEP (Digital Currency Electronic Payment)’s to use as references by then.</li><li>Centralized solution : CBDCs are not cryptocurrencies, since cryptos are established by private entities and supported by numerous distributed nodes that are incentivized through block rewards to maintain the network. CBDCs are supported by one central network, driven to serve only the public policy of the sovereign state that issues them.</li><li>Monitor transactions for better planning, taxation : With CBDC government to better track the flow of money through its economy and make better planning decisions. Now, almost all cash transactions go unnoticed and does not have a trail. Also most vendors use cash payments to avoid taxations. Taxation is a major issue for a government like Sri Lanka where the percentage of indirect taxation is high. Since the capability of tracking every transaction, CBDC will provide a solution for both direct and indirect taxations limitations once implemented.</li><li>Go cashless : Going cashless will be major achievements with CBDC if implemented properly. Tt will cut down money printing costs. Current electronic money has done the job to a certain extent but due to the architectural limitations/ involvement with commercial banks and liability concerns still cash is used by most as a payment method. Also this comes with the lack of knowledge in tech etc.</li><li>Monetary policy purposes : to reduce the lower bound on interest rates</li><li>To achieve financial inclusion : Financial inclusion has been identified as an enabler for 7 of the 17 <a href="http://www.un.org/sustainabledevelopment/sustainable-development-goals/">Sustainable Development Goals</a>. Individuals and businesses have access to useful and affordable financial products and services that meet their needs — transactions, payments, savings, credit and insurance.</li><li>As a tool to prevent financial crime : Every new financial innovation brings new financial risks. Digital currencies are no exception however, new technologies themselves can also bring new opportunities to deal with new and existing threats.</li><li>For geopolitics purposes -especially when used for cross-border transactions : This will be a major step if CBDC can come up with a real-time process for cross boarder payments and settlement. As of now the settlement process takes 2 days.</li></ol><p><strong>China’s Progress</strong></p><p>As stated by Dr. Oriol Caudevilla (FinTech Advisor and Researcher) , “the digital yuan will certainly bring many opportunities and benefits to China: it will allow them to create an important soft-power tool; it will help China to control or at least minimize its shadow banking system; it will cut down money printing costs; for commercial banks, DCEP will facilitate more money transactions with lower costs, and, for the public, DCEP would save them indirect transaction fees for interbank transfers; monetary policy wise, it will enable the Chinese government to better track the flow of money through its economy and make better planning decisions; and the digital yuan will be an effective tool when promoting financial inclusion, since CBDCs can address the needs of unbanked and underbanked people.”</p><p>Aside from this he has also stated that the digital yuan might help propel the yuan to international reserve status where a cross-border deployment of the digital yuan will help take some of the USD-denominated exports and convert them into yuan-based exports, thus challenging the global domination of the USD.</p><p><strong>Open Items</strong></p><p>The arrival of CBDCs brings many questions. Does the fear of Big Brother style surveillance outweigh the benefits of transparency? Do they give Central Banks a more effective response to banking failure or expose fiat currencies to even greater risks of speculation? How do they enable greater access to banking facilities and wider financial inclusion? There may also be implications for commercial banks if CBDCs are seen as a better hedge against banking failure.</p><p>The role of a commercial bank is a major concern once CBDC is implemented. Since owning CBDC would effectively mean that you have a relationship with — or an account at — the central bank. Banks have a much better insight into the needs and wants of their customers than central banks. Hence, they can be much more innovative when it comes to services around the usage of money. eg: mobile banking platform, new mobile payment methods, investment advice, or an excellent trading platform.</p><p>As we know loans are one of the main tasks carried out by a commercial bank. As of now, when people deposit money at a bank, they get a promise from the bank to pay out cash upon request. This money is released as loans to businesses under certain conditions, most importantly, the repayment schedule and the interest rate. In the current system, the bank’s capability to give out loans relies to a percentage of the liquidity. If a significant number of the bank’s clients decide to hold CBDC instead of having a bank account like today, the bank would have less capital to give out loans, which would, in turn, make loans more expensive and potentially even not practical.</p><p>It is only a matter of time until the analyses provide the right combination of measures to implement. We will know better with the release of test results from governments such as China. Architecture wise the implementation may need tweaks from country to country. I have a shared a few details on the proposed architectural solutions in my previous post as well :<a href="https://donduminda.medium.com/central-bank-digital-currency-682d1ba1d110">post 1</a> . Some might use blockchain technologies some might not. But every central banks needs to have a common understanding when it comes to interfacing cross boarder transactions(similar to current ISO8583 usage).</p><p><strong><em>What is clear is that these new digital currencies will bring new challenges and opportunities for financial institutions. Hoping to write more on the CBDC architecture and cross boarder payments methods on a later article. Please add a comment and share your view.</em></strong></p><p><strong><em>Credits</em></strong></p><p>Rees, F.R.A.-M. and Modi, A. (2020). <em>Central Bank Digital Currencies — good news in the fight against financial crime?</em> [online] Lexology. Available at: <a href="https://www.lexology.com/library/detail.aspx?g=8f9b81b7-fc7b-48e3-bb68-ed2523529656">https://www.lexology.com/library/detail.aspx?g=8f9b81b7-fc7b-48e3-bb68-ed2523529656</a></p><p>Auer, R. and Böhme, R. (2020). <em>CBDC architectures, the financial system, and the central bank of the future</em>. [online] VoxEU.org. Available at: <a href="https://voxeu.org/article/cbdc-architectures-financial-system-and-central-bank-future.">https://voxeu.org/article/cbdc-architectures-financial-system-and-central-bank-future.</a></p><p>China’s Digital Yuan: The Start of a New Era. by Dr. Oriol Caudevilla in Csutie Mag, 2021 Aug.</p><p>daml.com. (n.d.). <em>What is a Central Bank Digital Currency and why should people prefer CBDC over bank accounts</em>. [online] Available at: <a href="https://daml.com/blog/engineering/what-is-a-central-bank-digital-currency-and-why-should-people-prefer-cbdc-over-bank-accounts">https://daml.com/blog/engineering/what-is-a-central-bank-digital-currency-and-why-should-people-prefer-cbdc-over-bank-accounts</a> [Accessed 5 Sep. 2021].</p><p>‌</p><p>‌</p><p>‌</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c3a66321610" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Central Bank Digital Currency]]></title>
            <link>https://donduminda.medium.com/central-bank-digital-currency-682d1ba1d110?source=rss-83223c8be23e------2</link>
            <guid isPermaLink="false">https://medium.com/p/682d1ba1d110</guid>
            <category><![CDATA[digital]]></category>
            <category><![CDATA[payments]]></category>
            <category><![CDATA[central-bank]]></category>
            <category><![CDATA[currency]]></category>
            <category><![CDATA[money]]></category>
            <dc:creator><![CDATA[DonDuminda]]></dc:creator>
            <pubDate>Sat, 31 Oct 2020 20:42:42 GMT</pubDate>
            <atom:updated>2020-11-01T07:49:01.165Z</atom:updated>
            <content:encoded><![CDATA[<h4>Its the most talked about, soon to be the 3rd form of money……</h4><p>According to voxeu.com, surveys indicate that 80% of central banks are engaging in work on the topic and over 30 central banks have already launched research or design reports. Central Bank of Sri Lanka is also working on a CBDC, this information is solid thanks to the RIT act. (Yes I personally inquired and CBSL was kind enough to respond)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Noa_AXHgETIILJS7.jpeg" /><figcaption>Image courtesy : medium/nanopay</figcaption></figure><p>Recent advances in cryptographic and distributed ledger techniques have opened the door to the widespread use of digital currencies. While private initiatives such as Bitcoin, Ethereum, and Libra have led the introduction of these currencies, researchers and policymakers have explored the possibility that central banks could also issue digital currencies, and make them available to the general public.</p><p>CBDCs could become a new, third form of central bank money, alongside physical cash (accessible to the public) and central bank reserves (accessible to many financial institutions).</p><p><strong>Lets get to know the existing two forms of money.</strong></p><p>Understanding the fiat money system in place in important for a better understanding of CBDC. Today, to promote safe payments central banks issues central bank money to the public as cash and to banks through reserve and settlement accounts. This is the mandate CBs has for monetary and financial stability. This money acts as a means of payment, unit of account and store of value for jurisdiction. In a way almost all largest and smallest payments in the economy is carried out using central bank issued money.</p><p>Central bank has a direct liability on Cash/Coins. What does this mean? It means that if you have a cash note with you, then the central bank will 100% guarantee the existence of that note. In no point of time you need to be worried because its issued by the central bank.</p><p>Then we have central bank reserves, which are in digital form. Commercial Banks act as an middle layer(intermediary) layer when granting access to the reserves. This is actually the current electronic money. Which is a intermediary representation of money but unlike Cash, CBSL is not fully responsible for that. The commercial bank which you are holding your bank account is responsible for the money saved in the account. In other means, you need to go that exact bank to use that money.</p><p>Bottom line is, reserve money or current electronic money does not exactly represent cash. The key consideration for issuing a retail CBDC is that current electronic retail money represents a claim on an intermediary(commercial banks), rather than functioning as the digital equivalent of cash. <strong>This raises several issues, as the intermediary might run into insolvency, be fraudulent, or suffer technical outages. </strong>A CBDC to be unaffected by financial crisis must be a cash-like direct claim on the central bank.</p><p>Below image will show the liability difference between ,Cash and electronic money in today’s two-tier monetary system.</p><figure><img alt="Figure 1 Cash vs electronic money in today’s two-tier monetary system" src="https://cdn-images-1.medium.com/max/662/0*kU7ac6W1z2AFhTMZ.png" /><figcaption>figure 1 taken from : <a href="https://voxeu.org/article/cbdc-architectures-financial-system-and-central-bank-future">https://voxeu.org/article/cbdc-architectures-financial-system-and-central-bank-future</a></figcaption></figure><p>Figure 1 : Explanation- <em>Cash is a direct claim on the central bank, while deposit accounts are claims on the commercial bank. Commercial banks back some of these claims by holding reserves at the central bank, but such value backing is never full.</em></p><p><strong>What are we trying to solve with CBDC, that digital form of money doesn&#39;t support?</strong></p><p>Households and firms have long held digital money balances, in addition to notes and coins. Banks have issued digital money, demand deposits for decades. And central banks have done likewise, issuing reserves, but only to commercial banks.</p><p>What has changed in recent years is <strong>the ease with which users can access their money</strong> and spend it. FinTech and Big Tech have led the way (and banks have followed) towards more transaction convenience, at the cost of sacrificing personal service and privacy. Moreover, blockchain-based technologies which decentralize the storage of information and its trustworthy transmission increasingly allow to cut out the middleman.</p><p>Also we know that commercial banks <strong>as the intermediary might run into insolvency, be fraudulent, Not meet the reserve rules and issue more currency to the public or suffer technical outages.</strong></p><p><strong>What is central bank digital currency?</strong></p><p>As you have already read above, addition to banknotes and other liabilities, central banks issue digital money reserves but only to a select group of financial institutions which we call as commercial banks. With the CBDC concept, households and firms also should have the possibility to acquire reserves directly from central banks without an intermediary. More like Cash!. Then again. The innovative part of CBDC is not its digital nature, but broad access. A more fitting name would be ‘Reserves for All’.</p><p><strong>Possible CBDC Architecture</strong></p><p>These considerations bring to the fore the issue of how a CBDC can live up to central banks’ mandate to provide a universal means of payment for the digital era, while at the same time giving the private sector the primary role in the retail payment system. Only some of the numerous proposed CBDC architectures can achieve this feat.</p><p>Currently there are three main architecture designs are being discussed.</p><ol><li><strong>Direct CBDC</strong></li><li><strong>Hybrid CDBC</strong></li><li><strong>Indirect.</strong></li></ol><p>I will share an figure below which will detail out the differences of the three concepts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/0*QAHnnyA8Onocm-wj.png" /><figcaption>Figure 2 : CBDC Architectures source : voxeu.com</figcaption></figure><p><strong>Direct CBDC : </strong>A retail CBDC allows consumers to hold a direct claim on the central bank. Central bank handles all payments in real time and keeps a record of all retail holdings. No intermediaries needed. This is more like Cash. Central bank will have to provide infra and resources to handle all transactions and consumer accounts.</p><p><strong>Hybrid CBDC :</strong> incorporate a two-tier structure with direct claims on the central bank while real-time payments are handled by intermediaries. The central bank could either retain a copy of all retail CBDC holdings or only run a wholesale ledger . Consumer accounts and transactions will be handled and managed by the intermediaries but central bank will also notified of the transactions taken place.</p><p><strong>Indirect CBDC :</strong> fully backed payment accounts that feature intermediaries who need to have fully backed account holdings at the central bank. I don’t see any difference in this model and the existing digital money.</p><p><strong>Central Banks Readiness</strong></p><p>As central banks play a key role in payment systems, both the declining use of cash and related private sector developments may require them to step up and take a more active role. If a central bank were to issue a CBDC, record-keeping, integrity protection and establishment of the necessary level of consistency can also be delegated to the private sector, which might either be allowed to use proprietary technology or be required to run open protocols specified by a standardization body. (Hybrid)</p><p>The need for technical supervision emerges as soon as the central bank is shielded from some retail transactions, which a fraudulent or technically compromised payment service provider could use to appropriate customer funds. Maximum supervision is required when the central bank has the conceivable minimum information set. Payment supervision must happen at a high frequency perhaps even in real time.</p><p>All this pinpoints a novel trade-off for central banks in the digital era: they can operate either complex technical infrastructures or complex supervisory regimes. There are many ways to do so, but all will require the central bank to develop substantial technological expertise.</p><p>Next we will talk about CBDC issues and concerns and the problems CBDC will help resolve in the existing monetary system..</p><p>End of part 1.</p><p>References : <a href="https://voxeu.org/article/cbdc-architectures-financial-system-and-central-bank-future">https://voxeu.org/article/cbdc-architectures-financial-system-and-central-bank-future</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=682d1ba1d110" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fintech Notes]]></title>
            <link>https://donduminda.medium.com/fintech-notes-51469cddd38e?source=rss-83223c8be23e------2</link>
            <guid isPermaLink="false">https://medium.com/p/51469cddd38e</guid>
            <dc:creator><![CDATA[DonDuminda]]></dc:creator>
            <pubDate>Sat, 03 Oct 2020 05:10:50 GMT</pubDate>
            <atom:updated>2020-10-03T05:10:50.957Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Finance and technology have been interconnected from the very beginning.<br>one of the first physical technologies<br>to develop was money<br>the simple coin<br>or thousands of years later,<br>not long after 1000 A.D.,<br>paper money.</p><p>Money is a form of technology<br>that allows us to physically handle<br>the ideas embedded in finance.<br>today’s fintech,<br>the modern period of fintech<br>and financial technology<br>begins around 150 years ago<br>and we generally mark the date as 1867.<br>Why 1867?<br>1867 was the date of the establishment<br>of the first transatlantic telegraph cable.<br>That transatlantic telegraph cable<br>made instantaneous communication<br>between the major markets<br>of New York and London,<br>or London and Paris,<br>or even eventually several decades later,<br>Shanghai, or Hong Hong, and London possible.<br>This was the basic infrastructure<br>that underlies all of today’s<br>not only financial technology<br>but much of today’s communications<br>and media developments as well<br>and it’s somewhat ironic<br>that in the past five years<br>more undersea cable has been laid<br>than in the entire previous 150 years combined.<br>Why?<br>Because more physical cables are necessary<br>to handle the ever greater flows of data<br>speeding around the world<br>and underpinning<br>the development of finance.<br>Many would say<br>that the period from the 1860s<br>up to the start of the First World War<br>was a first period of<br>financial and economic globalisation<br>much like the past 30 years or so from today.<br>That period of<br>financial and economic globalisation<br>was underpinned by technological infrastructure<br>like the transatlantic telegraph cable<br>which in fact has been called<br>the Victorian internet.</p><p>Now, if we think about<br>technological developments<br>in financial services,<br>probably our next significant milestone<br>really comes during the Second War World.<br>During the Second World War,<br>significant effort spent particularly<br>in the context of developing codes<br>for secure communications<br>particularly of military and intelligence operations<br>as well as, significant efforts<br>to develop systems to break those codes<br>and it was this process of encoding<br>and breaking codes that led<br>to come of the groundbreaking thinking<br>in computer technology<br>and in fact,<br>eventually in artificial intelligence or AI<br>which is one of the most exciting developments<br>happening in financial technology today.<br>But it wasn’t until the period<br>after the Second War World<br>as the world economy is rebuilding<br>that we begin to see progressive development<br>of those early computer technologies<br>to eventually lay the ground work<br>for the sorts of fintech<br>and regtech developments<br>which we see today.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51469cddd38e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Will Libra Succeed ?]]></title>
            <link>https://donduminda.medium.com/will-libra-succeed-79b399731b10?source=rss-83223c8be23e------2</link>
            <guid isPermaLink="false">https://medium.com/p/79b399731b10</guid>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[libra-coin]]></category>
            <category><![CDATA[facebook]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[fintech]]></category>
            <dc:creator><![CDATA[DonDuminda]]></dc:creator>
            <pubDate>Sun, 29 Mar 2020 17:40:59 GMT</pubDate>
            <atom:updated>2020-09-23T03:08:02.474Z</atom:updated>
            <content:encoded><![CDATA[<h3>Will Libra Succeed ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y3Le4FVpp--gmvg4jdbjpQ.jpeg" /><figcaption>Image taken from alpari : <a href="http://www.alpari.org/">http://www.alpari.org/</a></figcaption></figure><p><strong>Libra Association, formed by Facebook announced a new digital currency which is called Libra. It was presented by Facebook a year ago, but as we see now its already 2020 March and no proper grants are given by the authorities. As I see it, may be the USA government saw it as a risk to the status of the USD. There are plenty of interesting videos on youtube where the Facebook CEO is been grilled over this by the US senate members. Currency war is pretty much the biggest thing in the world and we sure have to give credit to Facebook for even taking the risk of introducing a so called new currency. (Facebook do not use the term “its a new currency”)</strong></p><p><strong>Lets see how Libra works and the problems it plans to solve.</strong></p><p><strong>Why Libra was created ?</strong></p><p>As Facebook say, the world has no common platform to do financial transactions and hold money at the same time with low fees and commission rates. So that’s the problem, Libra is trying to answer. You might think why Paypal does the same? Yes true but it does not have the reach facebook has, no market place like facebook has and most importantly the trust factor is not there. (Will you be comfortable in using paypay to hold your entire savings?)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*EN6DzXRbzGTKsbT2r_HC0Q.png" /><figcaption>Facebook CEO on Libra’s mission , posted in early 2019</figcaption></figure><p>Given Facebooks reach with 2.5 billion users, every user can have the right to hold a digital wallet for them self. This will solve the low income users hassle, to open a bank account and them being able to participate in digital transactions/online markets. You can get a credit card only if you have a stable income and a bank account. Roughly only 1 billion bank accounts exits in the world. You dont need to produce you salary scripts or any documents to open a Libra account but it still can hold your money like a bank account, you just need a mobile device with an internet connection. Facebook is trying to help other 1.5 billion users also to have an account in a digital form. With this, a higher percentage of physical cash(untapped customers) will be digitized into Libra tokens.</p><p>On an external note, if Libra wallet is launched, it has the capacity to be the biggest financial institute with the most number of customer accounts in few weeks. Calibra is the name given to Facebook’s digital wallet for storing Libra coins. It will be a standalone app and will be integrated into WhatsApp and Facebook Messenger. A government ID has to be used for signup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*crOnRH2I9D2AhxXPlllSnw.png" /><figcaption>Facebook CEO on Libra’s benefits , posted in 2019</figcaption></figure><p><strong>Crpto vs Libra</strong></p><p>If you think Libra is a crpto currency, clear that thought now. Libra is a digital version of the USD,Yen, Euro or the Pound. Libra has all the characteristics of a fiat currency given its currency basket combines of fiat currencies (USD,Yen, Euro or the Pound are all fiat currencies) and most importantly there is a 3rd party/middleman involved. I believe the mediator or the 3rd party is been brought into the picture for Libra to eliminate the trust issues other crypto currencies has.</p><p><a href="https://en.wikipedia.org/wiki/Fiat_money">By fiat means, there is no physical assert bidden to the currency value like gold or silver</a> but the value of the currency is governed by a central bank of the country. Given that Libra is backed by a fiat currency basket its obvious that Libra will inherit all the fiat currency gradients. (you will get to know more on the currency basket later)</p><p>BitCoin/Crypto Currency is basically digital gold and it does not have a 3rd party/middleman involved for authorization transactions or to maintain the value of it. Basically saying no central bank is governing bitcoin. Also crypto currencies use block-chain technology. On a very high level, it works P2P and it also takes off the middleman. If I am not mistaken, taking off the middleman was the main purpose of creating a Bitcoin/Crypto Currency.</p><p>Libra was introduced as a crypto currency. I believe this is only because its been planned to use the blockchain technology for Libra transactions. Just a technology wrap to gain interest from the bitcoin community I assume. The block chain technology here is different to the block chain technology used for bitcoins. I will be explaining the technicalities in the latter part of the article. (the difference I mean…. )</p><p>In my view the Libra creators has analyzed the minus points of fiat currencies, BitCoin and other wallets like paypal and has tried to plaster each when creating Libra with some alternate method. All in all I assume I have done enough to convince that Libra is not exactly a crypto currency… Anyway you will understand most of the terms mentioned above after reading the topic below..</p><p><strong>Current Money Problems that Libra is planning to solve</strong></p><p><em>No common infrastructure to move money across the world : </em>You have heard about the companies that do money transfers across boarders and the fees bonded to the transaction. (some companies charge 7% to move money across the boarder .. but u need to wait days to get the money out) With Libra payments can be done instantly between boarders with no fees or commissions. Imagine you need to send money to your aunt in Africa and both of you can open libra wallets and then transfer libra tokens from your wallet to your aunts. Then your aunt can cash the libra tokens from where she stays. With Libra , u can use it as a settlement currency and make money move faster.</p><p><em>Crypto currencies like Bitcoin fickle big :</em> Over the course of the last two years the bit coin went from 900 to 20,000 USD. To overcome this Libra has designed a so called stable coin method. Which means the value of libra is tight to the real word asserts/fiat currencies. This is called the basket of currencies :USD,Yen,Pond and Euro. The value of this basket will decide the value of Libra. But since its a combination of few currencies the fluctuation will be kept at a very low or nothing over a longer period.</p><p><em>Fiat currencies also does fickle :</em> Yes they do. Value of the USD will not stay the same for 1 month. But since the currency basket has 4 major currencies, the rate of change is far less than a since fiat currency.</p><p><em>No inter-operability between current digital wallets and currencies : </em>Paypal does not allow to store bitcoins ? The point is there are plenty of digital currencies and wallets but these are not interconnected. Libra is planning to bridge that gap. May be someday you can buy Libra tokens using bitcoins.. I am just saying :)</p><p><em>Libra can be used as an account to hold your money and </em>worry less about the money losing its value over time. Libra gives a solution to the main issue we have in a fiat currency. Which is <strong><em>inflation</em></strong>. (<a href="https://medium.com/@donduminda/money-and-the-myth-of-saving-17e166eda92a">if you find time to read my article on a topic related to this, pls do :) </a>) You save 100 Rupees in your account today and you can get X number of Dhal from the market today. But in two weeks can you get the same X number of Dhal for 100 Rupees? Not sure. But Libra, given the currency basket theory they are trying to keep the inflation at a very minimum or nill.</p><p>Carrying cash is a crime in most parts of the world. Vulnerability of being robbed is high so a Libra wallet can be used to promote cashless transactions and as a account to hold money in the form of Libra tokens.</p><p><strong>How it works ?</strong></p><ol><li>First you download the Libra wallet application to you mobile and create a login. Libra account will be created under your credentials in Libra association. This will have a balance of zero Libra tokens.</li><li>Then you need to link your source account which holds your local currency with your bank as the funding source. (I have assumed that Libra wallet is compatible to link your local bank account )</li></ol><p><em>If you are a Sri Lankan and you have used a Wallet application done by any bank, you will know that your Debit account can be linked to the wallet as the source funding account. If this Debit account is from a different bank, then the account linking will be done via LankaPay CEFT.</em></p><p>3. Now that your source account is linked, you need to buy Libra tokens. Lets say a Libra token is 500Rps, and you are spending 10,000 Rps from your debit account to buy Libra tokens.</p><p>4. After the request in point 3, Libra association generates 20 Libra tokens and credits to your Libra account linked to your Libra Wallet.</p><p><em>at the point Libra association created 20 Libra tokens out of thin air. Money is not rippled here since your local currency is held as a liability when issuing Libra tokens. Anyway for the business to run Facebook is planning earn an interest for the local currencies saved in the Libra agency. Facebook has to have plans of reinvesting the fiat currency asset in other means to do so, similar to banks.</em></p><p>5. You goto Facebook market place, search for a merchant, or walk into a merchant who sells Jujubes and also accepts Libra, then buy 10 packs of them. Points to note here is, the merchant also has a Libra account with Libra association and he accepts Libra tokens as currency in exchange for the product he sells.</p><p>6. Now you need to withdraw the balance of your Libra accounts. Lets say the Libra token is still priced at 500Rps. So Libra association will convert the remaining token into your local currency and credit your source accounts.</p><p><strong>Libra Association</strong></p><p>Steps 1–6 is the overall concept of a Libra marketplace. In the meantime, Libra association will earn an interest for the time they hold the local currency in the wallet. I assume they will acquire banking licences and start other investments with this money. Libra association has complete control on how many Libra tokens are in circulation. Its like a central bank which can create and destroy Libra currency any time. Also most importantly, Libra association will have the authority to decide the buying and selling value of Libra.</p><p>Libra association has to have a reserve of money to payback who ever wants local currency in exchange to Libra coins. Similar to banks, they will have to self impose a reserve percentage.</p><p>Governing Body of Libra the Libra Association, it’s based in Switzerland with a group including 20–30 <a href="https://libra.org/en-US/association/">members</a>. Libra association decides the price of a Libra token and also they are responsible for the Libra reserve.</p><p><strong>What is the Libra reserve ?</strong> each time you cash in a dollar or any other currency it goes to a reserve called the Libra reserve. Libra reserve uses 4 currencies, USD,Jap Yen, Euro and Pound which is been branded as the Currency Basket. Lets say you buy a Libra tokens using Sri Lanka rupees. But the Libra reserve will not keep Sri Lankan rupees in the reserve. They will convert the Rupees into any of the four currencies in the basket and add to the reserve. With this method, even if one of the currencies goes up or down the value of the Libra will be stable.</p><p><strong>how Libra transactions will process ? I mean technically</strong></p><p>A Blockchain method is used here with some alterations. Blockchain is an infrastructure where digital transactions take place. Its a digital unchangeable record where transactions are recorded and verified by a set of set of nodes which are independent and de-centralized. In other words there is no central governing body or a central bank. This will enhance security because there is no single entity to be hacked. Also on another note governments or central banks cannot block transactions based on any conditions. Well that’s the normal blockchain, with Libra there is a slight difference tho, unlike bitcoin the libra nodes cannot be run by anyone. It has to be one from the Libra association. So end of the day the association has the power to validate if they want to and act as a middleman.</p><p>All the financial data will be kept in Calibra (co) and not Facebook. This is done to minimize the data privacy concerns.</p><p><em>note : Bitcoin can handle only 7 tps, Libra can handle 1000 tps and the centralized VISA can handle 24,000 TPS.</em></p><p><strong>Issues and way ahead …</strong></p><p>What ever is been said on the internet, Facebook and the Libra Association has put a solid plan in introducing Libra. As per some of the experts Facebook made an mistake by marketing the Libra currency, instead Facebook should have spoken about the wallet and the platform, its benefits more. Privacy concerns which the US senate worries about more are due to the past experiences with Facebook failing to keep its promises. Most interestingly the youngest senator <a href="https://youtu.be/1iCVn_JvOiQ">Alexandria Ocasio-Cortez</a> (whom I am a huge fan of :) ) also does not believe in Facebook’s credibility let alone the seniors. This I believe is a telling factor in the future of Libra.</p><p>Libra uses a fiat currency basket as its reserve. These fiat currencies are printed , or created out of thin air by the respective central banks. Does these currencies has any backing of a reserve like gold or silver ? No. Simple answer is fiat currencies does not need to have any backing of a physical assert. So to use fiat currencies as the reserve for Libra.. well its a bit confusing to me.</p><p>If Libra association go bankrupt in any case how will the public hold the association responsible is another concern. Its not like the government of any country is backing the Libra currency. The governing body of Libra is a set of self appointed company heads and not a central bank.</p><p><em>Lets wait and see how things will fold out in the next few months.. Fair to say, Libra will be huge and it will open doors for endless opportunities .. Please share your thoughts on this.. thank you!.</em></p><p>#libra #digitalcurrency #currency #banking #crypto #cryptocurrency #payments #dollar #yen #bucket #will #libra #succeed #facebook #digital #currency</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79b399731b10" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sats for Data Science]]></title>
            <link>https://donduminda.medium.com/sats-for-data-science-d616e9d1f5ec?source=rss-83223c8be23e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d616e9d1f5ec</guid>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[DonDuminda]]></dc:creator>
            <pubDate>Wed, 15 Jan 2020 17:15:31 GMT</pubDate>
            <atom:updated>2020-06-30T08:35:58.592Z</atom:updated>
            <content:encoded><![CDATA[<h3>Stats for Data Science</h3><p>Some of you, like myself has done stats to a certain extent 10 years back. Its always nice to refresh a bit or learn new things while you are working on your dream of becoming a Data Scientist.</p><p>At first we need to understand the very basic term in statistics, <strong>Population vs Sample</strong>. Population is by definition represents all items of interest to our study. Its usually represented by a upper case <strong>N</strong>. The findings or the numbers we obtain out of the Population (N) is called ‘Parameters’. While in a Sample is a subset of the population and the sample is represented by a simple case <strong>n</strong>. The findings or the numbers we obtain out of the sample (n) is called ‘Statistics’.</p><p>Next up its important to understand the types of variables we encounter when doing statistical testing. Different types of variables have,</p><p>1. data types and 2. measurement levels.</p><p><strong>Types of Data : Categorical, Numerical</strong></p><p><strong>Categorical</strong> type represents the groupings of data like car types, yes no questions etc.. <strong>Numerical</strong> type represents numbers and its future divided into two sections, discrete and continuance.</p><p><em>Discrete</em> means that the data is finite. Eg the number of children you will have. At-least you know the answer is an integer.</p><p><em>Continuous</em> data is variables that keeps on changing. Eg your weight, speed of a a car. Most of the time the X axis is the time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*uoW_97ZY_mFOP5ivIIFwNg.png" /><figcaption>pic 1 : Types of Data</figcaption></figure><p>Next up lets discuss the measurement types.</p><p><strong>Types of Measurements </strong>: <strong>Qualitative</strong> and <strong>Quantitative</strong> data.</p><p>There exists a fundamental distinction between two types of measurement data: <strong>Quantitative</strong> data is information about quantities, and therefore numbers, and <strong>qualitative</strong> data is descriptive, and regards phenomenon which can be observed but not measured, such as language.</p><p>Then again the qualitative data can be divided in to <strong>nominal</strong> and <strong>ordinal</strong>. If you take a car categorization, BMW,AUDI,HONDA are types and each has it own quality. So still the three categories does not have an order as such, which means its nominal. But lets say we categorize the cars according to price. Then it has an order, HONDA,AUDI,BMW if we name according to the ascending order. In this case the data is ordinal.</p><p>Measurement type Quantitative has two types : ratio and intervals. Both are represented by numbers but has one main difference, which is the ratios has a real 0 value and the intervals dont. Please read this article to understand the concept in detail. <a href="https://www.questionpro.com/blog/ratio-scale-vs-interval-scale/">link 5 mins read</a></p><p>After 5 mins….</p><p>Great you are back :)</p><p>Next up is the visualization techniques. Visualizing data is the most effective method to analyse data. But we need to have the idea as to which method to use by looking at the data type.</p><p>Lets focus on <strong>Categorical Data</strong> Types first. To represent categorical data we can use frequency tables, bar charts, PIE chats. (see pic below)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*9RK7ZOnqki-s0SobdmSK1A.png" /><figcaption>pic 2 categorical data representation</figcaption></figure><p>next up lets identify the methods of visual representations in <strong>numerical data</strong>. Basically histograms and scatter-pots are used. I have given few examples below.. (Do you know the difference between histogram and a bar chart? in a histogram the bars are connected since the data is linked unlike in a categorized scenario)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*qR0jr-uS-XcSnLkYDrpR2g.png" /><figcaption>pic 3 histogram</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*GPT3dC9sE-CyVQquuHTC4w.png" /><figcaption>pic 4 scatter pot</figcaption></figure><p>Below I have prepared a summary of the diagrams we can use depending on the data types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*CavBFOdokJECgJpFgd1SrA.png" /><figcaption>pic 5 summary</figcaption></figure><p>Next up we will talk about mean,median and mode which is also called measures of central tendency.</p><p><strong>Mean</strong> is represented by the Greek letter mu( <strong>μ</strong>). We can find the mean by adding up all the components and then divided it by the number of component. Very simple as it sounds but we need to understand the shortcomings of mean. Its easily effected by outliers. Therefore using mean only is not sufficient.</p><p><strong>Median</strong> is the middle number, where you get the position of median by getting the components and then dividing it by 2.</p><p>Next up, the <strong>Mode</strong> is the component with most occurrences.</p><p>Using only one method to understand a data set is not sufficient. So basically we need to understand the concept and use it accordingly.</p><p>Then comes <strong>skewness</strong>, which is not a popular term but lets understand the concept in brief. Skewness indicates the observations are concentrated on one side or not. Lets take a mean of 2.0 and a median of 2.5. Mean &lt; median, which indicates a positive skew. If we draw an histogram the occurrences are more left sided for the above scenario. Skewness indicates where the data is located. Take a look at the below diagram, It has a a graphical explanation on positive, negative and zero skew.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*7v7cLRmWiZRbfknhnOuv-Q.png" /><figcaption>pic 6 skewness</figcaption></figure><p>… to be continued..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d616e9d1f5ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Money and the Myth of Saving]]></title>
            <link>https://donduminda.medium.com/money-and-the-myth-of-saving-17e166eda92a?source=rss-83223c8be23e------2</link>
            <guid isPermaLink="false">https://medium.com/p/17e166eda92a</guid>
            <category><![CDATA[fiat-currency]]></category>
            <category><![CDATA[currency]]></category>
            <category><![CDATA[saving]]></category>
            <category><![CDATA[money]]></category>
            <category><![CDATA[myths]]></category>
            <dc:creator><![CDATA[DonDuminda]]></dc:creator>
            <pubDate>Thu, 10 Oct 2019 17:07:09 GMT</pubDate>
            <atom:updated>2019-10-26T18:30:18.752Z</atom:updated>
            <content:encoded><![CDATA[<h4>Author intends to discuss the concept of money and why we should not consider saving money. In a high level the entire article is based on the introduction of fiat money, inflation and increase in money supply.</h4><p>Money was a norm way before we were born and we had no choice to question the behavior of it. Former generations have already accepted it, therefore its even hard to question and we have inherited the belief. We live in a world where success is measured by wealth. Money is considered the key variable.</p><p>Understanding the monetary system or about money will do no harm but you have to have the ability to question the norms of the society. Cultures and governments built upon values and agreements. Same applies to money and also money is connected to every bit of everything.</p><blockquote>“It is well that the people of the nation do not understand our banking and monetary system, for if they did, I believe there would be a revolution before tomorrow morning.” — <strong>Henry Ford</strong>, <em>Founder</em>, <em>Ford Motor Co.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/0*C-uNOESAUtdZhNbk" /><figcaption>Money Myths</figcaption></figure><h4>ready ? set go…</h4><p>Lets say a currency bill is printed with 10, then it values 10 rupees of goods. Then another bill which is slightly bigger in size is printed 100. This bill can get you goods up to 100 Rps. End of the day its a piece of paper, but the vendor will provide you with goods that’s worth 100 Rps. For a second think why did he do that?</p><p>Lets say a bottle of milk was priced at 10 rupees two days ago. But today its priced at 11 rupees. Your 10 rupee bill cant get the same milk bottle today. Which means your 10 rupees has been devalued and its buying power has been reduced. (This is actually called inflation and you will hear more about this during the article)</p><p><strong>Lets understand the concept of money a in depth.</strong></p><p>Printed money has no real value unless we believe in it. This is basically the <em>Tinkerbell</em> effect. It says that something has a value because we believe in it. We use <strong>fiat money</strong> now. Which does not have a actual gold backing to the printed currency.</p><p>Money has seen many stages, in the late 1100’s commodity money was used by the traders. Then came representative money which the central banks had to have a gold deposit to print money signifying it was backed by a like amount of gold. Due to the world wars and various major business expansion needs the world needed more money. Initially the gold standard was reduced but later it was fully taken off in 1971 by the US. This is the beginning of fiat currency.</p><blockquote>By 1971, the United States was essentially bankrupt; it did not have enough gold in the Treasury to redeem all the dollars in circulation.That year, President Nixon severed the link between the U.S. dollar and gold. With his act, in effect, every currency in the world — thanks to the dollar’s status as the world’s reserve currency — became fiat currency.</blockquote><p>Fiat is just a fancy word that means a currency is officially printed and accepted by a government. It’s like a symbol of authenticity. Fiat currencies only have value because the governments who print them say they do. They are official sheets of paper. Technically, they’re worthless. Fiat currencies can’t be redeemed for gold or silver. And because of that, all fiat currencies lose value ..</p><p>Central Banks has the full authority to control the printing flow and no deposits like gold are needed. If money is grown on trees then its values is the same as the tree leaf. Therefore the value lies upon the amount of money being printed.</p><p>Central banks are gifted the power of printing money to a nation. The Central Bank of Sri Lanka (CBSL) has the sole authority to issue currency notes and coins on behalf of the Government of Sri Lanka. At the end of the first quarter of 2019, currency notes and coins in circulation amounted to Rs. 688 billion.</p><p>If a nation’s economy were a human body, then its heart would be the central bank. And just as the heart works to pump life-giving blood throughout the body, the central bank pumps money into the economy to keep it healthy and growing. Sometimes economies need less money, and sometimes they need more.</p><blockquote>The quantity of money circulating in an economy affects both micro and macroeconomic trends. At the micro level, a large supply of free and easy money means more personal spending. Individuals also have an easier time getting loans such as personal loans, car loans, or home mortgages. At the macroeconomic level, the amount of money circulating in an economy affects things like gross domestic product, overall growth, interest rates, and unemployment rates.</blockquote><p><strong><em>Why not print more money ?</em></strong></p><p>Printing more, the money itself becomes less valuable. Since this can cause major inflation, simply printing more money isn’t the first choice of central banks.</p><p><strong>Money transfer methods and payment methods </strong>have evaluated over time. In Sri Lanka, Cash is still the main player. Bank drafts, cheques and various digital payment methods have been introduced. Moving on to a digital age, banks use software to manage transactions and maintain the ledger balances. A typical number column in a database will be used to record the balance of a customers savings account. When a credit transaction is done, the balance will increase and when a debit transaction is done the balance will decrease from an entity. Here we don’t see printed money bills moving across. Its just digital records in a table, yet we consider those as a real values. This is virtual money being transferred around. If you consider Sri Lanka, the figure 688 Billion will cover money in all forms.</p><p><em>Since I deviated from the topic a bit, lets get back ..</em></p><p>Well of course the 688 Billion is not a static value. As you are aware by now the CBSL have the authority to print money and this figure has been changed yearly from its inception. I have given below a chart from CBSL, which shows clearly a rapid increase in money circulation within the country.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/0*xn-uw6e9o2j_LBr-" /><figcaption>chart 1 : Money Circulation over the years</figcaption></figure><p><em>“Money Supply in Sri Lanka has increased to 627073 LKR Million in July from 621555 LKR Million in June of 2019. Money Supply in Sri Lanka averaged 98506.86 LKR Million from 1960 until 2019, reaching an all time high of 687638 LKR Million in March of 2019 and a record low of 602 LKR Million in January of 1960.” says CBSL.</em></p><p>For a second, by looking at the chart above, think about the value of 10 rupees in 1960 and now. If you ask your parents, they will tell you the worth of 10 rupees back then and the goods you can purchase for that amount. But what can you do with a 10 rupee note now? Inflation and the increase in money supply into the system has devalued the currency.</p><p>Lets understand inflation in depth. As per the central bank the current inflation rates in Sri Lanka is around 4.5%. Which means the buying power of a rupee goes down by 4.5% every year. (I am not aware of the factors which are taken to calculate the inflation rate. But its not a lie that central banks keeps on removing the items/products that has a major impact in the rate. If you do a google search you can find many samples from other countries as well)</p><p>Given below is a chart from CBSL showing the inflation rates over the years and the predicted rate till 2024. Based on this if you do a basic math, your 1000 rupees today will lose its value by 45 rupees every year(rate is 4.5). But for sure the actual rate is well above the CBSL given rate.</p><p><em>take a second and think, same kind of impact will not happen to your cash savings ? Or in other words to your fiat money savings ..</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/0*BIKpmjB0yNAwIWEy" /><figcaption>chart 2 : Inflation rate over the years</figcaption></figure><p>Upto now I have tried to convinced you that the value of money keeps on changing along with its buying power.</p><p><em>Why do people save money still ?</em></p><p>To start, I have mentioned the value of a 10 rupee in 1960 and the things you would have been able to do with it. On the same note, think you saved 10 rupee per month in 1960 and what would the value be by now? With 10% interest you have a figure of 7920.00 rps after 60 years.</p><p><strong><em>{(10*12 + (10*12)/100*10 ) * 60}</em></strong></p><p>We as Asians were brought up in a way that we were told saving money is the way forward. Ancient kings of Sri Lanka used to save their wealth (we call these treasures), and it was the same in countries like Japan, India. For generations this was the same and its in our blood to save wealth for future use. But all these were physical wealth, gold, diamonds which was real. This theory does not apply to fiat money.</p><blockquote>When you say C<em>ash is not king! Cash is trash !</em> it sounds alien to us.. but well known author of the “Rich Dad Poor Dad” Robert Kiyosaki is a strong believer on this.</blockquote><p>Mr Kiyosaki goes on to say, after taking off the gold standard money became currency in 1971(in US). Which means there is no real value to money. More the money in the system, the demand for the product goes up. The price of a oil barrel in US was 10$ about 20 years ago. Now its like 54$. but in 2008 it was hitting 130$. <em>I am just wondering if the barrel just got bigger ? No cant be.</em> US dollar itself has lost its value almost 80% after 1971. Even if the banks keeps you paying 6% or 10% interest rates you for the savings, you cant keep up with central banks money printing and inflation. Its fair to say that saving money is the old rule.</p><blockquote><em>If some one has a lot of savings today, does that make him rich? Yes Temporally</em></blockquote><p>Lets see how the world behaves for a moment, we have rich countries and poor countries. Then we have counties in dept. Do we call a country in dept a poor country ? <a href="http://worldpopulationreview.com/countries/united-states-population/">United States</a> of America has a national debt of $19.23 trillion (USD), Japan has a dept of 9 trillion USD. Most of US’s dept is owned by China as I have read. Basically what I understand is these countries borrow money and invest in development projects and you basically dont use your savings for these. <a href="https://en.wikipedia.org/wiki/List_of_countries_by_gross_national_savings">In-fact US has the lowest percentage of savings</a>. So we have to understand that being in dept is good. But also it has to be good dept.</p><blockquote>Robert Kiyosaki, often says people like us are programmed to go to school, take a job, save money, buy a car, invest in the stock market. Rather than going to school, if we had studied money we should be knowing the system better. Unfortunately even an MBA will not teach you money and about the real system. Getting out of dept or fear of being in dept is stupid, coz money is itself dept.</blockquote><p>Most of us work and earn a pay cheque end of the month. Then we also pay our taxes out of it. We plan to save a bit of it. But we are not questioning our self’s the point of saving when money itself is a printed entity. Commercial banks wants you to save money, promotes saving and offer good interest rates. Issue here is the banks target the middle class and wants the middle class to save. Sri Lankan banks offer comparatively good interest rates. But most countries dont tempt to promote savings. US has a very low interest rate for savings. Japan has a zero interest rate. All this is done to promote entrepreneurship. I believe the Japs and the Americans are thought not save and saving is a myth.</p><p>Banks earn money through lending out to the rich(with the capacity to repay). Banks will treat you with respect when you save with them, but will treat you like a king when you borrow. A banker really wants to know how much you can borrow. Not how much you can save. Why ? beacuse banks earn through fees and taxes. We need to understand that the entire system is constructed upon borrowed money, or in other words generated money.</p><p><strong>Then again if banks earn money by lending out then why they ask customers to save?</strong></p><p>Central Banks control the quantity of money in circulation by setting reserve requirements. As a rule, central banks mandate depository institutions to keep a certain amount of funds in reserve against the amount of net transaction accounts. A certain amount is kept in reserve, and this does not enter circulation. Say the central bank has set the reserve requirement at 20%. If a commercial bank has total deposits of 100 million, it must then set aside 20 million to satisfy the reserve requirement. It can put the remaining 80 million into circulation.</p><p>Simply the banks has to have a 20% as a liquidity(<em>current cap by CBSL is a bit lower, you can check the current value in CBSL site</em>). If you deposit 100, the bank can lend out 80% of it which is 80. This is called fractional reserving system. Someone else borrows that 80 and saves in another bank,that bank can lend another 80% of the total. Which is 80% from 80. This goes on. End of they day the system is been injected with new money. <em>In this example there will be 80*5 = 400, new money injected into the system. </em>So the money you save, generates more opportunity for banks to lend.</p><p>Watch this video during your spare time to fully understand how new money is created by banks : <a href="https://www.youtube.com/watch?v=JG5c8nhR3LE">https://www.youtube.com/watch?v=JG5c8nhR3LE</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJG5c8nhR3LE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJG5c8nhR3LE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJG5c8nhR3LE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d08646c9e9774e6fa9429e30a5a5fa46/href">https://medium.com/media/d08646c9e9774e6fa9429e30a5a5fa46/href</a></iframe><p><strong>Working with credit money(borrowed) and being in dept is bad?</strong></p><p>NO. I gave the example with countries before whom are in dept and by now we know that money itself is dept. Although I am not giving any of you financial advice here, buying good asserts through credit money is the way forward. But spending borrowed money on liabilities will make you poor and poor. (liabilities like cars, phones etc)</p><blockquote>Mr Kiyosaki has famously said, The key is to use borrowed money (debt) to buy assets that creates net cash-flow for you each month. Then the debt turns into good debt and not bad debt, because it is debt that is letting you have an asset, that creates positive net cash-flow. Bad debt is used on liabilities that does NOT create positive net cash-flow for you.</blockquote><p>conclusion : We need to learn to think money as a product and we can buy it from banks at a reasonable rate. Fiat money was created since the world did not have enough currency to expand the business when currency was entitled to the gold standard. As I see,people who save fiat money in FDs and stock markets are temporally rich, but they will loose it in a flash. All in all we can think that, fiat money was created for the purpose of improving the cash flow. Certainly it was not created for the savers.</p><p><em>Note : the content is purely created on personal interest and curiosity and has no other motive. Also the author deliberately avoided the discussion on the theory of taxes since it will be a different topic altogether. Certain points may be incorrect and I stand to be corrected. Please leave a comment :)</em></p><p>References :</p><p><a href="https://goldsilver.com/blog/how-the-monetary-system-really-works-and-what-it-means-for-your-money/">https://goldsilver.com/blog/how-the-monetary-system-really-works-and-what-it-means-for-your-money/</a></p><p><a href="https://www.youtube.com/watch?v=CQWwGLDNz34">https://www.youtube.com/watch?v=CQWwGLDNz34</a></p><p><a href="https://www.youtube.com/watch?v=dN5qHjnd_xk">https://www.youtube.com/watch?v=dN5qHjnd_xk</a></p><p><a href="https://tradingeconomics.com/sri-lanka/money-supply-m0">https://tradingeconomics.com/sri-lanka/money-supply-m0</a></p><p><a href="http://www.sundaytimes.lk/190623/business-times/sri-lankas-financial-crime-rate-increases-with-black-money-circulation-354294.html">http://www.sundaytimes.lk/190623/business-times/sri-lankas-financial-crime-rate-increases-with-black-money-circulation-354294.html</a></p><p><a href="https://www.ceicdata.com/en/sri-lanka/monetary-aggregates/currency-in-circulation-held-by-central-bank">https://www.ceicdata.com/en/sri-lanka/monetary-aggregates/currency-in-circulation-held-by-central-bank</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17e166eda92a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BLOB storage in DB2]]></title>
            <link>https://medium.datadriveninvestor.com/blob-storage-in-db2-3f0a571747ab?source=rss-83223c8be23e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f0a571747ab</guid>
            <category><![CDATA[ibm]]></category>
            <category><![CDATA[dba]]></category>
            <category><![CDATA[blob]]></category>
            <category><![CDATA[lob]]></category>
            <category><![CDATA[db2]]></category>
            <dc:creator><![CDATA[DonDuminda]]></dc:creator>
            <pubDate>Tue, 26 Mar 2019 09:22:45 GMT</pubDate>
            <atom:updated>2019-03-28T12:07:51.926Z</atom:updated>
            <content:encoded><![CDATA[<figure><a href="http://www.track.datadriveninvestor.com/1B9E"><img alt="" src="https://cdn-images-1.medium.com/max/700/0*RoAeCVGdwsC8PhKo" /></a></figure><h3>Theory of BLOB storage in DB2</h3><p><strong>Introduction </strong>:<strong><em> </em></strong><em>In real world we have structured data and unstructured data. Usually we refer to the unstructured data (images,files,mp3,videos) as large objects. Large objects can be saved wihtin a RDBMS in BLOB format. Most of the RDMBS like oracle,db2, postgress does support this. There is a downside to this, which I will discuss in detail below along with the behavior and limitations. This is big data handing in the RDBMS world.</em></p><p>Let me give you a brief intro into Blobs in DB2 first.</p><p>BLOB is short for Binary Large Object which can be many things — for example, Documents, Voice Data, Pictures, or mixed media. What makes BLOBs unique is that BLOB data is not stored in a row. It’s stored externally to the table with a pointer giving the location of the object. Check the below image …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*bbQMMORgy5cjIoqwNT4xBQ.png" /><figcaption>Image taken from IBM : <a href="https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.dbobj.doc/doc/c0054525.html">https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.dbobj.doc/doc/c0054525.html</a></figcaption></figure><p>Let&#39;s leave what&#39;s been said above for awhile…and let&#39;s discuss some theory…</p><p>There are 5 types of table spaces in DB2.</p><p><strong>Catalog TBS</strong>( There is only one catalog table space per database, and it is created when the CREATE DATABASE command is issued. Named SYSCATSPACE by DB2, the catalog table space),</p><p><strong>Regular TBS</strong>( A regular table space stores all permanent data, including regular tables and indexes. It can also hold large data such as LOBs (Large Objects) unless they are explicitly stored in a large table space.)</p><p><strong>Large TBS</strong>( A large table space stores all permanent data just as a regular table space does, including LOBs. This table space type must be DMS, which is the default type. A table created in a large table space can be larger than a table in a regular table space. A large table can support more than 255 rows per data page improving space utilization on data pages.)</p><p><strong>System Temp TBS</strong>( A system temporary table space stores internal temporary data required during SQL operations such as sorting, reorganizing tables, creating indexes, and joining tables)</p><p><strong>User Temp TBS</strong>( A user temporary table space stores declared global temporary tables.)</p><p>Since we are focusing on LOBs here, lets focus only on regular and large table spaces.</p><p>Whats a container ? A container is linked to a table-space during creation and this will basically link a disk storage to the table space. Each table space has one or more containers. Containers can be added to or dropped from table space, and their sizes can be modified. Simply said its a path in the server where the data files for the linked table space will be saved.</p><p>We can create table spaces in different page sizes. Page size defines the <strong>size of pages</strong> used for the table space. Supported sizes include 4K, 8K, 16K, and 32K. The valid values for integer without the suffix K are 4 096,8 192, 16 384, or 32 768. (<em>on a non related side note, the page size of the table space and the buffer pool has to be the same</em>)</p><p>When defining the Tablespace, page size limits the row length and column count of tables that can be placed in the table space according to the limits shown in Table 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*TXB0ggDHmZRjGB6F2hUJqQ.png" /><figcaption>Ref IBM site : <a href="https://www.ibm.com/developerworks/data/library/techarticle/0212wieser/0212wieser-pdf.pdf">https://www.ibm.com/developerworks/data/library/techarticle/0212wieser/0212wieser-pdf.pdf</a></figcaption></figure><p>Lets dig deep into the details above. What you can see is there is a limit on the row size and the column count based on the page size. Who controls the page behavior ? Its the Operating System ?. Like HDFS for Hadoop,Similarly the page size related to some kind of a file system in the OS which DB2 is installed.</p><p>When you are creating a table on top of a tablespace the page size of it logically links to the table. Which means if we create a table on a tablespace with 4k page size, this table can have max 4005 bytes in a single row(based on the table 1). In other words, your table can have 10 varchar columns with each being 40 in length. (varchar fills the total length of the column even if enter a single character, but varchar2 does not).</p><p>Each data type has a default way of using space and we can use the below SQL to check the space taken in by each column.</p><p><strong><em>Select bigint(length(COL_NAME) as Size_KB from Table_Name;</em></strong></p><p>By now you would understand that we use BLOB when we feel that the length of the row with the LOB will exceed the base table space or the regular table space. To get a better understanding let’s check an actual DDL of a table with a BLOB column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*SZtqqj12QN5_yrrqe4IBAA.png" /></figure><p>We have created a table with a blob column and in TS1 regular table space,and the LOB column will be in TS3 LONG table space. I have come across the below basic set of rules when dealing with BLOB columns.( It took me about 4 hrs of reading to prepare the same :))</p><ol><li>When a BLOB column is defined in a db2 table, there has to be a LARGE table space defined at the same time. <strong>LOB Object data</strong> will be saved in the LARGE table space. <strong>LOB object information </strong>will be still saved in regular table space of the base table.</li></ol><p><em>side note : if you have two BLOB columns you need to have two LARGE table spaces ideally.</em></p><p>2. The base table will have a logical link to the LOB Data in LARGE table space. This is called LOB Information and it will reside in the regular table space.</p><p><strong>LOB object information is something like a link to locate the LOB data.</strong></p><p>3. If the LOB column is defined BLOB <strong>INLINE</strong>, then a certain portion of the LOB data is stored in the regular table space. We can specify the limit in KB.</p><p>(you can read about the LOB INLINE theory from this link : <a href="https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.dbobj.doc/doc/c0054525.html">clickme</a> )</p><p>Coming back to our context here in the DDL of the table above, as we can see, a 164kb limit is given for inline <em>(“IMG_DATA” BLOB(1048576) INLINE LENGTH 164 COMPACT )</em>. <strong>This means a certain portion of LOB data is saved in the regular table space.</strong> We can use the below sql to check what rows are inline and what rows are not.</p><p><em>select ADMIN_IS_INLINED(img_data) as x from crdXXXXXimg order by x desc;</em></p><p>— note : 1 means its inline</p><p><em>On a side note, using COMPACT key word does not mean the column in compressed. You can google on this later.</em></p><p>Say that you have a storage group as SG1 and both TS1 and TS2 are in it. SG1 is full, and you decide to move the CRDXXXIMG table to a new storage group coz it has 900GB.</p><p>We can understand that , If you are facing storage issues then you need to move both the TS1 and TS3 into a new storage group. Moving TS3 only will not give you the expected outcome of space reduction since some of the BLOB data are INLINE and resides in regular table space.</p><p>Please leave a comment ! thank you !</p><p><strong>Next up :<em> I will discuss on how to compress data and minimize performance issues in BLOBs.</em></strong></p><p><strong><em>Also I will discuss the possibility of using BigSql in the same application in parallel to db2 sql ,which is a SQL engine built ontop of Hadoop file system/Hive. But my question here is on how to minimize storage? If I dont care about the performance and I do care only about the disk storage space, do I actually want to waste my time migrating BLOB objects in my DB2 table into a Hadoop file system?</em></strong></p><p><strong>Reference</strong></p><p>analytics, D. (2019). <em>Optimize storage with deep compression in DB2 10</em>. [online] Ibm.com. Available at: <a href="https://www.ibm.com/developerworks/data/library/techarticle/dm-1205db210compression/index.html">https://www.ibm.com/developerworks/data/library/techarticle/dm-1205db210compression/index.html</a> [Accessed 27 Mar. 2019].</p><p>Ibm.com. (2019). <em>IBM Knowledge Center</em>. [online] Available at: <a href="https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.dbobj.doc/doc/c0054525.html">https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.dbobj.doc/doc/c0054525.html</a> [Accessed 27 Mar. 2019].</p><p>Ibm.com. (2019). <em>IBM Knowledge Center</em>. [online] Available at: <a href="https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/perf/src/tpc/db2z_decide2compressdata.html">https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/perf/src/tpc/db2z_decide2compressdata.html</a> [Accessed 27 Mar. 2019].</p><p>Krafick, M. (2019). <em>Attack of the Blob! (Blobs in a Transaction Processing environment)</em>. [online] DataGeek.blog. Available at: <a href="https://datageek.blog/2013/04/26/attack-of-the-blob-blobs-in-a-transaction-processing-environment/?unapproved=125432&amp;moderation-hash=0a7f7fd431eb569214d7685ac14e23d8#comment-125432">https://datageek.blog/2013/04/26/attack-of-the-blob-blobs-in-a-transaction-processing-environment/?unapproved=125432&amp;moderation-hash=0a7f7fd431eb569214d7685ac14e23d8#comment-125432</a> [Accessed 27 Mar. 2019].</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fb2a0d6%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2Fb2a0d6%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href">https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f0a571747ab" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/blob-storage-in-db2-3f0a571747ab">BLOB storage in DB2</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hadoop vs RDBMS]]></title>
            <link>https://medium.datadriveninvestor.com/hadoop-vs-rdbms-b91d51022da4?source=rss-83223c8be23e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b91d51022da4</guid>
            <category><![CDATA[hdfs]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[hadoop]]></category>
            <category><![CDATA[rdbms]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[DonDuminda]]></dc:creator>
            <pubDate>Wed, 30 Jan 2019 13:34:29 GMT</pubDate>
            <atom:updated>2019-03-28T08:52:46.801Z</atom:updated>
            <content:encoded><![CDATA[<figure><a href="http://www.track.datadriveninvestor.com/1B9E"><img alt="" src="https://cdn-images-1.medium.com/max/700/0*D5G5etMPsiMlQo4C" /></a></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/0*J3Zc3CCtgsO9GsKI.jpg" /><figcaption>Image : <a href="https://cdn.datafloq.com/cache/blog_images/878x531/how-perform-rdbms-crud-operations-hadoop-mapreduce.jpg">datafloq.com</a></figcaption></figure><p>Hadoop is the cloud computing platform data scientists use to perform highly paralleled operations on big data. If you’ve explored Hadoop, you’ve probably discovered it has many levels of complexity. After getting comfortable with the concepts it may feel a no brainier but getting there is not easy.</p><p>Lets learn a bit about the Hadoop file system, Its called the Hadoop’s distributed file system. Like other file systems the format of the files you can store on HDFS is entirely up to you. For example, you can use HDFS to store cat memes in GIF format, text data in plain-text CSV format, or spreadsheets in XLS format. This is not specific to Hadoop, you can store these same files on your computer file system.</p><p>However unlike a regular file system, HDFS is best used in conjunction with a data processing tools like MapReduce or Spark. These processing systems typically (although not always) operate on some form of textual data like webpage content, server logs, or location data.</p><p><strong>Understanding the Limits of RDBMS?</strong></p><blockquote><strong><em>RDBMS</em></strong><em> is the basis for SQL, and for all modern database systems like MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access. A Relational database management system (</em><strong><em>RDBMS</em></strong><em>) is a database management system (DBMS) that is based on the relational model.(wiki)</em></blockquote><p>Usually your system has to have a RDBMS in the first place for you to think about Hadoop. Its basically an evolution rather than a big ban. These hadoop concepts are made purely to cater new requirements in the modern era. Given pre RDBMS era, systems use to save data in text files. With time the scale of applications grew and the amount of storage, types of objects has increased, so basic level text files could not handle the performance and storage requirements. All these RDBMs like Oracle, PG,DB2 came into the picture in the last 40 odd years and has had a good run todate.</p><p>Where does a RDBMS store data? Well its basically on the file system in the OS. It can be NTFS. We create table spaces in a RDBMS world ontop of a storage path. Table spaces can be created in different page sizes. It can be 4k,8k,16k or 32k page. Based on the page size there will be a limitation to the maximum possible columns and data size. You can read it more by doing a basic google search and also check my post on “<a href="https://medium.com/datadriveninvestor/blob-storage-in-db2-3f0a571747ab"><strong>Blobs on DB2</strong></a>” to get another prospective on the same matter. But in HDFS files, do those really have a size limit ? In theory its limit less. Anyway I will be writing a new article on the behavior of HDFS soon. I will be planning to cover this area in detail in that blog.</p><p>We are now in a stage where certain limitations of RDBMs are being exposed. Lets see what are these limitations,</p><p>The first is <strong>scalability</strong>. Many companies have projects that are in the gigabytes. The new world of big data is moving in to the terabytes or even petabytes. And although it is possible to scale traditional relational databases to the multi-terabyte or even single petabyte ranges, it’s very complex and very difficult,and very expensive.</p><p>Next comes the <strong>speed</strong>. Relational database systems are not necessarily built at the scale and the speed to be successful in bringing all that data in.Most people think its about the processing speed but No, its about the reporting speed. Most companies now need real time data monitoring and analyses on transactions. Usually RDBMS are created based on the ACID concept. <strong>ACID</strong> (Atomicity, Consistency, Isolation, Durability) is a set of properties of <strong>database </strong>transactions intended to guarantee validity even in the event of errors, power failures, etc. Which is more on data protection. If you have worked with RDBMs, you will know that data inserting will not take time. Its the selects which tent to take time. Having two DBs for transactions and another for reporting is a cost. (But I have seen clients having this kind of a setup to minimize the impact in the transnational DB)</p><p>And there are other considerations around queryability, application of sophisticated processing like machine learning.</p><p><em>Relational database technology is not going away. This is a key concept as you’re learning about the Hadoop ecosystem. The Hadoop ecosystem is designed to solve a different set of data problems than those of relational databases. Basically Hadoop will be an addition to the RDBMS but </em><strong><em>not a replacement.</em></strong></p><p>Lets look at NoSql Db types such as key/value stores such as Redis, columnstores,document databases such as MongoDB or graph databases. For some big data projects, NoSQL databases are an appropriate solution. It’s important to understand that while some implementations of portions of the Hadoop ecosystem could be categorized as NoSQL DBs, <strong><em>Hadoop itself is actually not a database</em></strong>. It is an alternative file system with a processing library. Hive is the default database built ontop of Hadoop file system. But now other no sql dbs also support the HDFS file system. What does this mean actually ? you can retrieve data stored within a HDFS file by HIVE. (can use SQL over HIVE…)</p><p><strong>Cap Theory (Its ‘thee’ theorem for data bases)</strong></p><p>CAP Theory is the base therom of all DBs and File Systems. C stands for <strong>Consistency</strong>, which means if one transaction fails or rolls back it cannot have any impact on the other transactions or saved data. Taking a more practical egsample, if there is a cash withdrawal and there needs to be a debit from customer X and a credit to customer Y, either both has to fail or both has to be successful. (If both are executed in the same connection)</p><p>Next up is <strong>Availability </strong>or uptime. This actually talks about minimum downtime and the ability to create copies or dumps of the DB so that the recovery time is minimum or none.</p><p><strong>Partitioning </strong>is for scalability. Which means the ability to split the data across multiple platforms for hardware locations or virtual machines, so that you can grow the amounts of data without impacting the setup.</p><p>Now that you have a very brief understanding of CAP theory, does any type of DB (RDBMS,NoSql or Hadoop?) fullfill all these 3 parameters ? answer is No.</p><p>RDBMS has consistency and availability but has concerns when it comes to partitioning. NoSQL systems lack Constancy. CAP theory itself say that any DB type can have only two of these properties at once.</p><p><strong>Now then where does Hadoop fits into the CAP theory?</strong> As we discussed before Hadoop is designed for scalability. Hadoop is also designed to use commodity hardware for storage. Which means it will be using old servers or cheap servers when it comes to scaling. Hadoop always keep three copies of data by default so when ever you notice a certain server is corrupted you only need to replace the hardware. The Hadoop file system will automatically manage that copy process.</p><p>Another property of Hadoop,which is flexibility, or availability because it runs on commodity hardware you can scale a Hadoop cluster nearly infinitely. Companies with huge data sets Facebook,Yahoo are using hadoop, and they’re taking advantage of the cost saving that they get, scaling all of that data out on commodity hardware. And of course they also want high availability because it’s their business to be online and available all the time.</p><p>Consistency is not advertised with hadoop.</p><p><strong>What kind of data for Hadoop?</strong></p><p><strong>Line of Business Data :</strong> If your business is transaction based then your systems will not fit for hadoop since its not built for consistency. If any of your data that deals with making money usually you want transactions around that. Lot of businesses have wrong information about Hadoop and they think of it as a replacement for a relational database. It’s a supplement. Line-of-business data is going to stay in your relational database.</p><p><strong>Behavioral Data : </strong>This is the world of Big Data projects and this is data that will be batch-processed. So in other words, processed as a group rather than individually-queried. And it’s often a great fit for Hadoop.</p><p>In addition to the volume of data, it’s also the type of data. If the data is mission-critical in your line-of-business you’re really going to keep that in your relational database system. Behavioral data is a great candidate for Hadoop. Online education is really changing as it becomes browser-based and you collect data around not only whether the student gets the answer right, but what the student does when they’re working on the exercise in the browser. Think of different types of activities that a student would do. They would move their mouse. They would type something in the dialog box. All these activities can reflect how well the student understands the information and could be useful to the company that’s creating the educational software.</p><p>So, there’s all different methods of processing data but its really important to understand that Hadoop is not a replacement for a relational database system, it’s a supplement. And very often, it comes with a need to also add a NoSQL system.</p><h4>Related Stories from DDI:</h4><ul><li><a href="https://medium.com/datadriveninvestor/deep-learning-explained-in-7-steps-9ae09471721a">Deep Learning Explained in 7 Steps</a></li><li><a href="https://medium.com/datadriveninvestor/which-is-more-promising-data-science-or-software-engineering-7e425e9ec4f4">Which is More Promising: Data Science or Software Engineering?</a></li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fb2a0d6%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2Fb2a0d6%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href">https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b91d51022da4" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/hadoop-vs-rdbms-b91d51022da4">Hadoop vs RDBMS</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sentiment Analysis on Customer Tweets( NLP)]]></title>
            <link>https://medium.datadriveninvestor.com/sentiment-analysis-on-customer-tweets-nlp-c0eeaeffd19a?source=rss-83223c8be23e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0eeaeffd19a</guid>
            <category><![CDATA[text-analytics]]></category>
            <category><![CDATA[stemming]]></category>
            <category><![CDATA[logistic-regression]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[DonDuminda]]></dc:creator>
            <pubDate>Fri, 18 Jan 2019 13:53:04 GMT</pubDate>
            <atom:updated>2019-02-05T04:50:44.516Z</atom:updated>
            <content:encoded><![CDATA[<figure><a href="http://www.track.datadriveninvestor.com/1B9E"><img alt="" src="https://cdn-images-1.medium.com/max/700/0*g4oLvAAjlmHxTyYM" /></a></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6iq8-N35Oi_VwfhZjlHkuA.png" /><figcaption>pic 0 : text analysis</figcaption></figure><p>The best way to learn about Data Science/ML is by redoing something that has already been done. Since this is my actual first writeup in NLP, I will be redoing my own work. Actually, this is something I did for an assignment at my Masters.</p><p>I will be using a data set with airline customer review comments. It consists of a set of just under 15,000 tweets about airline services in the US. The data-set is manually labeled as ‘positive’, ‘negative’ or ‘neutral’ based on whether the respective tweet is favorable to the airline, unfavorable or neither. (<a href="https://www.google.com/url?q=https://drive.google.com/uc?authuser%3D0%26id%3D12fnaUHFLv4fucEhFhLy1Br7y9ws58KUt%26export%3Ddownload&amp;sa=D&amp;source=hangouts&amp;ust=1546686485131000&amp;usg=AFQjCNF1eDXEr7JNNLWmaGVeJMSgPOpOIw">get data set</a>)</p><p>The overall purpose of my write is to train a model that could be used for classifying airline services related tweets into the 3 categories automatically.</p><p><strong><em>Programming Language : Python , IDE: Anaconda Navigator with Jupyter.</em></strong></p><p><em>Lets understand the high level functionalities which we will be planning to do,</em></p><ol><li><em>Upload the data into Pandas</em></li><li><em>Clean the data.</em></li><li><em>build a tokenized list of words from the data.</em></li><li>remove stop words, Lemetizing and Stemming, remove words with less frequency(Outliers)</li><li>Feature Extraction</li><li><em>apply a Logistic Regression model using a feature extraction algorithm bag of words (CountVectorizer)</em></li><li><em>apply a Logistic Regression model using feature extraction algorithm TfidfVectorizer. (later)</em></li><li><em>Compare the output of each model above. (later)</em></li><li>apply SVM(support vector machine predictor) to <em>bag of words (CountVectorizer) and compare the output with No6 above. (later)</em></li><li>apply SVM(support vector machine predictor) to <em>bag of n-grams model and compare the output with No7 above. (later)</em></li></ol><p><strong><em>Upload the data into Pandas</em></strong></p><p>Open Jupyter Notebook ; Find out the current working directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*IoDbI-lyT44gUcJKOrsYhg.png" /><figcaption>pic 1</figcaption></figure><p>Run the slot and in my machine the output is given as ‘C:\Users\admin’. Now place the Airline_tweets.csv file into that location.</p><p>Let&#39;s load the CSV into a panda. We need to import the package if we have not done it already. read_csv function is used to load the data. In this, the first row is taken as the header by default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*FT_bz7hElpapOzW9KYFHYQ.png" /><figcaption>pic 2</figcaption></figure><p>If everything went well up to now we have our CSV file loaded into the panda object. Let&#39;s take a quick look at the summary of the <em>tweets </em>object which we created. At first, we use the <em>head </em>function to view the first few rows.</p><p>Sentiment column will represent the label. Tweet column will represent the customer comments/tweets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*eBxkmsL3KeQRkRX69Z24WA.png" /><figcaption>pic 3</figcaption></figure><p>As seen above, the data is in strings. Sentiment column has only one word. This understanding will be vital for future analysis concerns.</p><p>We can take a look at the summary of the stats using info() function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*OeqS3bxOUy7A9rdpot-pwA.png" /><figcaption>pic 4</figcaption></figure><p>From the output, we can say that the sheet has 14640 rows. Also, notice that the <em>tweets </em>object is the Data Frame type<em>.</em></p><p>We need to know if there are actually 3 types of Sentiments. We were told so initially but worth a look. I will be using <em>counter </em>function in the collections package to verify the same.</p><p>As seen below, there are 9000+ negative tweets, 3000+ neutral and 2000+ positive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*rqgZMzy5krEdTt6QrCQxTQ.png" /><figcaption>pic 5</figcaption></figure><p><strong>Clean the Data</strong></p><p>Now that we have a certain level of confidence that this data set is complete, let&#39;s jog down on what we are actually doing before building a model.</p><p>First, we need to clean the data in the Tweets column. Cleaning the data is done in many steps;</p><ol><li>Initially, we need to analyse the tweets and remove all the non-characters. Having non-character signs will give invalid input to the model we build.</li><li>Remove Stop words. Stop words are common in any language. These are words that do not have any meaning. According to the wiki, stop-words are referred to as “ In natural language processing, useless <strong>words</strong>(data), are referred to as <strong>stop words</strong>. <strong>Stop Words</strong>: A <strong>stop word</strong> is a commonly used <strong>word</strong> (such as “the”, “a”, “an”, “in”) that a search engine has been programmed to ignore, both when indexing entries for searching and when retrieving them as the result of a search query”</li><li>Lemetizing and Stemming; (I will explain later) If you are familiar with these concepts, you will notice that sentences cannot be stemmed or lemetized. We need to have a tokenized set of words to handle this.</li><li>Removing words with fewer frequencies.</li></ol><p>Now let&#39;s start removing the mentions, punctuations and the URLs from the tweets. We need to import the regex package for this. Also, we will use the punctuations available in the <em>String</em> class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*0jruvEBc-D_vvlWmzdq6QQ.png" /><figcaption>pic 6</figcaption></figure><p>(in pic 6)I have created a function called “remove_mentionsUrls” to remove the mentions and the URLs using the regex functions. Next up, another function is created to remove the non-alphanumeric characters using the punctuations in String class.</p><p>Below I have assigned the output of the above two functions into two new columns in the data frame. By viewing the output (rightmost corner) you can see the mentions and the punctuation are gone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w2S5u--AOXbffU0WnlFMsA.png" /><figcaption>pic 7</figcaption></figure><p><strong><em>Tokenizing</em></strong></p><p>We still have not tokenized the sentences into words. According to wiki, <strong>Tokenization is</strong> the act of breaking up a sequence of strings into pieces such as words, keywords, phrases, symbols and other elements called tokens.</p><p>Later on, you will understand the gravity of what tokenization is, basically when we use NLP each word needs to contain a numerical expression. Models we build are basically numerical models and each model needs a numerical input. Anyway, note that tokenizing itself does not assign numeric representations to words but it&#39;s only the first step.</p><p>I will be planning to write a function to split the sentences using white spaces so that the end result will be a set of words.</p><p>eg : white brown fox = ‘white’, ‘brown’,’fox’</p><p>pic 8 below, will show that I have used the split function in the regex to split the text using white spaces. The split method parses a <strong>string</strong> and returns an array of tokens. Also in the meantime, the text is converted into lower case before passing on. Lastly, take a look at the ‘Tweet_tokans’ column in the tweets DF, it does have separate words now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1MaMY3sWpjpzu3_i5eBGDA.png" /><figcaption>pic 8</figcaption></figure><p><strong>Stemming</strong></p><p>Next up let&#39;s focus on stemming. Why? we need to reduce the number of unique words for us to get a more accurate prediction.</p><p>Well, stemming is basically an algorithm to categorize similar words into one. According to wiki stemming is something like : <em>“ A stemmer for English operating on the stem cat should identify such </em><a href="https://en.wikipedia.org/wiki/String_literal"><em>strings</em></a><em> as cats, catlike, and catty. A stemming algorithm might also reduce the words fishing, fished, and fisherto the stem fish. The stem need not be a word, however. In the Porter algorithm, argue, argued, argues, arguing, and argus reduces to the stem argu.”</em></p><p>I have used the porter stemmer as shown in pic 9 below. Input has to be a set of words. Since we created a set of words above, I will be passing the “tweets[‘Tweet_tokans’]” to the function.</p><p>Based on the printed data, you will see that there is a word with letters ‘realli’ in line no 3. If you compare it with the Pic 8, its actually the word “really” that has been converted to “realli”. Well, this is the downside of the porter stemmer. It does not capture the meaning of the word.</p><p>Therefore I decided to try lemmatizing as well. I don&#39;t think there will be much of a difference in the model accuracy in whatever method we chose given the limited data set we have here. Anyway, let&#39;s decide that after comparing the number of unique words from both the outputs later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*wlWy6C_GTeGV4IsJrdGbdQ.png" /><figcaption>pic 9</figcaption></figure><p><strong>Lemmatizing</strong></p><p>According to wiki, <em>Lemmatisation is closely related to </em><a href="https://en.wikipedia.org/wiki/Stemming"><em>stemming</em></a><em>. The difference is that a stemmer operates on a single word without knowledge of the context, and therefore cannot discriminate between words which have different meanings depending on part of speech. eg : The word “better” has “good” as its lemma. This link is missed by stemming, as it requires a dictionary look-up.</em> It&#39;s best if you can read about these two offline since I will not be going deep into details here.</p><p>As done above I will be creating a function to lemmatize the words. Same as above the input will be the set of words. (tweets[‘Tweet_tokans’]) (pic 10) If you check the line 3 in this output, we clearly see that the meaning of the word is also kept intact.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*6FPcguVtXpYvobJRGJqszg.png" /><figcaption>pic 10</figcaption></figure><p>I have saved the set of words as tweets[‘FirstDataSet’].</p><p>Let&#39;s compare the number of unique words in the tweets[‘FirstDataSet’] and tweets[‘FirstDataSetStem’]. This will give us an idea of what the best method practically since the lesser the number of unique words, the higher the accuracy.</p><p>As seen in pic 11 below, I will be creating a flat list of words using the list function. Then calculating the unique words per each set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*VLcCl-eQn-tm0nGge04x8w.png" /><figcaption>pic 11</figcaption></figure><p>Surprisingly the Stemmed version got a lesser number of words. Therefore I will have to move forward with the tweets[‘FirstDataSetStem’] data set.</p><p><strong>Stop Words</strong></p><p>Next, we need to remove the stop words. As explained above stop words do not actually contain a meaning when taken individually. Since this will have an impact on the number of unique words, its best to remove all the stop words.</p><p>Let&#39;s write a function to remove the stop words. First of all, we need to import all the stop words as I have done below in pic 12. Then the function <em>remove_Stopwords </em>will check each word and if it matches with a stop word it will be removed.</p><p>Lastly, I have created a new data set names “SecondDataSet” with the output. If you compare the output with an image above, you will notice that the words like ‘the’, ‘to’ are removed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*yf3Yee25SADFtptRk0e29A.png" /><figcaption>pic 12</figcaption></figure><p>Now, let&#39;s check the number of unique words has reduced or not. Ideally, there has to be some reduction. Seems it has by looking at pic 13.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*QOHShGRC25kruxuq-W9i2Q.png" /><figcaption>pic 13</figcaption></figure><p><strong>Removing words with fewer frequencies</strong></p><p>Next up we will remove the words will fewer frequencies. Eg: if there is a word called “Maxmilan” in the list and its only repeated 3 times in all tweets, that word will not have a major impact in predicting the output of the entire set.</p><p>So let&#39;s create a function to remove the less frequent words; Initially, we need to get the set of words into a flat list. (Flat List will look something like this: ‘said’, ‘plu’, ‘youv’, ‘ad’, ‘commerci’, ‘experi’, ‘tacki’, ‘’, ‘didnt’, ‘today’,)</p><p>Once the flat list is prepared, I have used the FreqDist function to count the words frequency. Then used the filter function to select only the words with more than 5 counts and less than 2000.</p><p>If the word is not repeated more than 5 times, we don&#39;t see the value of that word within a predictive model. Also when the word is repeated more than the usual it does not have a major say. This is basically called the removal of the outliers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0_1TNz4hjyzVQwqdLdV10A.png" /><figcaption>pic 14</figcaption></figure><p>Finally, I have saved the output into the data frame as the ‘ThirdDataSet’…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZhtYwc6rSgEbFVpprXn_Vw.png" /><figcaption>pic 15</figcaption></figure><p>Let&#39;s check if the number of unique words is reduced compared to the previous count. Earlier it was 13235 (pic 13). It&#39;s been reduced to a sum of 2900 now. Which is a good number to apply to modeling?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*s7tgBVuQ7z0Pjcv-xhs68g.png" /><figcaption>pic 15</figcaption></figure><h4>Feature Extraction</h4><p>Basically what we do in ML is, input X axis and Y axis and then predict Y’ for new X’ data. When applying text into ML algorithms we cannot apply the X and Y axis in text format. By now you have to understand that all we did was to create a proper X axis to pass into an algorithm. Usually, the Y-axis will be the target variable and X is the source.</p><p>Given our example, Y-axis it the ‘Sentiment’ column and the X-axis is the ‘ThirdDataSet’. As said before, ML algorithms do not understand the text. Therefore we need to convert the set of words into numeric form. Specifically, vectors of numbers. There are a few ways to do this. For this study, I will be using a method called <strong>bag of words.</strong> This process is referred to as the feature extraction.</p><p>Understanding the BoW concept is important. Hence I have copied a simple explanation from the web here. (original can be viewed from here <a href="https://machinelearningmastery.com/gentle-introduction-bag-words-model/">https://machinelearningmastery.com/gentle-introduction-bag-words-model/</a>)</p><blockquote>Below is a snippet of the first few lines of text from the book “<a href="https://www.gutenberg.org/ebooks/98">A Tale of Two Cities</a>” by Charles Dickens, taken from Project Gutenberg.</blockquote><blockquote><em>It was the best of times,<br>it was the worst of times,<br>it was the age of wisdom,<br>it was the age of foolishness,</em></blockquote><blockquote>For this small example, let’s treat each line as a separate “document” and the 4 lines as our entire corpus of documents.</blockquote><blockquote>The unique words here (ignoring case and punctuation) are:</blockquote><blockquote>“it” “was” “the” “best” “of” “times” “worst” “age” “wisdom” “foolishness”</blockquote><blockquote>That is a vocabulary of 10 words from a corpus containing 24 words.</blockquote><blockquote>The next step is to score the words in each document.The objective is to turn each document of free text into a vector that we can use as input or output for a machine learning model.</blockquote><blockquote>Because we know the vocabulary has 10 words, we can use a fixed-length document representation of 10, with one position in the vector to score each word.</blockquote><blockquote>The simplest scoring method is to mark the presence of words as a boolean value, 0 for absent, 1 for present.Using the arbitrary ordering of words listed above in our vocabulary, we can step through the first document (“<em>It was the best of times</em>“) and convert it into a binary vector.</blockquote><blockquote>The scoring of the document would look as follows:</blockquote><blockquote>“it” = 1 “was” = 1 “the” = 1 “best” = 1 “of” = 1 “times” = 1 “worst” = 0 “age” = 0 “wisdom” = 0 “foolishness” = 0</blockquote><blockquote>As a binary vector, this would look as follows: [1, 1, 1, 1, 1, 1, 0, 0, 0, 0]</blockquote><blockquote>The other three documents would look as follows:</blockquote><blockquote>“it was the worst of times” = [1, 1, 1, 0, 1, 1, 1, 0, 0, 0]</blockquote><blockquote>“it was the age of wisdom” = [1, 1, 1, 0, 1, 0, 0, 1, 1, 0]</blockquote><blockquote>“it was the age of foolishness” = [1, 1, 1, 0, 1, 0, 0, 1, 0, 1]</blockquote><p>What do u need to understand from the above extraction? Well for now if you have understood that we need to pass two data sources when creating the BoW, that&#39;s enough. Two sets of data beging 1. Unique List of words 2. Corpus document which will contain sentences.</p><p>As seen in pic 16, I have first created the list of unique words based on the ‘ThirdDataSet’ using the set function. Next, I have created a function to convert the tokenized documents into a list of string documents. (I have done something extra, which is to remove the numbers from the words list… ideally, this has to be done during the cleaning stage)This is because the CounterVectorizer method needs a list of strings and not tokens.</p><p>Next up after creating the two inputs, I have printed the same for your reference below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*XzyCA8lhWE2QbU61zUKXNw.png" /><figcaption>pic 16</figcaption></figure><p>Next up we will start preparing the feature array. Let&#39;s import the CounterVectorizer and initialize the data frame with the two inputs we created above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*-Xwb0klmyubeAbc9Nwo15Q.png" /><figcaption>pic 17</figcaption></figure><p>When I print using the print(countvectorDF[:10]), you can see the features are printed as columns. (Its a mistake from my end not to remove some words like 11th, 13th etc.. but then again I can argue it has to be there… lets proceed as it is for now) Row numbers are the ‘documents’ or the list of sentences, if the word is present 1 will be marked in front. eg : document no 1 contains only ‘said’.</p><h4>Model Building</h4><p>So the feature list is created now. As I mentioned above we were in the process of creating an X-axis and a Y-axis for the model input. By now we have created our X; usually, the independent variable is considered as the X-axis.</p><p>What would be our depended variable or the Y-axis? Well, its the Sentiment column as mentioned before. If you look at the pic 18 below, this will be understood clearly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*F42Vmjg6jeemA_NgXj25DQ.png" /><figcaption>pic 18</figcaption></figure><p>X and Y are ready. whats next? we need to split the data into training and testing data. To understand model performance, dividing the dataset into a training set and a test set is a good strategy. Let’s split dataset by using function train_test_split(). You need to pass 3 parameters <em>features, target, and test_set size</em>. Additionally, you can use random_state to select records randomly.<br>test_set is configured as 20%</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*8ZViAJ7n5GK_My8TQcLAqg.png" /><figcaption>pic 19</figcaption></figure><p>Next, import the Logistic Regression module and create a Logistic Regression classifier object using LogisticRegression() function.</p><p><em>Logistic Regression is a Machine Learning classification algorithm that is used to predict the probability of a categorical dependent variable</em>. In logistic regression, the dependent variable is a binary variable. In other words, the logistic regression model predicts P(Y=1) as a function of X.</p><p>As seen below the train data set of X and Y is passed for the model to train. Next, the testing data set of features are passed into the model to get the predicted sentiment(y_pred)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*mrBSuyqNOJIij5Acyca2mQ.png" /><figcaption>pic 20</figcaption></figure><p>Next up we will see the accuracy of the prediction using the actual test data portion of sentiment.</p><h4>Model Evaluation using Confusion Matrix</h4><p>A confusion matrix is a table that is used to evaluate the performance of a classification model. You can also visualize the performance of an algorithm using this. The fundamental of a confusion matrix is the number of correct and incorrect predictions are summed up class-wise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*EvWzTGV4tNDaA6R2Mfi6XA.png" /><figcaption>pic 21</figcaption></figure><p>As seen there are 1659+345+288 correct responses. Likewise there are 147 + 43 + 51 + 196 + 77 + 62 predictions are wrong when compared with the actual.</p><h4>Evaluating the Result using Classification Report</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*BQ289YZJqOt7p4w81NMxzQ.png" /><figcaption>pic 22</figcaption></figure><p>Interpretation: <strong>Accuracy</strong>, defines the number of predictions which are made correct compared to the total number of predictions. Here we have got a 78% accuracy which is fair. <br><strong>Precision </strong>referrers to the total number of sentiment predictions which are actually correct over total predicted sentiment. <br><strong>Recall </strong>is, the total number of sentiment predictions which are actually correct over the total correct predicted sentiment.</p><p>The F-beta score can be interpreted as a weighted harmonic mean of the precision and recall, where an F-beta score reaches its best value at 1 and worst score at 0.</p><p>Hope this was useful and worth the time… I will be planning to write up in the below topics in a later post.</p><ol><li><em>apply a Logistic Regression model using feature extraction algorithm TfidfVectorizer. (later)</em></li><li><em>Compare the output of each model above. (later)</em></li><li>apply SVM(support vector machine predictor) to <em>bag of words (CountVectorizer) and compare the output with No6 above. (later)</em></li><li>apply SVM(support vector machine predictor) to <em>bag of n-grams model and compare the output with No7 above. (later)</em></li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fb2a0d6%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2Fb2a0d6%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href">https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0eeaeffd19a" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/sentiment-analysis-on-customer-tweets-nlp-c0eeaeffd19a">Sentiment Analysis on Customer Tweets( NLP)</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Science and Banking]]></title>
            <link>https://donduminda.medium.com/data-science-and-banking-d61eca05e7be?source=rss-83223c8be23e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d61eca05e7be</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[banking]]></category>
            <category><![CDATA[transactions]]></category>
            <category><![CDATA[predictive-analytics]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[DonDuminda]]></dc:creator>
            <pubDate>Tue, 13 Nov 2018 06:17:38 GMT</pubDate>
            <atom:updated>2019-01-01T08:40:27.752Z</atom:updated>
            <content:encoded><![CDATA[<h3>Data Scientists in Banks</h3><p>Well this is more like why do you need to hire a data scientist for every bank. As of now with the emergence of Big Data Tech many banks have adhered to this concept of hiring data science grads and its more like a trend in countries like Singapore. In countries like Sri Lanka, its definitely an upward tread but there is a lot of catching up.</p><p>The objective in hiring a Data Scientist is all about cutting cost and identify new revenue patters. More simply said; its about searching avenues for new money and fine tune the existing processes. To be a Data Scientist in the banking domain, an individual has to be really good with domain knowledge. Given a field like banking, domain knowledge is a key.</p><p>If you are curious about money, how its created and valued, the role of a merchant bank when compared to the central bank etc…and got the right tech skills, you should seriously consider your self being a Data Scientist. Capability to dig into data in a way which no one has never done and identify patterns which anyone never imagined of can do wonders to an organisations like banks.</p><p>Traditionally the management will have access to reports on daily occurrences of past activities. eg: Transitional Info, Customer Usage , Terminal Usage. Business Intelligence teams will evaluate these and will make predictions for the next quarter. It may work or it may not, which a certain individual cannot guarantee. Also the source for the report may not have all the information captured due to complexions. Eg: most Reports are generated in software systems based on structured date. Which is from data stored in a relational data bases.</p><p><em>(most people misunderstands big data as the increase of data overtime in a RDBMS,Big data technology does consider structured data but its more into tapping into untapped data sources like logs ; dumps; archives)</em></p><p>In other words, only about 10% of data generated from customer activities are converted to structured from and saved in a RDBMS. The rest will be saved as logs or dumps. Usual SQL language which is mostly used for report generation will capture only the data saved in Tables. The rest will not be used or wasted.</p><p>How can an data scientist help you with all these? Firstly the number of sources will increase. He or she can will check for the simplest activities reading logs,dumps and also RDBMS. Also the predictions will be done with vast amounts of source information unlike previously and given with a guaranteed accuracy rate. In very simplest form, a data scientist can give you the expected outcome of the next day, week or month with an accuracy of 90% or more.</p><p>As a CEO of a bank, what you really need to think is, if your data science team can save you more, than what you pay them or earn you more than what you pay them, then its a win for you.</p><p>As per what I have read on the internet most banks who does not want to hire a data science team, thinks that purchasing a BI tool (comes with huge price tags) will solve all these. Machine Learning Systems or BI systems are not like software solutions. Example, you can get your ATM switching software from the same vendor which Bank X uses. But its not easy to plug in a machine learning product since each bank has a different customer bases, different visions and missions, different revenue models etc.</p><p>As an example, X Bank has the most customers, which means the number of accounts are high, but does that mean they have the most savings ? No. Y Bank has acquired the most number of ATM transactions, does that mean they have the biggest customer base? No.</p><p>So my point is, the behavior of each bank is different from the other.. So does the BI team. Therefore the predictive models has to be custom made… at-least till you get the hang of it and your data science team recommends you to do otherwise.</p><p>few areas where a data scientist can do wonders in terms of costs and revenue gain are given below..</p><ul><li>Forecasting ATM cash demand.</li><li>Prevent fraud in Transactions.</li><li>Predictive Maintenance for all Systems. (Including Banking Applications,DB Software and Hardware)</li><li>Predictive Analytics in Customer behavior, personalized banking.</li><li>Target Marketing.</li><li>Identify new Revenue Patterns within Existing Models.</li></ul><p>Well these are very high level categories and each and every category can be segregated into 4–5 sub sections. First three categories are mainly for cost-cutting and the last 3 are a mix of cost cutting and gain additional revenue.</p><p>I will be hoping to discuss each section in detail later. Leave your thoughts below….</p><p>Reference :</p><p><a href="https://medium.com/datadriveninvestor/big-data-analytics-in-the-banking-sector-b7cb98d27ed2">https://medium.com/datadriveninvestor/big-data-analytics-in-the-banking-sector-b7cb98d27ed2</a></p><p><a href="https://bigdata-madesimple.com/role-big-data-banking-industry/">The Role of Big Data in the Banking Industry</a></p><p><a href="https://www.evry.com/globalassets/insight/bank2020/bank-2020---big-data---whitepaper.pdf">https://www.evry.com/globalassets/insight/bank2020/bank-2020---big-data---whitepaper.pdf</a></p><p><a href="https://thefinancialbrand.com/64166/banking-big-data-advanced-analytics-ai/">https://thefinancialbrand.com/64166/banking-big-data-advanced-analytics-ai/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d61eca05e7be" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>