<?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 Biniyambelayneh on Medium]]></title>
        <description><![CDATA[Stories by Biniyambelayneh on Medium]]></description>
        <link>https://medium.com/@biniyambelayneh376?source=rss-cfd24bd8d53e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8yizc6FHfjaMEvOU</url>
            <title>Stories by Biniyambelayneh on Medium</title>
            <link>https://medium.com/@biniyambelayneh376?source=rss-cfd24bd8d53e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 08:48:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@biniyambelayneh376/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[Understanding AWS Services]]></title>
            <link>https://medium.com/@biniyambelayneh376/understanding-aws-services-86362b4687d6?source=rss-cfd24bd8d53e------2</link>
            <guid isPermaLink="false">https://medium.com/p/86362b4687d6</guid>
            <category><![CDATA[iaas]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[paas]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Biniyambelayneh]]></dc:creator>
            <pubDate>Fri, 06 Jan 2023 23:10:46 GMT</pubDate>
            <atom:updated>2023-01-18T20:10:22.627Z</atom:updated>
            <content:encoded><![CDATA[<h4>High Level Exploration of AWS Services</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H--5dZTykDrmft-2s_SMgw.png" /></figure><h3>Introduction</h3><p>This tutorial is the continuation of the cloud computing and AWS series I have started earlier. If you haven’t read the first part you can find the link <a href="https://medium.com/@biniyambelayneh376/quick-introduction-to-aws-d43c899ceed2">here</a>. The first part discusses some basic cloud computing concepts and walks you through the steps of creating an AWS account.</p><p>In this blog post, I will be going a little deeper into the AWS services and discuss how one can use the services for their own personal needs. After these post I will go deeper into access management services like IAM service and Cost management services.</p><p><strong>The goal of these post is to help you understand the basic idea behind AWS services and help you select the right service for the right job.</strong></p><h3>Content</h3><ul><li>It is all about applications</li><li>Introduction to AWS services</li><li>How to chose the right AWS service</li></ul><h3>It is all about Applications</h3><p>Before I start discussing AWS services lets take a look at the different computer related tasks people have, and then we will see how the AWS services can handle those tasks.</p><p>whether you are a software engineer, machine learning engineer, or data engineer, the ultimate goal is to create an application, or a pipeline that some group of people use for a specific purpose. Some applications are used for work purpose, some for education, or some even for entertainment. whatever the purpose, the engineers want to create the application, test it, and deploy it on the internet as a downloadable file or a web application.</p><p>AWS services can assist the engineers at every level of the application development and deployment process. in AWS there is a <a href="https://medium.com/@biniyambelayneh376/quick-introduction-to-aws-d43c899ceed2#:~:text=AWS%20Services%3A,different%20programming%20languages.">service</a> for</p><ul><li>Application development (programming infrastructure). a service that you can access over the browser to actually write a code in and run it.</li><li>Application testing</li><li>And Application deployment.</li><li>and so much more</li></ul><p>Basically anything you can do on your local computer, you can also do using AWS services.</p><h3>Introduction to AWS Services</h3><p>we can classify AWS services in two different ways: based on function and based on level of management.</p><h4>Based on Level of Management</h4><p>AWS Services range from virtualized hardware services that give you complete control over the software stack to a set of specialized tools and applications you can use to develop your application all the way to standalone applications you can directly use without the need to develop any application yourself. Keep in mind that AWS services that you use to manage your resources and account in AWS don’t actually belong anywhere on the line below. The line below only applies to AWS services that can be used for your own business uses or your company’s</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*wpDTt74aAsww_vtFtFAe3g.png" /></figure><ul><li>Iaas: services that give you virtual access to hardware resources: compute, storage, and networking.</li><li>Paas: services that provide application developers with pre-configured, highly scalable tools for application development, maintenance, and deployment. These services are built on top of Iaas services.</li><li>Saas: Applications developed and maintained by AWS and deployed as a service for end users.</li><li>Caas(container as a service): these are services that provide a container deploying platform. Personally, I would classify services belonging in these category as Paas because Caas services are built on top of Iaas services and they are made to assist the development of applications just like Paas services.</li></ul><p>The above picture represents all the services in AWS and how they compare to one another. As we go in the direction of the arrow, more and more of the aspects of the services on the line become managed by AWS.</p><p><strong>What do I mean by managed exactly?</strong> To explain that easily let’s take a closer look at what developers would have done locally without using cloud services.</p><p>let’s say a developer wants to develop a web application; Here is a list of general steps the developer can take to setup the required application development and deployment tools.</p><ul><li>Get a computer with a decent hardware specs that fits your specific application needs (RAM, CPU, GPU etc…)</li><li>Install an operating system if one didn’t come with the computer</li><li>Setup the required tech stack.</li></ul><blockquote>A <strong>tech stack</strong> is the combination of applications a developer uses to build and run his/her own application or project. Sometimes called a “solutions stack,” a tech stack typically consists of programming languages, frameworks, a database, front-end tools, back-end tools, and applications connected via APIs.</blockquote><p>Your tech stack will include software that help you write the code, interpret/compile the code, and provide your code with necessary computational and data provision support at run time. furthermore, while your code is running, you could have other applications running along with it to help you monitor the execution of your application and give you insight about its performance.</p><p>Now let’s see how the AWS services fit in this general picture. AWS has a service you can use to allocate the required hardware specs you need just like getting a physical computer only this time you can change the specs to whatever you want at any time with a push of a few buttons. the AWS EC2 (elastic compute cloud) service is what you use to create the virtualized hardware resources you need. This resource is called a virtual machine.</p><blockquote>Remember, services are what you use to create resources, and resources are what you use to do your work.</blockquote><p>Once you have your virtual machine resource, you can go about installing your operating system on it and all the tech stack we mentioned above by following the same general steps as you would when working locally on your physical computer with some minor differences.</p><p>This service (AWS EC2) falls to the left most side of the managed services line shown above, and this type of services are called Iaas (Infrastructure as a service) service. It is the least managed service. AWS just manages the physical infrastructure for you and you will be responsible for the complete setup of the software stack on the virtual machine.</p><p><strong>But AWS can do you one better,</strong> Since the application development process has multiple predictable tools and steps, AWS has taken the step to create more services that manage and automate these common development tools and steps for you. that means instead of setting up every tech stack software you need for your development manually from third party providers, AWS has prepared services you can use to easily provision application development environments easily. For example, instead of installing your own RDBMS (relational database management systems) like Postgres and Mysql manually on AWS EC2 instance, AWS has prepared a managed database service called RDS (Relational Database Service), which is a highly scalable, fully managed, very secure database managing service.</p><p>You can use RDS to easily create a database for your application using whatever engine you like (Mysql, Postgres, etc…) without having to install the RDBMS tools yourself.</p><p>AWS has multiple other services just like RDS that simplifies the application development and deployment process. These services are built on the Iaas services we have discussed before. the difference is that we no longer have to install some common third party software to setup our development and deployment environments ourselves.</p><p>These types of services that eliminate the need to install and manage our own application development and deployment tech stack fall in the middle of the managed services line shown above, and they are called Paas (Platform as a service) services.</p><p>Not only the application development process has some steps and tools that can be automated, but there are some types of common end user applications people use for their work and personal lives, So AWS has completely removed the need to develop an application of our own at all and just use an already deployed applications directly for some very common use cases. For example: we have a Customer Relationship Management (CRM) application and an Enterprise Resource Planning (ERP) application that organizations can directly use without the need to develop their own specialized versions of these applications removing the need to hire a software developer for these particular issues.</p><p>These applications fall to the right most side of the managed service line shown above. and they are called Saas (Software as a service) services. AWS manages everything about these type of services. You as a user, only need to bring your data with you and start using the applications.</p><blockquote>Note: some services in AWS don’t necessarily fall neatly into the three categories of service management levels. The main Idea you should take from these section is that there are variable levels of management for services provided by AWS. Personally, I define Pass services as services that already come with an application that you want to use for your own app development already installed. and When you are personally responsible for installing and setting up all the tech stack you need for your app development, I call that using Iaas service.</blockquote><h4>Based On Function</h4><p>Another way of classifying AWS services is based on functional categories.</p><ul><li><strong>AWS management services: </strong>These help the account owner understand and control what happens in the account, which includes managing cost and usage of services and resources within the account; enabling the AWS account owner to manage access to the services and resources within the account and other governance related tasks. This also includes Various services used to monitor AWS resources, applications and multiple AWS accounts. Services in here provide information about and control over your AWS resources as well as accounts.</li><li><strong>Compute services:</strong> Iaas or Paas services that provide access to virtual machines and containers that provide basic computer hardware functionalities like memory, CPU, GPU, and networking for your applications. Almost all the other services are built on top of compute services, and your applications will almost always use one of these services or other specialized ones that are built on top of these services. Examples: EC2, ECS, Lambda, and EKS services.</li><li><strong>Storage services:</strong> These are Iaas services. object, file and block storage services that provide a place to store data in various ways to meet different data reading and writing needs. Examples: S3, EBS, EFS, and others. There are also other supporing services with storage services that assist the movement of data in and out of the storage services.</li><li><strong>Database services:</strong> provide variety of Paas services that provide managed purpose-built databases for both nosql and sql data.</li><li><strong>Networking services:</strong> these are Iaas services that help you setup a network in which you can put your AWS resources (ec2 instances and services built on top of them). the purpose of networking is to control data flow into and out of your aws resources. Storage services like s3 are not going to be placed inside a private network created by networking services. Because they are public services intended to stand alone. so they have their own data flow and access control system. Examples: VPC, ELB, and others.</li><li><strong>Business application services:</strong> These are Saas services designed to provide direct service to end users.</li><li><strong>Other Specialized services:</strong> These are mostly Paas services that are built on top of the other services and different tools are configured on them to prepare a suitable environment for a specific type of application development, data processing, and machine learning tasks. Examples: Analytics, machine learning, internet of things, robotics, application integration, and some others. for a complete list of products, refer <a href="https://aws.amazon.com/products/?aws-products-all.sort-by=item.additionalFields.productNameLowercase&amp;aws-products-all.sort-order=asc&amp;awsf.re%3AInvent=*all&amp;awsf.Free%20Tier%20Type=*all&amp;awsf.tech-category=tech-category%23cost-mgmt">here</a>.</li></ul><h3>How to Choose the right AWS service?</h3><p>In order to effectively use AWS services for your application development and deployment, here is a general step you can follow.</p><ul><li><strong>Plan</strong>: determine what you need to develop your application and what your application needs to run. Here, you are expected to determine exaclty what kind of tech stack you would use to develop your application locally, and then, you can decide to configure that tech stack yourself on an Iaas AWS service or find a pre configured Paas service that simplifies your burden as a developer. While choosing a service make sure to compare various alternative options to find the most affordable AWS service and subscription to satisfy your need. AWS has Saas services that are made for these particular purpose: price identification and cost management ( we will discuss these services in detail in the coming posts).</li><li><strong>Create</strong>: create all the AWS resources you need using the services you determined above.</li><li><strong>Deploy</strong>: develop and deploy your application using the resources you created above.</li><li><strong>Track</strong>: track the performance of your application as well as the cost and usage level for the AWS resources you are using to develop and run your application. These is where cost and usage management services become very important.</li></ul><p>In each of the above steps, you have a number of AWS services at your disposal to assist you in making a decision.</p><h3>Conclusion</h3><p>In these post I have discussed various categories of AWS services. Two different ways of classifying AWS services was shown — management based and function based classification. The ultimate goal of knowing the different categories of the services is to help you determine where to start looking for an AWS solution for your particular application development scenario.</p><p>I hope you have learned something. Please leave a comment!</p><h3>Reference</h3><ul><li><a href="https://aws.amazon.com/products/">Cloud Products</a></li><li><a href="https://magenest.com/en/aws-iaas-paas-saas/">An overview of Amazon Web Services: IaaS, SaaS and PaaS</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86362b4687d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick Introduction To AWS]]></title>
            <link>https://medium.com/@biniyambelayneh376/quick-introduction-to-aws-d43c899ceed2?source=rss-cfd24bd8d53e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d43c899ceed2</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Biniyambelayneh]]></dc:creator>
            <pubDate>Mon, 02 Jan 2023 20:24:31 GMT</pubDate>
            <atom:updated>2023-01-02T20:27:13.961Z</atom:updated>
            <content:encoded><![CDATA[<p>getting started with cloud computing and AWS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*2rZ5FhUabpPhFPN8V7O_JA.jpeg" /></figure><h3>Introduction</h3><p>In this article and subsequent others, I will be sharing the knowledge I have acquired on cloud computing in general and specifically the AWS cloud platform. Now a days, especially for machine learning engineers, data engineers, and data analysts, cloud computing is becomming indespensable part of their dialy work. So having at least the basic understanding of cloud computing is quite important.</p><h3>Cloud Computing</h3><p>Cloud computing is the provision of computer hardware and software resources as a service over the web.</p><p>In other words, as long as you have a computer that has a browser and good internet connection, you can access and run any computer program on the cloud just like you can on your computer. The difference is when you are using a cloud service, the program or application you run on it is not limited by the capacity of the computer you are using to access the cloud service.</p><blockquote><strong>The Cloud:</strong> servers that are accessed over the Internet, and the software and databases that run on those servers</blockquote><p>So basically, by using a really cheap laptop or desktop computer, you will be able to execute any workload you can think of; whether it is a very high gpu and cpu demanding machine learning task, creative design work, or even just running any game you want is possible using cloud computing. That is pretty darn cool if you ask me!!</p><p>And the best part of all these is that you can only pay for what you use. They call these the<strong> pay-as-you-go model of payment</strong>. There are also subscription models too. But I am getting ahead of myself.</p><p>Anyways, cloud can be private or public. A public cloud sells services to anyone on the internet. A private cloud is a proprietary network or a data center that supplies hosted services to a limited number of people. These basically tells us who has access to the services.</p><p>So what kind of services can you get from cloud computing? Cloud computing services can be classified into three categories: infrastructure as a service (IaaS), platform as a service (PaaS) and software as a service (SaaS).</p><ul><li>Iaas: these are compute, storage, and network resources.</li><li>Paas: provides a framework for application creation and deployment. Paas is built on Iaas services.</li><li>Saas: web-based software deployment model that makes the software accessible through a web browser.</li></ul><h3>AWS</h3><p>Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted public cloud platform, offering over 200 fully featured services from data centers globally. In these and subsequent posts, I will be briefly discussing the AWS cloud platform. Without further ado, lets get started.</p><blockquote><strong>AWS Services: </strong>the different functionalities AWS serves to customers. customer’s interact with Services through API calls. these API calls can be sent using three different methods: AWS console (web based tool), AWS CLI(command line interface just like bash), and AWS SDKs for different programming languages.</blockquote><p>I am going to be taking a hands on approach, so I will try my best to take you through the different cloud computing concepts in AWS step by step starting from creating AWS account.</p><h3>Getting Started With AWS</h3><p>the first thing we need to do is create AWS account</p><blockquote><strong>AWS account: </strong>An AWS account is a container for your AWS resources. You create and manage your AWS resources in an AWS account. for any paid services you use in your account the bill for the services will be addressed to the account.</blockquote><blockquote><strong>AWS Resources:</strong> for beginners, the difference between an AWS resource and service might be a bit confusing, but in short AWS resource is anything a user creates inside an AWS account using a given AWS service. For example, Using the IAM service one can create IAM users, so IAM is the service and the created users are the resources. as mentioned above, we use API calls to interact with services and create and manage resources.</blockquote><p>First Lets Create AWS account.</p><p>in order to create an AWS account you need to have the following</p><ul><li>working email address</li><li>a debit card or credit card with 1 us dollar in it.</li><li>5 minutes of your time.</li></ul><p>Step 1: go to the <a href="https://portal.aws.amazon.com/billing/signup#/start/email">AWS signup</a> web page and fill in your email and account name. your account name can be anything you want. and on the follow up page provide a strong password for your account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KhtmlBOjtSD2LRRF1vzEvg.png" /><figcaption>aws signup page</figcaption></figure><p>Step 2: provide your contact details</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vh0QtaEOoig-CZ7yxJ7qbQ.png" /><figcaption>aws contact information form</figcaption></figure><p>Step 3: provide your debit or credit card information. AWS will not charge you anything at this stage, but they will hold 1 us dollar until they verify your identity. AWS uses the information you provide here for billing you later on if you use paid services outside the free tier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lJLD3M66HF--QkFjSyUWFg.png" /><figcaption>AWS billing information form</figcaption></figure><p>Step 4 complete the verification steps that follow, and you will finish creating your account. for the purpose of these tutorial, don’t forget to select the free plan. once you finish the verification and plan selection process you should see the following page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QiSqMIB4C9SX5TA6W7xtlg.png" /><figcaption>account creation completion</figcaption></figure><p>Step 5: Once you finish creating your account, you need to login as a root user using the email address and password you used to create your account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S5dFbprc0sfgRV_hSP1QJQ.png" /><figcaption>login page</figcaption></figure><p>Congratulations, now you can access what ever AWS services you want and different AWS learning resources as well to help you understand the services.</p><p>by the way, there are a number of free aws services you can use without incurring any chargs whatsoever. some of these free services are free only for the first 12 months of newly created account and others are always free. before you start using any aws service you need to clearly understand its cost information. I will show you how you can check weather a service is free or not and also show you how you can manage your spending on aws in future tutorials.</p><p>For now, you can explore the different free AWS learning resources and lab projects available through your account. In order to access these resources you need to login to the AWS <a href="https://login.us-east-1.auth.skillbuilder.aws/login?scope=openid%20email%20profile&amp;response_type=code&amp;client_id=7ci5c0bl3n2646khir5nfa6ash&amp;identity_provider=&amp;redirect_uri=https://explore.skillbuilder.aws/manage/v1/openidconnect/code">skill builder</a> platform using your AWS account credentials.</p><h3>Conclusion</h3><p>In these tutorial I have given you a short introduction to AWS and showed you the steps to create AWS account. In the coming few weeks we will be going deeper and deeper into the different AWS services together in a step by step manner.</p><p>Next, I will be discussing a couple of very essential AWS services: the IAM service and the IAM Identity Center service.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d43c899ceed2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a simple ELT Data Pipeline]]></title>
            <link>https://medium.com/@biniyambelayneh376/building-a-simple-elt-data-pipeline-71f69cd0ad89?source=rss-cfd24bd8d53e------2</link>
            <guid isPermaLink="false">https://medium.com/p/71f69cd0ad89</guid>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[etl]]></category>
            <dc:creator><![CDATA[Biniyambelayneh]]></dc:creator>
            <pubDate>Sat, 23 Jul 2022 17:54:20 GMT</pubDate>
            <atom:updated>2022-07-25T06:12:17.683Z</atom:updated>
            <content:encoded><![CDATA[<h4>building a data pipeline for traffic data</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VjOrB4RxHxSRTM4IkoMRsA.png" /></figure><h3>Business Context</h3><p>A city traffic department wants to collect traffic data using swarm UAVs (drones) from a number of locations in the city and use the data collected for improving traffic flow in the city and for a number of other undisclosed projects. We are responsible for creating a scalable data warehouse that will host the vehicle trajectory data extracted by analyzing footage taken by swarm drones and static roadside cameras.</p><p>The data warehouse should take into account future needs, organize data such that a number of downstream projects query the data efficiently. You should use the Extract Load Transform (ELT) framework using DBT. Unlike the Extract, Transform, Load (ETL), the ELT framework helps analytic engineers in the city traffic department setup transformation workflows on a need basis.</p><h3>The data pipeline</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UOOToBu0WPrDdJq2" /></figure><h4>Explanation</h4><ol><li>Data is extracted from the original data source (from csv file). At this point there will be some restructuring of the original form so that it can fit into a pandas data frame.</li><li>Data is given to the data loader python script.</li><li>The data is written to the source table in the warehouse</li><li>From the source table, DBT will load the data</li><li>DBT will run SQL models on the loaded data to generate 2 dimension and 2 fact tables. These 4 tables are our final forms.</li><li>Our final data forms will be loaded into Redash and visualized</li></ol><p>Airflow is going to play the role of orchestrating the process described above using a DAG script</p><h3>Used Technologies</h3><ul><li>Docker and Docker-compose</li><li>DBT</li><li>Airflow</li><li>Python 3.8</li><li>Redash</li><li>MySQL database</li><li>Visual studio code</li></ul><h3>Implementation</h3><h4>step 1</h4><p>In <a href="https://open-traffic.epfl.ch/index.php/downloads/#1599047632450-ebe509c8-1330">Downloads — pNEUMA | open-traffic (epfl.ch)</a> you can find a pNEUMA data: pNEUMA is an open large-scale dataset of naturalistic trajectories of half a million vehicles that have been collected by a one-of-a-kind experiment by a swarm of drones in the congested downtown area of Athens, Greece. Each file for a single (area, date, time) is ~87MB data.</p><p>download the traffic data you want to work with from the above link. You should see something like below when you navigate to the above website:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*kxWhbajQJO6mOMjlEvNqtA.png" /><figcaption><a href="https://open-traffic.epfl.ch/index.php/downloads/#1599047632450-ebe509c8-1330">pNEUMA</a> data selection specifier</figcaption></figure><p>Once you download your data (which is a csv file), store it in a folder called ‘data’.</p><h4>Step 2: Extraction</h4><p>Next, we will be creating the data extractor python script. create this script in a ‘scripts’ folder beside the data folder we created in step one. The goal of this script is to create a data frame that can be loaded into our warehouse using the mysql-connector-python library. the full script file is found <a href="https://github.com/benbel376/ELT_Pipeline_Project/blob/main/scripts/python/extractor.py"><strong>here.</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*JrpdFqnkSBjVXOdqYd25Hw.png" /><figcaption>extractor class</figcaption></figure><p>create a class named extractor (you can name it what every you want), and add a csv file loader method. mine is called, “load_csv.”</p><p>when you use this method to load your data you will see a result similar to shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*Ofl0I0oc_N8wPdiyznD_rA.png" /><figcaption>load_csv result</figcaption></figure><p>The loaded data has just one column where every data is stored. So we need to restructure this data frame into one that separates the different variable values into separate columns. we will use the “restructure” method to do that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*lAy4gje_dsYum6YXOFp88Q.png" /><figcaption>restructure method</figcaption></figure><p>when we run the method we see above, we will have the following result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*n9LiSgpc_a_-qPEqYlF7og.png" /><figcaption>extracted final dataframe.</figcaption></figure><h4>Step3: Load Into Warehouse</h4><p>We will be creating our warehouse using MySQL. the first table in our warehouse is called “Source” this will hold the data frame we extracted in the previous step.</p><p>For this step we will be creating another script that will communicate with our warehouse tables. the script file can be found <a href="https://github.com/benbel376/ELT_Pipeline_Project/blob/main/scripts/python/loader.py"><strong>here.</strong></a></p><p>First we will create connection with the mysql server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*Xnl0wjhG0chMF6tJek7Bhg.png" /><figcaption>connect to server</figcaption></figure><p>Then create your warehouse (which is just MySQL database in this case)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*Q5eKAVVel2QoXbTt2zpbTQ.png" /><figcaption>create database</figcaption></figure><p>After this, we will be creating a connection to the database above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*8Wqe0uJSWLGhBiZKI45kcA.png" /><figcaption>connect to database</figcaption></figure><p>Then, we will be creating a table and insert our data into this table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*Z0mCAAAufJjodAxLGZ6rQw.png" /><figcaption>Insert data</figcaption></figure><p>finally we will close the connection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*llam3Kz-_t5cG5wdmAgEEw.png" /><figcaption>Close connection</figcaption></figure><h4>Step 4: Data Transformation using DBT</h4><p>Our goal now is to create three new tables from our source table. one dimension table and two fact tables. These tables will be generated using dbt models.</p><p><strong>Our first model is dim_types.sql</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*QCVRmwd3Ddz1tNJYr9xwMw.png" /></figure><p>before creating the above model, we need to define our source using a source yaml file. for this project you can find the source yaml file <a href="https://github.com/benbel376/ELT_Pipeline_Project/blob/main/dbt_transform/models/traffic_models/schema.yaml"><strong>here</strong></a>. The dim_types model is going to generate a new table with only the types column and an associated ID.</p><p><strong>Second model: fct_summary.sql</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*7LwW_UEvFYRRtWT81CiEfg.png" /></figure><p>the second model will extract traveled_d and avg_speed of our data and create a new table</p><p><strong>Third model: fct_trajectory.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*hd0Wn5sJebyinfhX3LH7QA.png" /></figure><p>This last model is going to generate a table that will contain our trajectory information as a long string.</p><p>the lineage graph is going to look like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-V5YQakYuLBYh8KUJEDjeA.png" /><figcaption>Lineage Graph.</figcaption></figure><h4><strong>Step 4: Airflow Orchestration</strong></h4><p>Now we will try and connect each of the above steps using a dag script. <strong>Apache Airflow</strong> is an <a href="https://en.wikipedia.org/wiki/Open-source_software">open-source</a> <a href="https://en.wikipedia.org/wiki/Workflow_management_system">workflow management platform</a> for data engineering pipelines.</p><p>Airflow is written in <a href="https://en.wikipedia.org/wiki/Python_(programming_language)">Python</a>, and workflows are created via Python scripts. Airflow is designed under the principle of “configuration as code”. While other “configuration as code” workflow platforms exist using markup languages like <a href="https://en.wikipedia.org/wiki/XML">XML</a>, using Python allows developers to import libraries and classes to help them create their workflows.</p><p>The air flow we are expecting looks something like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*8KzCWn4qT31w5om-6yfb7g.png" /><figcaption>airflow dag</figcaption></figure><p>The full dag script can be found <a href="https://github.com/benbel376/ELT_Pipeline_Project/blob/main/airflow_/dags/workflow.py"><strong>here.</strong></a></p><h3>Conclusion</h3><p>In this short tutorial we have tried to build a simple pipeline using docker, dbt, airflow, and Redash. the pipeline is designed to collect data from the source specified in the first step above and put it in a form more suitable for further processing.</p><h3>References</h3><ul><li><a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04">How To Install and Use Docker on Ubuntu | DigitalOcean</a></li><li><a href="https://redash.io/help/open-source/setup/">Setting up a Redash Instance</a></li><li><a href="https://docs.getdbt.com/dbt-cli/install/overview">How to install dbt | dbt Docs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71f69cd0ad89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Refund By Location Dapp on Ethereum]]></title>
            <link>https://medium.com/@biniyambelayneh376/refund-by-location-dapp-on-ethereum-a25fd5ec65ce?source=rss-cfd24bd8d53e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a25fd5ec65ce</guid>
            <dc:creator><![CDATA[Biniyambelayneh]]></dc:creator>
            <pubDate>Sat, 16 Jul 2022 19:32:12 GMT</pubDate>
            <atom:updated>2022-07-18T08:43:07.136Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ShfQlIyQDpISVbVn.jpg" /></figure><h3>Abstract</h3><p>In this project, we will try to go through some important blockchain and Ethereum concepts and create a simple application using Ethereum smart contract.</p><blockquote>”Initially, I thought that Ethereum was a thing that would be used for people to write simple financial scripts. As it turns out, people are writing stuff like Augur on top of it.”</blockquote><blockquote><strong><em>– Vitalik Buterin</em></strong></blockquote><h3>Business Need</h3><p>This project aims at building an Ethereum-based dApp that has both the smart contract tested and deployed in a Testnet and a front end that will allow monitoring of the status.</p><p>The refund by location smart contract is aimed to be used when one party, for instance, an employer, agrees to pay another party, let’s say an employee, for being present in a certain geographic area for a certain duration. The employee’s phone sends its GPS location to a smart contract at a certain interval. Based on the pre-agreed contract codified in an Ethereum smart contract, a cryptocurrency payment is executed when all the agreed conditions are met.</p><p><strong>After some introductory concepts, we will go through the steps of creating the above application.</strong></p><h3>What is Ethereum?</h3><p>It is a decentralized blockchain platform that establishes a peer-to-peer network that securely executes and verifies application code, called smart contracts. Smart contracts allow participants to transact with each other without trusting central authority.</p><p>In Ethereum data is stored in blocks of the blockchain. Ethereum nodes store the actual binary data in a key-value storage system like LevelDB. Merkle trees are used inside the blocks of a blockchain as efficient representations of all transactions forming that block; this is useful because a block’s contents can then be validated using a single string of fixed length, and there is no need to store all individual transactions. Here’s a visual representation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*-jEvMTci5oEuw529" /><figcaption>Merkel Tree Inside each block</figcaption></figure><h4>Common terms</h4><p><strong>Accounts:</strong> The global “shared-state” of Ethereum is comprised of many small objects (“accounts”) that are able to interact with one another through a message-passing framework. Each account has a state<strong> </strong>associated with it and a 20-byte address. There are two types of accounts: <em>external accounts</em> (user accounts) and <em>contract accounts</em> (codes)</p><p><strong>Transaction: </strong>it is<strong> </strong>an agreed upon change of data from one state to another. The data may be conventional file data or specialized data such as ownership of currency. The transactions in a block are “atomic,” meaning they cannot be divided into smaller sets. Either all the transactions occurred, or nothing at all.</p><p><strong>State: </strong>The values of account variables at any given moment in time.</p><blockquote>To read in detail about the above concepts check this <a href="https://preethikasireddy.medium.com/how-does-ethereum-work-anyway-22d1df506369">link</a>.</blockquote><h4>Smart Contracts?</h4><p>A “smart contract” is simply a program that runs on the Ethereum blockchain. It’s a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain.</p><p>Smart contracts are a type of <a href="https://ethereum.org/en/developers/docs/accounts/">Ethereum account</a>. This means they have a balance and they can send transactions over the network. However they’re not controlled by a user, instead they are deployed to the network and run as programmed. User accounts can then interact with a smart contract by submitting transactions that execute a function defined on the smart contract. Smart contracts can define rules, like a regular contract, and automatically enforce them via the code. Smart contracts cannot be deleted by default, and interactions with them are irreversible.</p><h4>Networks in Ethereum</h4><p>Networks are different Ethereum environments you can access for development, testing, or production use cases. Since Ethereum is a protocol, there can be multiple independent “networks” that conform to the protocol without interacting with each other. for details check this <a href="https://ethereum.org/en/developers/docs/networks/#:~:text=Since%20Ethereum%20is%20a%20protocol,from%20the%20main%20Ethereum%20network."><em>link</em></a>.</p><p>summary of common test nets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/0*Aj-4uSiJjMclEWbe.png" /></figure><h3>Project plan</h3><p>In this project, we will try to build a <em>dapp</em> that allows employers to dispense some fund if the employees actually go and remain at an agreed upon location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*8u_fz8wJo3arb2HojUhb6g.png" /><figcaption>Implementation steps</figcaption></figure><h3>Used Technologies</h3><ul><li>React libraries (ethers.js)</li><li>Remix for developing and testing Ethereum smart contracts.</li><li>Rinkeby test network</li><li>Metamask wallet</li><li>Hardhat is used to deploy and test the smart contract.</li><li>Reactjs is used to create the admin panel.</li><li>React-native is used to create the mobile app.</li></ul><h3>Smart Contract Implementation</h3><p><strong>Step 1: Create a wallet at meta-mask</strong></p><p>Install Metamask in your browser by downloading the right extension for your browser and enable it. Once enabled, click its icon from top right corner and click on “Create Wallet” if you don’t already have an account that you want to use. Go through the steps and finish creating the the account. for more details on setting up, follow <a href="https://www.one37pm.com/nft/how-to-set-up-metamask-wallet">this</a>.</p><p><strong>Step 2: Chose your test net</strong></p><p>Select your preferred network. To make your choice you can check this <a href="https://blog.logrocket.com/top-4-ethereum-testnets-testing-smart-contracts/">blog.</a> I will be using Rinkeby Test Network. After chosing a testnet, go to that test net’s faucet and acquire some ether for your accounts. for rinkeby use the following <a href="https://faucet.rinkeby.io/">link </a>, and follow the steps specified on the page for getting the money.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*8Fl-ObISSc-MZlkLkSz_ow.png" /><figcaption>Ethereum Test Network Options</figcaption></figure><p><strong>Step 3: Create a new file on Remix</strong></p><p><a href="https://remix.ethereum.org/">Remix</a> IDE is <strong>an open source web and desktop application</strong>. Remix is used for the entire journey of contract development with Solidity language as well as a playground for learning and teaching Ethereum. Create an empty file by clicking “new file” from the home tab in remix editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W-IBCJX10MdqcK_2jvw_NA.png" /><figcaption>Remix IDE</figcaption></figure><p><strong>Step 4: Start writing the smart contract</strong></p><p>In our smart contract we will be creating the following variables and functions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*gvH6-WfdSz1AmMEJKe4hCg.png" /><figcaption>Composition of the smart contract</figcaption></figure><p><strong>Step 5: Define the variables</strong></p><p>As can be seen below, I am using solidity version 0.8.15, and the name of my contract is refunderContract.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*9OH9ZGGtoS4GvtSmnElpyg.png" /><figcaption>defining variables</figcaption></figure><p>The constructor will define the <em>owner </em>to be the person’s address that creates the constructor. A map called <em>contractInfo </em>will be created that holds each employee’s address added as a key and the the <em>contract_spec</em> as a value. <strong>The goal here is to associate specific set of parameters for each employee added.</strong></p><p><strong>Step 6: Create the employee adding function</strong></p><p>The add_employee function is a public function that can be called from outside the contract. It will take the following set of parameters as an input.</p><p><strong>Id</strong>: the address of the employee to add. <strong>lat: </strong>the latitude value of the center of the geographic boundary. <strong>lon: </strong>the longitude value of the center of the geographic boundary. <strong>rad: </strong>the radius of the geographic boundary. <strong>fund: </strong>amount of money to dispense upon fulfilment of the contract task in wei</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*NMvxC19XEFbUzE3R9nQGRg.png" /><figcaption>add_employee function</figcaption></figure><p><strong>Step 8: Create <em>check_position </em>function</strong></p><p>This function is a public function that will be called by employees to send their location at some set time and have their position checked and see if they are within the defined boundary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*Ga48SQdB6SiCAI9AnQbSbw.png" /><figcaption>check_postion function</figcaption></figure><p><strong>Step 9: Create supporting functions for</strong></p><p>The <em>check_existence </em>function is a private function that is only used in the contract by other functions. It will check if an employee has already been added or not and returns a Boolean value</p><p>The <em>sqrt </em>function is another private function used to calculate a square root of an input number. It is used in the <em>calculate_radius </em>function.</p><p>The <em>calculate_radius </em>function is also a private function used to calculate the distance of a certain position from the center of a certain boundary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*7KvpAYFdf7Z0yEdadnWgAw.png" /><figcaption>supporting functions</figcaption></figure><blockquote><strong>private functions: </strong>This functions are Ethereum smart contract functions that cannot be called from outside the smart contract. They are created to serve other functions in the smart contracts.</blockquote><h3>Frontend Implementation (employer side)</h3><p>First we will be creating the following application using react. The employer has the ability to add employees and pay them</p><p>add employee page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*y1Qa_BZACINOigzU5isbYQ.png" /><figcaption>add_employee page</figcaption></figure><p>The app will has three sections: employee address, geographic boundaries, and budget. in the geographic boundary section, the first two inputs are longitude and latitude respectively and the last input is radius from the center represented by the longitude and latitude specified above.</p><p>The page below is used to pay an employee a certain money at a certain point in time. The transaction will succeed if the employee has managed to fulfill his duty before the set time</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*xymq2Ir3l3UpByU2_2bZGw.png" /><figcaption>Pay employee page</figcaption></figure><p>Explaining the specific steps taken to create this application is too long for this post so it will be discussed briefly as follows. You can find the detail implementation in my <a href="https://github.com/benbel376/Ethereum_Dapp">GitHub</a>.</p><p>Install and import ethers.js to connect with the test net and communicate with the smart contract created earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*nboBag33KpOJmGN-c1uc2g.png" /><figcaption>library imports</figcaption></figure><p>The following function will create the connection with the test net and the smart contract. and return the smart contract object that can be used to call the functions we want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*GB8LNxlaM4OG7fM-VAscPQ.png" /><figcaption>contract connector</figcaption></figure><p>The <em>EmployeeForm</em>() function is responsible for creating the user interface and handling interactions with it. <strong>The goal here is to collect the employee specific parameter values along with the employee address and send to the smart contract.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*v5I5WCPPTDbL3oFJo4zCvw.png" /><figcaption>User interface creator and interaction handler</figcaption></figure><p>The return statement below holds the user interface features you saw above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*6uBfjqdB1TTmm1ZZdhc_SA.png" /><figcaption>The user interface for the first page</figcaption></figure><h3>Frontend Implementation (employee side)</h3><p>we will be implementing the following mobile application using react-native.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*89mGvMogFJlqfMjX2gZcfw.png" /></figure><p>The code below is used to acquire the location. the expo-location library is used for this function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*zNFF3U_iEjR60j5KKvvhQQ.png" /><figcaption>A react native application to graph a geolocation code</figcaption></figure><p>to make connection with the smart contract the code below can be used</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*DTDV11kg9vGj02qSp6tJmQ.png" /></figure><h3>Conclusion</h3><p>A web dapp and mobile dapp web3 application is done in connection with one smart contract to create a connection between an employer and employee in a way that allows the employer to add employees to the smart contract and track their location, which later can be used as a basis for dispensing some ether. and this application can be used for different purposes like attendance systems, transportation, and others.</p><h3>References</h3><ul><li><a href="https://docs.walletconnect.com/quick-start/dapps/react-native">React-Native | WalletConnect Docs</a></li><li><a href="https://blog.logrocket.com/react-native-geolocation-a-complete-tutorial/">React Native geolocation: A complete tutorial - LogRocket Blog</a></li><li><a href="https://dev.to/carlomigueldy/unit-testing-a-solidity-smart-contract-using-chai-mocha-with-typescript-3gcj">Unit Testing a Solidity Smart Contract using Chai &amp; Mocha with TypeScript</a></li><li><a href="https://preethikasireddy.medium.com/how-does-ethereum-work-anyway-22d1df506369">How does Ethereum work, anyway?</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a25fd5ec65ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web3 Dapp to Issue Weekly Challenge Completion Certification in 10-Academy]]></title>
            <link>https://medium.com/@biniyambelayneh376/web3-dapp-to-issue-weekly-challenge-completion-certification-in-10-academy-b962cf29f88d?source=rss-cfd24bd8d53e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b962cf29f88d</guid>
            <dc:creator><![CDATA[Biniyambelayneh]]></dc:creator>
            <pubDate>Sat, 18 Jun 2022 20:54:58 GMT</pubDate>
            <atom:updated>2022-06-18T20:54:58.842Z</atom:updated>
            <content:encoded><![CDATA[<h3>Project Context</h3><p>In this project, the client is 10 Academy; the client would like to solve the challenge of ensuring that certificates are available to all trainees in a secure way, and (if possible) that certificate holders can benefit from smart contract actions now and in the future.</p><p>At present, certificates are distributed as simple PDF files, without the ability to verify their authenticity nor can 10 Academy undertake smart actions with the trainees/their contracts. In this project you will build end-to-end Web3 dapps on the Algorand Blockchain that will help 10 Academy generate and distribute Non-Fungible Tokens (NFTs) as certificates that will represent the successful completion of a weekly challenge to trainees, and allow trainees with NFTs to interact with a smart contract to perform predefined actions.</p><h3>Background</h3><h3>Web 3.0</h3><p>Web 3.0 is still evolving and being defined, and as such, there isn’t a canonical, universally accepted definition. What is clear, though, is that Web 3.0 will have a strong emphasis on decentralized applications and make extensive use of blockchain-based technologies.Web 3.0 will also make use of machine learning and artificial intelligence (AI) to help empower more intelligent and adaptive applications.</p><blockquote>Many websites and nearly all applications in the Web 2.0 era rely on some form of centralized database to deliver data and help to enable functionality. With Web 3.0, instead of a centralized database, applications and services make use of a decentralized blockchain. With blockchain, the basic idea is that there isn’t an arbitrary central authority, but rather a form of distributed consensus.</blockquote><h3>Web3 technology stack</h3><p><strong>Network layer:</strong></p><p>the blockchain network. A blockchain is a digital ledger of transactions, maintained by a peer-to-peer network of nodes. This ledger also keeps track of on-chain data, such as account balances, smart contract code, and so on. While Web2 applications rely on centralized databases, Web3 applications are built on top of blockchain architectures for trust less and permission less access.</p><p>The blockchain is made up of blocks of data. Blocks are stored on distributed nodes. Each node in a blockchain serves as a “mini-server” that allows its operator to read/write blocks of data.Any blocks added to the blockchain must be propagated across all nodes on the network to be in sync.</p><p><strong>Interaction layer:</strong></p><p>This layer allows developers and users to read and write data to the blockchain. This is done through smart contracts. In the context of Web3, smart contracts function as the back end of an application. The smart contract defines application logic and controls the overall functionality of the application. Each time a smart contract function is called, it causes a change in the state of the blockchain network. Thereafter, the state change is accepted and broadcasted throughout the network of nodes. block explorers, are a key part of the blockchain interaction layer. For starters, they provide a window into the lower network layer and serves as an online resource for real-time and historical data retrieval about transactions, address balances,</p><p><strong>Presentation Layer:</strong></p><p>In many ways, the Web3 presentation layer closely mirrors many aspects of Web2 development.For the creation and development of front-end components, many developers turn to the time-tested React.js library. While blockchains provide a medium for decentralized state management, smart contract storage/execution, and transaction value, higher level applications require additional components. For front-end content like images, videos, and GIFs, blockchain storage is prohibitively expensive and inefficient. Decentralized storage fills in this gap.</p><p><strong>Application Layer:</strong></p><p>Applications that serve as the entry point for all manner of Web3 activities. To use a dapp, users will only have to connect their wallets or use a wallet-based ID service like SpruceID. Wallets are crucial for interacting with blockchain applications. Calling smart contract functions involves paying a fee to miners responsible for executing the transaction. Wallets allow users to store and send cryptocurrency, making them necessary for interacting with smart contracts.</p><h3>Algorand Blockchain</h3><p>Algorand (ALGO) is both a digital currency and blockchain platform. The Algorand platform is designed to process many transactions quickly, similar to a major payments processor like Mastercard or Visa. Algorand can host other cryptocurrencies and blockchain-based projects, making it a direct competitor to Ethereum. ALGO, the platform’s native currency, is used to secure the Algorand blockchain and pay processing fees for Algorand-based transactions. Algorand is an<a href="https://www.investopedia.com/terms/o/open-source.asp"> open-source</a> blockchain, meaning that anyone can view and contribute to the platform’s code. Algorand uses an operating protocol called pure<a href="https://www.investopedia.com/terms/p/proof-stake-pos.asp"> proof-of-stake</a> (PPoS), which recruits network operators from the entire pool of ALGO coin holders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/0*seK_CBmXnr0uH-q6" /><figcaption>Algorand stats</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/0*v7N1WVL-NdDVK4nX" /><figcaption>Algorand market cap in algos and dollars</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7TalMHmnImjBnvmV" /><figcaption>Transaction Volume Growth for different Blockchains.</figcaption></figure><h3>The Project</h3><h3>Technologies and Implementation</h3><p>The block chain network used for this project was Algorand. For development, a local private network was initialized</p><p><strong>Front-end</strong></p><ul><li>React</li><li>JavaScript</li><li>HTML</li><li>CSS</li></ul><p><strong>Back-end</strong></p><ul><li>Python scripts (Algorand Python SDK)</li></ul><p>The block chain network used for this project was Algorand. For development, a local private network was initialized. In the private network, there are already created three accounts that can be used to fund other new accounts and develop the application.</p><p>The application is going to be designed to have the following features: The applications will have three different web pages: login page, trainees page, and trainer’s page.</p><p>Trainees are able to perform the following tasks using the trainees page:</p><ul><li>send a request to 10-academy to receive a minted certification of completion.</li><li>Track the status of their request.</li><li>When their request is approved by 10-academy trainers and an NFT is generated for them specifically, they will be able to optin and receive the certificate.</li><li>After receiving the certificate they will be able to run another request, which is a request to access next week’s challenge document.</li></ul><p>Trainer’s are able to perform the following tasks using their page:</p><ul><li>Observe a list of requests for certifications from different trainees</li><li>Approve request, mint certification NFT, and send the NFT to a smart contract that will be able to redirect the NFT to the appropriate user when they optin.</li><li>When the trainees observe their approved status and optIn, the NFT will be automatically sent to their account from the smart contract.</li><li>Insert a link to next week’s challenge and set access requirement that must be met by the trainee who requests to have access to the resource.</li></ul><p>The major Implementations of the project are composed of the following:</p><p><strong>Login</strong></p><p>The login process is validated using a smart contract which is designed in the login_contract.py file of the project. The github link to the project is this. The login smart contract basically takes the address of the account trying to login and checks whether the address is one of a list of approved addresses saved as trainers of 10-academy. If the address is not among the approved list of addresses, the login contract will load trainees page otherwise it will load the trainers page.</p><p><strong>NFT issuance</strong></p><p>NFT creation: the created NFT must be created from one an image that holds the following information: The name of the certificate recipient, the week’s challenge, date of issuance, and the name of certificate issuer. For this project the NFT creation and Transaction process was implemented using algorand’s javascript SDK. The application is only designed to generate NFT, not the actual certificate image. That is one drawback of the project.</p><p>NFT Transfer: Since the sender of assets like NFTs that can take up storage space cannot simply send the asset to the receiver without the receiver’s approval, The receiver must OptIn to receive the asset after the NFT is created. But In order to avoid having to wait for the certificate recipient to Optin, a smart contract was created to temporarily store the created NFT and transfer it to the trainee when he/she Optin to receive it.</p><h3>Learned Lessons</h3><p>The foundational working principles of blockchain</p><ul><li><strong>Distributed Database: </strong>Everyone on a blockchain has access to the whole database with its history, No single party controls the information or the data. All parties can authenticate the records of its transactions directly without an intermediary.</li><li><strong>Peer-to-peer networks: </strong>Communication occurs directly between peers instead of through a central node. Each node stores and forwards the information to all other nodes.</li><li><strong>Computational Logic:</strong> Blockchain transactions can be tied to computational logic and in essence programmed. (smart contracts)</li><li><strong>Consensus Protocol:</strong> new blocks should be validated by nodes, and they follow some methods to verify the correctness of the blocks. Only when the nodes reach a consensus is a new block is added to the chain. (proof of work and proof of stake)</li><li><strong>Immutable Ledger: </strong>Once a transaction is added into the block chain and the state of the accounts involved are updated, the records cannot be altered, because they are linked to every other transaction in the block chain. (this increases security)</li><li>Others…</li></ul><p><strong>How a blockchain works:</strong></p><p>The basic process is summarized in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/0*C2KuXBVQgECouQYE" /></figure><p><strong>How Algorand differs from other blockchains.</strong></p><p>Three problems are plaguing the cryptocurrency industry — scalability of the network, speed of transactions and security of the network. Major cryptocurrencies like Bitcoin and Ethereum have been trying to solve the speed and security issue to some extent but the one thing that is still left to be addressed is the scalability of the network which is measured by transactions per second or TPS. “Algorand is a smart contract platform trying to solve the blockchain trilemma (scalability, decentralization, security) and help democratize finance,” says Boggiano.</p><p>Some advantages of algorand:</p><ul><li>Superior speed of transaction processing and finalizing</li><li>Very low transaction fee</li><li>Negative carbon footprint</li><li>Advanced smart contract capabilities.</li></ul><p>How to perform the following tasks on algorand</p><ul><li>Create application transactions and asset transactions</li><li>Create smart contracts and deploy them</li><li>Use algorand SDKs to create Web3 web applications.</li></ul><h3>Future plans</h3><p>In the future we have a plan to complete the development of the above project by adding the following features:</p><ul><li>On site generation of certificate images using a form like input.</li><li>A way to associate privileges to access more than just resource links with the certificate NFTs.</li></ul><h3>References:</h3><p><a href="https://www.outlookindia.com/website/story/business-news-what-is-algorand-and-why-is-it-known-as-the-ethereum-killer/406919">https://www.outlookindia.com/website/story/business-news-what-is-algorand-and-why-is-it-known-as-the-ethereum-killer/406919</a></p><p><a href="https://developer.algorand.org/docs">https://developer.algorand.org/docs</a></p><p><a href="https://github.com/benbel376/dapp_on_algorand.git">https://github.com/benbel376/dapp_on_algorand.git</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b962cf29f88d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[African language Speech Recognition (Amharic language)]]></title>
            <link>https://medium.com/@biniyambelayneh376/african-language-speech-recognition-amharic-language-17d2142d586e?source=rss-cfd24bd8d53e------2</link>
            <guid isPermaLink="false">https://medium.com/p/17d2142d586e</guid>
            <dc:creator><![CDATA[Biniyambelayneh]]></dc:creator>
            <pubDate>Thu, 09 Jun 2022 20:51:13 GMT</pubDate>
            <atom:updated>2022-06-09T20:51:13.962Z</atom:updated>
            <content:encoded><![CDATA[<p>Speech-to-Text</p><h3>Abstract</h3><p>We have Processed more than 10 thousand Amharic audio samples and prepared them for modeling. after building the model, different hyperparameter values (epoch number and batch size) were used to train the model until the best result in terms of the WER (Word Error Rate) metric is obtained. the final WER rate able to be obtained given the limited time the experiments were run is 0.9954</p><h3>Introduction</h3><p>The World Food Program plans to use an intelligent form to collect nutritional information on food purchased and sold in three African markets.</p><p>The design of this intelligent form requires selected people to download an app to their phone, and then use their voice to activate the app to register the list of products they just bought in their own language anytime they buy food. The app’s intelligent technologies are anticipated to transcribe Amharic speech to Amharic text and organize the data in a database in an easy-to-process manner.</p><p>Amharic is a morphologically rich language with limited resources. The purpose of this project is to construct an Amharic STT (Speech To Text) converter. Because of the intelligent form’s design, certain people must use the web app, and anytime they buy food, they must use their voice to activate the app, which then registers the list of items they just purchased in their own language.A deep learning model capable of converting Amharic speech into text in Amharic. The model we develop should be accurate and resistant to noise. During the fourth week of a 10 Academy Machine Learning course, we produced this project.</p><h3>Motivation</h3><p>Automatic speech recognition systems are useful in a wide range of scenarios. In reality, ASRs (Automatic Speech Recognitions) can be used for any work involving computer interaction.</p><p>The following are some of the most common applications of speech recognition technology:</p><blockquote>Dictation systems include medical transcriptionists,</blockquote><blockquote>Legal and business dictation,</blockquote><blockquote>Conventional word processing.</blockquote><p>Recording audio voice is easier than typing on a keyboard. This will be the primary incentive for this project. Non-technical WFP (World Food Program) employees make up the majority of those working on this project. As a result, recording cooking products and products utilizing audio / voice of the individual is the simplest and most straightforward method.</p><h3>Preprocessing and Modeling</h3><p>The preprocessing stage is where we processed the audio samples to prepare them for feature extraction and modeling. Here, the audio samples are made to have equal length by truncating some of them and adding padding to the others; the audios are resampled to have similar sampling rate, and they are all converted to a stereo. Finally, a random time shifting was applied to the audio samples to increase the prediction accuracy of the model after training.</p><p>After that features need to be extracted from the data and be ready to train our model. After building the model and compiling a loss function with it (CTCLoss function in this case), the training of the data will commence.</p><ul><li>Preparing metadata: used to track and load the audio samples one by one at runtime.</li><li>Standardizing the sampling rate</li><li>Audio resizing</li><li>Converting mono to stereo</li><li>Data augmentation</li><li>Feature Extraction</li><li>Model Building</li><li>Training</li></ul><h3>Preparing metadata</h3><p>Metadata is information that is used to link an audio file to its transcribed counterpart. A Meta data file named ‘trsTrain.txt’ with a white space separated audio id and transcription is extracted in our dataset. Here’s how it looks after the Meta data has been generated and converted to a csv file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*Xe8P_3MsPD0TbtkB" /></figure><h3>Sample Rate Standardization</h3><p>When we see our sounds in the train folder most of them were having different sampling rates. For our model to be fair and free from bias we used this step to make our sampling rate constant for all the audios. We made the sampling rate 44 KHz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/0*10jdc6CDPPZCmz99" /></figure><h3>Audio Resizing</h3><p>During this stage we found out that most of the audios were more than 5 seconds and also more than half silent sound in them. So we truncated each audio to be less than 5 seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*AVBVQtjXy4OULXBoJPVwTQ.png" /></figure><h3>Converting mono to stereo</h3><p>Monaural or monophonic sound reproduction is intended to be heard as if it were a single channel of sound perceived as coming from one position. Stereophonic sound or, more commonly, stereo, is a method of sound reproduction that creates an illusion of multi-directional audible perspective.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/0*vkKTJKziypV227WT" /></figure><p>So we changed all the audios into a common stereo audio format.</p><h3>Data Augmentation</h3><p>The last step we did on our preprocessing was to augment our audios. This step will help us to have a model that is robust and resistant to noises. Among different data augmentation techniques we use time shift for our data augmentation phase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*3B0O-Nu0E2Ec0dz3JnLMQQ.png" /></figure><h3>Feature Extraction</h3><p>After the previous steps, the data is now ready for feature extraction. This is where a spectrogram representation of the data is generated. Spectrogram is a representation of the audio in frequency domain instead of time domain. But not to lose precise representation of the audio, we will divide up the audio into small frames or windows and apply the FFT (fast fourier transform) on the audio samples to generate a spectrogram of the audio. FMCC is used to make the number of nodes used to represent the frequency bands. This spectrogram can be visually represented as follows, where the x-axis is time, the y-axis is the frequency and the darkness of the image describes the intensity of the audio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/0*9M7b8zRBsuxLm7lL" /></figure><h3>Modeling</h3><p>During the modeling stage we will be choosing a certain modeling architecture to generate the model. In machine learning, each type of artificial neural network is tailored to perform certain sets of tasks. There are two types of artificial neural networks: convolutional neural networks (CNNs) and recurrent neural networks (RNNs). Recurrent neural networks are designed to interpret temporal or sequential information. These networks use other data points in a sequence to make better predictions. They do this by taking in input and reusing the activations of previous nodes or later nodes in the sequence to influence the output. convolutional neural networks are incapable of effectively interpreting temporal information. Convolutional neural networks are one of the most common types of neural networks used in <a href="https://www.telusinternational.com/solutions/ai-data-solutions/image-data">computer vision</a> to recognize objects and patterns in images.</p><p>For this project we used RNN since we are working with audio files, which are temporal by nature.</p><p>Hyperparameters</p><p>the hyperparameters used to tune the model were batch size and epoch number.</p><p>A limited number of experiments were run to get the following results.</p><p>The image below shows our last experiment results. Although the result is not significant, we were able to decrease the error rate from 1.0 to 0.992 as shown in the image below.</p><p>Model results</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/0*noAb49vj1OlNZ88a" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/0*zyyv2YVwqFW7YIHe" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/0*wO5FJoY2VdQGdD-J" /><figcaption>Model training results</figcaption></figure><p>During the model training data and the pipeline were tracked using DVC pipeline. Below, you can take a look at two of the sages tracked by the DVC pipeline and their outputs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/0*zBp_-L7Ur5TcNNcH" /><figcaption>DVC pipeline and data tracking</figcaption></figure><p>Some of the experiment results were tracked using MLflow. The image below shows the tracked parameters and associated metrics for each run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*cB7OunSEHjNqEnAkh7uvkw.png" /><figcaption>Mflow tracked parameters and metrics</figcaption></figure><h3>Bias, Fairness</h3><p>Because the data used to train the ASR model in this study is highly political, validation is essential. While this does not fully invalidate our model, it may not be appropriate to use it in other domains without adequate testing and validation because it may have solely learned political terms and may be biased when recommending terms.</p><h3>Future Work</h3><p>To highlight the upcoming study in the speech-related sector, the following recommendations are made and presented based on the experience and numerous obstacles raised in this experiment. Because this research only looks at native and non-native Amharic speakers, it ignores linguistic variations among non-native Amharic speakers. As a result, greater research into dialectical differences among non-native speakers of the language is required.</p><p>Given the constraints, the results are encouraging and demonstrate that a general speech recognition technique capable of translating Amharic SPEECH-TO-TEXT might be built.</p><h3>Review of previous work</h3><p>Despite the fact that ASR (Automatic Speech Recognition) research for technologically favored languages has been ongoing for more than 50 years, Amharic speech recognition research has only recently begun. Speech recognition for Ethiopic languages has been the subject of a number of studies.</p><p>Some of the works are:</p><p>- Zegaye S. (2003) HMM based large vocabulary, Speaker Independent, Continuous Amharic Speech Recognizer, M.Sc. Thesis, Addis Ababa University, Addis Ababa</p><p>- Bereket K. (2008): developing a speech synthesizer for Amharic language using Hidden Markov Model, M.Sc. Thesis, Addis Ababa University, Addis Ababa</p><p>- Solomon B. (2001): Isolated Amharic Consonant-Vowel (CV) syllable Recognition: an experiment using the Hidden Markov Model, M.Sc. Thesis, Addis Ababa University, Addis Ababa</p><p>- Kinfe T. (2002) : sub-word based Amharic word recognition : an experiment using Hidden Markov Model, M.Sc. Thesis, Addis Ababa University, Addis Ababa</p><h3>Reference</h3><p>● <a href="https://machinelearningmastery.com/how-to-choose-loss-functions-when-training-deep-learning-neural-networks/">111 Responses to How to Choose Loss Functions When Training Deep Learning Neural Networks</a></p><p>● <a href="https://algorithmia.com/blog/introduction-to-loss-functions">Introduction to Loss Functions</a></p><p>● <a href="https://www.kdnuggets.com/2021/06/ethics-fairness-ai.html">Ethics, Fairness, and Bias in AI</a></p><p>● <a href="https://www.datarobot.com/trusted-ai-101/ethics/bias-and-fairness/">Bias and Fairness as Dimensions of Trusted AI</a></p><p>● <a href="https://towardsdatascience.com/audio-deep-learning-made-simple-automatic-speech-recognition-asr-how-it-works-716cfce4c706">Audio Deep Learning Made Simple: Automatic Speech Recognition (ASR), How it Works</a></p><p>● <a href="https://paperswithcode.com/task/speech-recognition">Speech Recognition</a></p><p>● <a href="https://github.com/tilayealemu/MelaNet/blob/master/vizualize.ipynb">Tilayealemu melaNet visualization using acoustic model</a></p><p>● <a href="https://www.researchgate.net/publication/329316345_Speech_Recognition_using_Recurrent_Neural_Networks">(PDF) Speech Recognition using Recurrent Neural Networks</a></p><p>● <a href="https://direct.mit.edu/neco/article/12/10/2451/6415/Learning-to-Forget-Continual-Prediction-with-LSTM">Learning to Forget: Continual Prediction with LSTM | Neural Computation | MIT Press</a></p><p>● <a href="https://towardsdatascience.com/audio-deep-learning-made-simple-sound-classification-step-by-step-cebc936bbe5">Audio Deep Learning Made Simple: Sound Classification, step-by-step</a></p><p>● <a href="https://towardsdatascience.com/audio-deep-learning-made-simple-automatic-speech-recognition-asr-how-it-works-716cfce4c706">https://towardsdatascience.com/audio-deep-learning-made-simple-automa tic-speech-recognition-asr-how-it-works-716cfce4c706</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17d2142d586e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rossman Pharmaceuticals Sales Prediction with ML]]></title>
            <link>https://medium.com/@biniyambelayneh376/rossman-pharmaceuticals-sales-prediction-with-ml-772832593571?source=rss-cfd24bd8d53e------2</link>
            <guid isPermaLink="false">https://medium.com/p/772832593571</guid>
            <dc:creator><![CDATA[Biniyambelayneh]]></dc:creator>
            <pubDate>Sat, 28 May 2022 19:40:14 GMT</pubDate>
            <atom:updated>2022-05-28T19:40:14.701Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Machine learning powers many of today’s most innovative technologies, from the predictive analytics engines that generate shopping recommendations on Amazon to the artificial intelligence technology used in countless security and antivirus applications worldwide. There are many benefits of machine learning,</p><p>One of the biggest advantages of machine learning algorithms is their ability to improve over time. Machine learning technology typically improves efficiency and accuracy thanks to the ever-increasing amounts of data that are processed. This gives the algorithm or program more “experience,” which can, in turn, be used to make better decisions or predictions.</p><p>What’s the difference between deep learning and machine learning?</p><blockquote>Machine learning means computers learning from data using algorithms to perform a task without being explicitly programmed. Deep learning uses a complex structure of algorithms modeled on the human brain. This enables the processing of unstructured data such as documents, images and text.</blockquote><h3>Project context</h3><p>The finance team of Rossman Pharmaceuticals wants to forecast sales in all their stores across several cities six weeks ahead of time. Managers in individual stores rely on their years of experience as well as their personal judgment to forecast sales.</p><p>The data team identified factors such as promotions, competition, school and state holidays, seasonality, and locality as necessary for predicting the sales across the various stores.</p><h3>Objective</h3><p>The objective is to build and serve an end-to-end product that delivers this prediction to analysts in the finance team. This includes a pipeline that extracts, cleans, transforms, analyzes, and models data, but also a working model that is integrated into an interactive web application that people can provide a set of parameters to and receive a prediction of sales in return.</p><h3>Data</h3><p>The data for this challenge can be found here: <a href="https://www.kaggle.com/competitions/rossmann-store-sales/data">Rossman Store Sales | Kaggle</a> the data comes in three separate csv files:</p><ul><li>train.csv: rows = 1,017,209, columns = 9</li><li>test.csv: rows = 41088, columns = 8</li><li>store.csv: rows = 1115, columns = 10</li></ul><p>Some of the variables found in the above datasets are summarized below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*tYsZZuJJ03YfNb0Qcp7ayA.png" /></figure><h3>Method</h3><p>Code versioning was implemented through git and stored on a <a href="https://github.com/benbel376/rossman_predictive_analysis">Github repository</a>. DVC was used for tracking the versions of the data that was stored in a remote storage on google drive. Model tracking was done through mlflow.</p><p>Data was loaded from three csv files (train.csv, test.csv, and store.csv) into pandas data frames. General shape and content of the datasets were reviewed. Missing and outlier data was checked and cleaned. After merging the store and train data frames as well as the test and test data frames, the merged datasets were exported into a new csv file ready for the next stage of analysis</p><p>As a first step, we needed to explore customer purchasing behaviors (EDA) which is an important step in every meaningful machine learning project. Our goal is to check how some measures such as promos and opening of new stores affect purchasing behavior.</p><p>The exploratory data analysis was conducted after loading the cleaned datasets into a new Jupyter notebook. The EDA revealed quite interesting facts from the data, but they were not enough to satisfy the business objective.</p><p>Visualizing various features and interactions is necessary for clearly communicating our findings. It is a powerful tool in the data science toolbox. Below are some of the findings via the necessary plots:</p><h3>Distribution of Promotion in the two datasets</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*9X73ZdXd1e-lMr42lzX0LA.png" /><figcaption>promotion distribution in the two datasets</figcaption></figure><p>There is a slight difference in the proportion of the existence of promotion between the train and test datasets. (train: 58%, test 50%)<br>The mean and SD values of their binomial distributions are also different: mean( train: 23856, test: 20687)<br>The two datasets have close but different distribution.</p><h3>Sales Behavior Before, During, and After holidays</h3><p>The behavior is somewhat similar for all the holidays. So let’s take a look at two:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*qXcSOtgJA6Qe9h-esI6sSg.png" /><figcaption>Sales trend around Easter 2013</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*pchHOvo329QuHznrGkXyrw.png" /><figcaption>Sales trend around Christmas 2013</figcaption></figure><p>From the above charts, it is quite clear that sales decreases around holidays and comes back up somewhat gradually after the holidays.</p><p>When we look at the sales average on days where there were holidays and where there weren’t, we find the following result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*nVcD-aFhepupKKLxaQDHVA.png" /><figcaption>Sales during holidays</figcaption></figure><p><strong>Comparing state holidays and no holidays</strong></p><ul><li>the purchase during no holidays is more</li><li>comparing the purchase behavior between state holidays: public holidays have more purchases, while Christmas has the least</li><li>sales on easter day went down and back up again after the holiday</li></ul><h3>Sales on weekends and weekdays</h3><p>Stores that are open on weekends are the stores with the following IDs: [733, 682, 769, 562, 1097, 262, 85, 423, 335, 494]. Average per-store sales for open stores: 8226.255307855627. Average Per-store sales for closed stores: 5444.65615322255. Stores that sale on weekends do earn almost twice</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/0*3EbgJGW1GQmMAGhB" /></figure><p>There is a very high positive correlation between sales and number of customers: correlation value is 0.87<br>Presence of promotion affects sales positively as well, But their correlation is 0.46<br>Presence of Promotion affects number of customers positively too. Correlation value is 0.37</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*8LAj8z58zWBgjZHUuzOIIA.png" /></figure><p>Competition distance and Sales have the following negatively correlated relationship</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*vgkiJHe2IcQDA56N8HdU5Q.png" /></figure><h3>Random Forest Regression Modeling</h3><p>Sklearn pipelines were used to automate the data transformation process before fitting the model</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*TvYSU8RSgZgfISBgtCDetQ.png" /><figcaption>sklearn pipeline to process the data before fitting.</figcaption></figure><p>the above pipeline performs the following functions</p><ul><li>labeling categorical variables using label encoding</li><li>Scaling the data using min-max scaler from sklearn library</li><li>separting feature and target variables</li><li>splitting the data into 20% testing and 80% training data.</li></ul><p>after a number of hyperparameter tunning the following results were acquired</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*ulbpXxnSavEN2mjxMYDPdA.png" /><figcaption>Hyperparameter combinations and accuracy</figcaption></figure><p>as can be seen from the above picture, max_depth seems to have a bigger effect than n_estimators. for fitting the model, max_depth value of 20 and n_estimators value of 40 was taken.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*04vdFboup4D6gJcrGktvsA.png" /><figcaption>feature importance.</figcaption></figure><p>The most important features are shown on the right: Open and Promo.</p><p>from this model the maximum accuracy score acquired is 0.85.</p><h3>Building Model with Deep Learning</h3><p>Deep Learning is a type of machine learning and artificial intelligence (AI) that imitates the way humans gain certain types of knowledge. It is important in predictive modelling.</p><p><strong>Time Series Analysis</strong></p><p>Time Series pertains to the sequence of observations collected in constant time intervals be it daily, monthly, quarterly or yearly. Time Series Analysis involves developing models used to describe the observed time series and understand the “why” behind its dataset.</p><p>I Isolated the Store Sales dataset into time series data.</p><p>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/0*FjgwnZ_TPlBcxf0O.png" /></figure><p><em>Scaled Sales included</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/0*bidyF8oMtnPi-CUM.png" /></figure><p>Time Series Plot — plot of sales per date</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bxyOxpKtJO9P_rJ7B38W1A.png" /></figure><p><strong>Checking stationarity of the data</strong></p><p>Stationary time series has statistical properties or moments (e.g., mean and variance) that do not vary in time. Conversely, nonstationary is the status of a time series whose statistical properties are changing through time.</p><p>I used the Unit Root Test to check if the time series is stationary.</p><p>as shown below, the data is indeed stationary. the p-value is way below 0.05.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*C_ZDFKiw-Hr6veQtoj4bdA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*EVuWmKSSuWDdlM11xID8Sg.png" /></figure><p><strong>Autocorrelation and Partial Autocorrelation</strong></p><p>They are measures of association between current and past series values and indicate which past series values are most useful in predicting future values.</p><p><strong>Autocorrelation </strong>between X and Z will take into account all changes in X whether coming from Z directly or through Y.</p><p><strong>Partial Autocorrelation</strong> removes the indirect impact of Z on X coming through Y.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*ToQ-61VrF-xLmAbsnwtCYQ.png" /></figure><p><strong>Sliding Window for time series</strong></p><p>The use of prior time steps to predict the next time step is called the sliding window method(lag method). The number of previous time steps is called the window width or size of the lag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/0*gpK4FdkgOO1z4eXR.png" /></figure><p><strong>Build a LSTM Regression model to predict the next sale</strong></p><p>LSTM stands for Long Short-Term Memory which is a type of Recurrent Neural Networks. I used Tensorflow to build my model and saved it for later usage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*70YFsD4nyJyJX-WFhUIzPw.png" /></figure><p>Results</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*2jn9hMwSEUz2V0VdV_IAqg.png" /><figcaption>Test data vs prediction</figcaption></figure><h3>Summary</h3><p>Somewhat accurate results were acquired from both the tensorflow model and the random forest regression model</p><p>The exploratory data analysis shows that there is a negative correlation between competition distance and sales.<br>It also shows a positive correlation between, number of customers, promotion, weekend opening, and absence of holidays.<br>Store type and assortment also affect the sales</p><h3>References</h3><p><a href="https://www.sciencedirect.com/science/article/pii/S2667096822000027">Time-series forecasting of seasonal items sales using machine learning — A comparative analysis — ScienceDirect</a></p><h3><a href="https://www.kaggle.com/c/rossmann-store-sales/notebooks">Rossmann Store Sales</a></h3><h3><a href="https://www.kaggle.com/c/rossmann-store-sales/notebooks">Forecast sales using store, promotion, and competitor data</a></h3><p><a href="https://www.kaggle.com/c/rossmann-store-sales/notebooks">www.kaggle.com</a></p><p>A<a href="https://automl.github.io/auto-sklearn/master/">uto-sklearn — AutoSklearn 0.12.7 documentation (automl.github.io)</a></p><p><a href="https://machinelearningmastery.com/time-series-forecasting-long-short-term-memory-network-python/">Time series forecasting with LSTM</a></p><p><a href="https://machinelearningmastery.com/how-to-develop-deep-learning-models-for-univariate-time-series-forecasting/">Univariate Time series forecasting with Deep Learning</a></p><p><a href="https://automl.github.io/auto-sklearn/master/">https://automl.github.io/auto-sklearn/master/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=772832593571" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Machine learning and A/B hypothesis testing on SmartAd's creative ad performance]]></title>
            <link>https://medium.com/@biniyambelayneh376/machine-learning-and-a-b-hypothesis-testing-on-smartads-creative-ad-performance-f155bf16dc71?source=rss-cfd24bd8d53e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f155bf16dc71</guid>
            <dc:creator><![CDATA[Biniyambelayneh]]></dc:creator>
            <pubDate>Sat, 21 May 2022 17:54:11 GMT</pubDate>
            <atom:updated>2022-05-21T17:54:11.988Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Business objective</h3><p>SmartAd is a mobile first advertiser agency that designs intuitive touch-enabled Ad that runs online for clients to increase brand awareness. SmartAd provides brands with an automated advertising experience via machine learning and creative excellence. Additionally, it provides a service known as, Brand Impact Optimizer(BIO) a lightweight questionnaire, that is served with every campaign to determine the impact of the creative Ads, the ad they design, on various upper funnel metrics, including memorability and brand sentiment.</p><h3>The objective of the Testing</h3><p>To design and implement a hypothesis testing algorithm for the BIO service and determine whether the recent campaign resulted in a significant lift in brand awareness.</p><p>What is A/B Testing?</p><p>A/B Testing is a method used to compare two versions of something to figure out which performs better. It uses a traditional statistical inference approach grounded in a hypothesis test. It involves two experiment groups:</p><blockquote><em>Group (A): exposed to no change (exposed group): users showed dummy ad Group(B): exposed to change(controlled group): shown with the creative ad designed by smartAd.</em></blockquote><h3>Data Used</h3><p>The data used is from the BIO questionnaires given to users running from 3–10 July 2020 and collected by smart. The BI data the project had the following questions for the users:</p><blockquote><em>Q: Do you know the brand Lux</em></blockquote><blockquote><em>R: Yes or No</em></blockquote><p>Initially, the given data was 8077 rows and nine columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-zHinx7gxfth0vAe.png" /></figure><p>Dataset used</p><p><strong>Data Set features</strong></p><ul><li><strong>auction_id: </strong>the unique id of the online user who has been presented the BIO. In standard terminologies, this is called an impression id. The user may see the BIO questionnaire but choose not to respond. In that case, both the <strong>yes</strong> and <strong>no</strong> columns are zero.</li><li><strong>experiment</strong>: which group the user belongs to — control or exposed.</li><li><strong>date</strong>: the date in YYYY-MM-DD format</li><li><strong>hour</strong>: the hour of the day in HH format.</li><li><strong>device_make</strong>: the name of the type of device the user has e.g. Samsung</li><li><strong>platform_os: </strong>the id of the OS the user has.</li><li><strong>browser</strong>: the name of the browser the user uses to see the BIO questionnaire.</li><li><strong>yes</strong>: 1 if the user chooses the “Yes” radio button for the BIO questionnaire.</li><li><strong>no</strong>: 1 if the user chooses the “No” radio button for the BIO questionnaire.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JA345hmJqjJxtXtK.png" /></figure><p>Information in the dataset(missing values, data types…)</p><p>Missing values: 6834 (users that did not respond at all)</p><p>Usable rows: 1243</p><p>These missing values were dropped in our data cleaning process and the clean data was saved to a new .csv file.</p><p>EDA</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/0*TD1cwj52l57X0pH6.png" /></figure><p>The exposed group has a slightly more count of yes compared with the control group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*bOcZOEQ_UFobrbnS.png" /></figure><p>Exposed vs Contol group</p><h3>Methods</h3><ol><li><strong>Classical A/B testing</strong></li></ol><p>Classical statistical hypothesis testing involves <strong>the test of a null hypothesis against an alternative hypothesis</strong></p><blockquote><em>Null hypothesis: There is no significant lift in the brand awareness due to smartAd</em></blockquote><blockquote><em>Alternative hypothesis: There is a significant lift in brand awareness due to the smartAd</em></blockquote><p>P-values are used to measure the significance of the experiment features and P-value is based on the assumption that the null hypothesis is true.</p><p>In our case, a 2% brand awareness increase would be practically significant MDE(minimum detectable effect) = 0.02 and have a 95% confidence level, need to accept the experiment.</p><blockquote><em>Baseline conversion — the percentage which defines the current conversion rate of the page you want to test.</em></blockquote><blockquote><em>Minimum Detectable Effect (MDE) — the minimum expected conversion lift.</em></blockquote><p>The problem with the classical A/B test is that it takes a long time to show results and is not worth the while. Cost in terms of data collection and waiting for the experiment to end is another factor to be considered as the downside to classical A/B testing.</p><p><strong>2. Sequential A/B testing</strong></p><p>Sequential sampling works in a very non-traditional way; instead of a fixed sample size, you choose one item (or a few) at a time and then test your hypothesis. You can either:</p><p>● Reject the null hypothesis (H0) in favor of the alternate hypothesis (H1) and stop,</p><p>● Keep the null hypothesis and stop,</p><p>● unable to reach either conclusion with current observation and continue sampling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/0*DsW6t2BSi1zsBMEt.png" /></figure><p><strong>Advantages of sequential A/B testing</strong></p><p>Sequential A/B testing gives users a chance to finish the experiment earlier without increasing the possibility of false results. It enables to check multiple checks on every step ensuring that the error level doesn’t exceed 5%. Whereas classical test checks result only at the very end</p><p>Unlike classical fixed sample-size tests, where significance is only checked after all samples have been collected, this test will continuously check for significance at every new sample and stop the test as soon as a significant result is detected, while still guaranteeing the same type-1 and type-2 errors as the fixed-sample size test</p><p><strong>3 . A/B testing formulation in the Machine Learning context</strong></p><p>Unlike statistical inference, Machine Learning algorithms enable us to model complex systems that include all of the ongoing events, user features, and more. There are a number of algorithms each with strengths and weaknesses.</p><p>Machine learning algorithms enable us to model complex systems that include all of the ongoing events, user variables, features, and many more. There are many algorithm methods for handling A/B tests but each has its strengths and weaknesses.</p><blockquote><em>An attractive benefit to Machine Learning is that we can combine multiple approaches to gain insights.</em></blockquote><p>For this approach, we have created versions of our clean data by splitting it by browser and platform_os. In doing so we created separated data sets as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nSztb8VJhP203FmO.png" /></figure><p>Dataset split by browser</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d8Vu8Wvr7SkJoDgD.png" /></figure><p>Dataset split by platform</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*isVD01wfcWH3bmQ5.png" /></figure><p>finally created versions of each the dataset like this</p><h3>Next is training</h3><p>For each version of the data, we split the data into 70% training, 20% validation, and 10% test set.</p><p><strong>Machine learning Models Used</strong></p><ol><li><strong>Logistic regression: </strong>We created a linear regression model using the LogisticRegression() function. Then we trained the linear regression model using all versions of our data. The parameters selected for the model were determined using 5-fold cross validation to prevent over-fitting. Then we evaluated our model using test data.</li></ol><p>Test Accuracy of Logistic Regression Model</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/0*9UiSGYBo4IhlZhiB.png" /></figure><p>Recommendation: From the above k_fold validation we can see that the maximum accuracy we can get by using 5 fold and logistic regression is 0.75 from all the datasets. From this, we can infer that either the data is not enough or the model is not suitable since the accuracy is less than 80%</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/0*Wq8umvkXOSKWtA1P.png" /></figure><p><strong>2. RandomForestClassifier</strong>: We took similar steps as the Logical regression. Using the ReandomforstClassifier model we trained our data. %- fold cross validation was used here as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*IxnmWON6grXR4FDF.png" /></figure><p>Recommendation: According to the results we got above using the 5-fold validation random forest classifier the maximum accuracy we got is 0.75 from all the datasets. Following this we are can deduce that either the data used is not enough or the model is not suitable as the accuracy is less than 80%</p><p><strong>3. Xgboost</strong>: Took all the necessary steps and used Xgboost here. It is an efficient implementation of gradient boosting that can be used for <strong>regression</strong> predictive modeling</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/0*yrtNxFmoNiI6M0yx.png" /></figure><h3>The advantage of using MLFlow and DVC in ML experimentation</h3><p>MLflow is an open-source tool originally launched by databricks, it helps manage multiple stages of the ML lifecycle. It lets you train, reuse, and deploy models with any library and package them into reproducible steps that other data scientists can use as a “black box,” without even having to know which library you are using.</p><p>whereas the DVC(data version control) is an open-source control system like Git for handling and tracking our data separately. It saves the storage space required to manage a whole dataset, without it we would have trouble with our models and inconsistency issues.</p><h3>References</h3><h3><a href="https://splitmetrics.com/blog/sequential-a-b-testing/amp/">https://splitmetrics.com/blog/sequential-a-b-testing/amp/</a></h3><p><a href="https://splitmetrics.com/blog/sequential-a-b-testing/amp/">splitmetrics.com</a></p><ul><li><a href="http://blog.analytics-toolkit.com/2017/statistical-significance-ab-testing-complete-guide/">Statistical Significance in A/B Testing — a Complete Guide</a></li><li><a href="https://www.kaggle.com/tammyrotem/ab-tests-with-python/notebook">A/B test with Python</a></li><li><a href="https://hbr.org/2017/06/a-refresher-on-ab-testing">A Refresher on A/B Testing</a></li><li><a href="https://medium.com/analytics-vidhya/a-b-testing-clearly-explained-56488430156">A/B Testing: Analysis of Credit Card Marketing Campaign | by Kailash Hari | Analytics Vidhya</a></li><li><a href="https://www.business-science.io/business/2019/03/11/ab-testing-machine-learning.html">A/B Testing with Machine Learning — A Step-by-Step Tutorial</a></li><li><a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6279615/">Standard errors and confidence intervals for variable importance in random forest regression, classification, and survival — PMC (nih.gov)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f155bf16dc71" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>