<?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 Mohammed EsamAldeen on Medium]]></title>
        <description><![CDATA[Stories by Mohammed EsamAldeen on Medium]]></description>
        <link>https://medium.com/@mohammedesam.mem?source=rss-c6cd146d358c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*eAU_IM_fFsjZWBSZ.jpg</url>
            <title>Stories by Mohammed EsamAldeen on Medium</title>
            <link>https://medium.com/@mohammedesam.mem?source=rss-c6cd146d358c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 12:25:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mohammedesam.mem/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[Causal inferences]]></title>
            <link>https://medium.com/@mohammedesam.mem/causal-inferences-e6b43eabaa04?source=rss-c6cd146d358c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6b43eabaa04</guid>
            <dc:creator><![CDATA[Mohammed EsamAldeen]]></dc:creator>
            <pubDate>Sat, 12 Nov 2022 21:55:11 GMT</pubDate>
            <atom:updated>2022-11-13T21:01:55.809Z</atom:updated>
            <content:encoded><![CDATA[<h3>Business Objective:</h3><p>I will be working for delivery startup which is the largest last-mile delivery service in Nigeria. Their work is partnered with motorbike owners and drivers to deliver parcels across Lagos, Nigeria. They face the problem of placement of pilots and this has led to a high number of unfulfilled delivery requests. <br>I will help them to understand the primary causes of unfulfilled requests as well as come up with solutions that recommend driver’s locations that increase the fraction of complete orders.</p><h3><strong>What is the causal inference?</strong></h3><p>Causal inference consists of a family of statistical methods whose purpose is to answer the question of “why” something happens. Standard approaches in statistics, such as regression analysis, are concerned with quantifying how changes in X are associated with changes in Y. Causal inference methods, by contrast, are used to determine whether changes in X cause changes in Y. Therefore, unlike methods that are concerned with associations only, causal inference approaches can answer the question of why Y changes. If X is causally related with Y, then Y’s change can be explained in terms of X’s change.</p><p>Humans have been interested in causality for hundreds of years. However, causal inference as a family of methodologies is a fairly new development, as researchers didn’t used to have formal networks of causal relations.1 This only changed in the latter half of the 20th century thanks to the work of pioneering methodologists such as Donald Rubin and Judea Pearl.2,3,4</p><p>In recent years, the field of causal inference has grown in scope and impact. We now have more and better methodologies for answering “why” questions. Causal inference methods have improved the analysis of experiments, quasi-experiments, and observational data. Causal inference is now making inroads to machine learning and artificial intelligence, with pioneers in the field pointing to it as an increasingly significant research area.</p><h3><strong>Why is causal inference important?</strong></h3><p>At a high level, causal inference helps us provide a better user experience for customers. The insights from causal inference can help identify customer pain points, inform product development, and provide a more personalized experience. For example, if we know that users are submitting customer support tickets due to a lack of clarity around how to use a new feature and not dissatisfaction with the feature itself, we can focus on improving the communications around how to use this feature rather than updating or decommissioning the feature.</p><p>At a higher level, causal inference provides information that is critical to both improving the user experience and making business decisions through better understanding the impact of key initiatives. For example, if we are able to translate intangible variables such as customer satisfaction to business metrics, we can then use that information to help prioritize new features and tools. If we are able to understand the short-term and long-term impact of a new program, that will help us build more sustainably and inform future product development decisions.</p><p>At a more granular level, causal inference enables data scientists and product analysts to answer causal questions based on observational data, especially when A/B testing is not possible, or gain additional insights from a well-designed experiment. For example, we may launch an email campaign that is open for participation to all customers in a market. In this case, since we don’t have a randomized control group, how do we measure the campaign’s effect? In another example, suppose we have a randomized, controlled A/B test experiment but not everyone in the treatment group actually receive the treatment (i.e., if they don’t open the email). How do we estimate the treatment effect for the treated? Causal inference enables us to answer these types of questions, leading to better user experiences on our platform.</p><h3><strong>Varieties of causal inference</strong></h3><p>Since causal inference is a family of loosely connected methods, it can feel overwhelming for a beginner to form a structural understanding of the various methods. For a clearer understanding, we’ll divide the methods into two categories: those that are used with experimental data and those that are used with observational data.</p><p>These various methods are not mutually exclusive and, quite often, multiple methods can be applied to tackle the same problem. In the flowchart in Figure 1, below (and others throughout the article), we highlight possible solutions for handling given research tasks. Keep in mind that this list is not exhaustive.</p><h3><strong>Causal inference with experimental data</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RkRKug-ou2Y1g6Xi" /></figure><p>Figure 1. Causal inference methods apply to very specific experimental data.</p><h3>EDA</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IUC4SjcbsXWlCkixIKTIaA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1u28rEI6YaXJPW5IDoPQ-Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sldiy34KABCmECJdtkFDew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PVnxdSR0Pf-Xugr7gdwB2g.png" /></figure><h4>Origin and destination points</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*bki-mFDwXevqXt7X1a1P8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*vHXJPRFBAMLsRHVrRCEESg.png" /></figure><h3>Future work</h3><ul><li>Better EDA and features creation</li><li>Build Causal graphs.</li><li>Train ML models</li></ul><h3>Reference</h3><ol><li><a href="https://towardsdatascience.com/causality-an-introduction-f8a3f6ac4c4a">https://towardsdatascience.com/causality-an-introduction-f8a3f6ac4c4a</a></li><li><a href="https://towardsdatascience.com/a-simple-explanation-of-causal-inference-in-python-357509506f31">https://towardsdatascience.com/a-simple-explanation-of-causal-inference-in-python-357509506f31</a></li><li><a href="https://pythonsimplified.com/geocoding-in-python-using-geopy/#:~:text=Reverse%20Geocoding%20is%20the%20process,can%20be%20used%20by%20anyone">https://pythonsimplified.com/geocoding-in-python-using-geopy/#:~:text=Reverse%20Geocoding%20is%20the%20process,can%20be%20used%20by%20anyone</a>.</li><li><a href="https://causalnex.readthedocs.io/en/latest/index.html">https://causalnex.readthedocs.io/en/latest/index.html</a></li><li><a href="https://github.com/quantumblacklabs/causalnex/blob/develop/docs/source/03_tutorial/01_first_tutorial.ipynb">https://github.com/quantumblacklabs/causalnex/blob/develop/docs/source/03_tutorial/01_first_tutorial.ipynb</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6b43eabaa04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Computer Vision for Creative Optimisation]]></title>
            <link>https://medium.com/@mohammedesam.mem/using-computer-vision-for-creative-optimisation-905a59573f85?source=rss-c6cd146d358c------2</link>
            <guid isPermaLink="false">https://medium.com/p/905a59573f85</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[creative-optimization]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Mohammed EsamAldeen]]></dc:creator>
            <pubDate>Sun, 06 Nov 2022 18:42:18 GMT</pubDate>
            <atom:updated>2022-11-08T07:59:18.724Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*d-2VC1d1jdgeyAaFPRI7tg.jpeg" /></figure><h3>Introduction</h3><p>Computer vision technology has transformed the world by allowing machines to achieve a human-level understanding of images and videos. The success of deep learning-based computer vision has led to a number of novel applications, such as Autonomous driving for cars, tumor detection from X-rays, farm weed detection and yield prediction from satellite and drone images, visual try-on features for clothes and jewelry in e-commerce, and many more. I will apply deep learning-based computer vision techniques for creative optimization in mobile advertising.</p><h3><strong>Business objective</strong></h3><p>For this project, I will work for an online mobile ad business. It provides the following services to its clients:</p><ul><li>Design an interactive Ad — what is also called a “creative”. A creative is a rich ad containing interaction elements through a mini-game engine, video, text, images, etc…</li><li>Serves these creatives to audiences on behalf of a client. To do that, they buys impressions from an open market through real-time bidding.</li><li>Optimises the creative designing process &amp; also targeting guaranteed inventories with sophisticated machine learning algorithms.</li></ul><p>I will help thee company learn the best predictive features that attract a user to interact with the last screen of an ad — this means a user is directed to the advertiser target page.</p><p>The analysis objectives of this project are divided into 3 sub-objectives that overall guide the workflow:</p><ul><li>Choose a state-of-the-art algorithms useful for semantic segmentation and dynamic creative optimisation.</li><li>Select suitable deep learning based computer vision algorithm and produce a model that can output object labels together with their location and bounding box information for the given creative asset data.</li><li>Create a machine learning model that helps predict campaign KPIs given creative asset deep learning features.</li></ul><h3>Methodologies</h3><ul><li><strong>Selenium</strong> is a free (open-source) automated testing framework used to validate web applications across different browsers and platforms.</li><li><strong>OpenCV</strong> is the huge open-source library for the computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in today’s systems. By using it, one can process images and videos to identify objects, faces, or even handwriting of a human. When it integrated with various libraries, such as NumPy, python is capable of processing the OpenCV array structure for analysis. To Identify image pattern and its various features we use vector space and perform mathematical operations on these features.</li><li><strong>extcolors </strong>is a python library for extracting color in images.</li><li><strong>Pytesseract </strong>Python-tesseract is an optical character recognition (OCR) tool for python. That is, it will recognize and “read” the text embedded in images.</li><li><strong>Deepface </strong>is a lightweight face recognition and facial attribute analysis (age, gender, emotion, and race) framework for python. It is a hybrid face recognition framework wrapping state-of-the-art models.</li><li><strong>Airflow </strong>Apache Airflow is an open-source workflow management platform for data engineering pipelines.</li><li><strong>Redash </strong>is a business Intelligence tool that houses many robust integration capabilities compared to existing Data Analytics platforms, making it a favorite for companies that have deployed numerous applications for managing their business processes.</li><li><strong>Stremlit </strong>is <strong>an</strong> open source app framework in Python language. It helps us create web apps for data science and machine learning in a short time.</li></ul><h3>Data</h3><p>The Dataset Archive is composed of an ‘Assets’ folder and a ‘performance_data’ CSV file. As the names suggest the folder contains the asset image used to build the creatives and the CSV file contains the performance values for each creative. Each folder within the ‘Assets’ folder is a ‘game_id’ string value and its reference performance is available in the CSV file.</p><p>The following are column values from the ‘performace_data.csv’ file.</p><ul><li><strong>game_id</strong> — Represents a unique identifier of a creative for the performance values</li><li><strong>ER</strong> — Represents the engagement rate score of the creative</li><li><strong>CTR</strong> — Represents the click-through rate score of the creative</li></ul><h3>Features and Campain KPIs</h3><p>we will to extract a couple of features and find their impact on the campaign KPIs, so that we could consider and predict future campaigns</p><h4>Features:</h4><ol><li>Logo and logo positions</li><li>Objects from all screens</li><li>Emotions for the human faces</li><li>Position of the engagement button (tap &amp; hold the icon in the figure above)</li><li>The transition time between click &amp; engagement screen</li><li>Text from all screens,</li><li>Dominant colors</li><li>The CTA button (Apply Now button in the figure above)</li></ol><h3><strong>Relation between image features and campaign KPIs</strong></h3><p>Online advertisements are ubiquitous in nowadays life, creating considerable revenue for many companies. As a common medium of advertisements, advertising creatives, as shown in can deliver rich product information quickly to users in a visual manner. Appealing to creatives improves visual experience and may lead to an increase of click-through rate (CTR). For merchants and e-commerce companies, the increase in CTR can be considered an indicator of an increase in revenue. Therefore, much attention has been paid to creative design for improving the visual experience. Traditionally, advertisers have to employ expert designers to produce attractive creatives and then submit them to platforms as complete images. Each time new products are announced or old products are updated, many creatives of different sizes and styles are required to design and submit to advertising platforms. This leads to an expensive cost for many advertisers. To reduce the cost of repetitive but professional design for advertisers, several high-tech companies set up intelligent advertisement platforms [11], which provide instant production services for advertising creatives and remarkably reduce heavy burdens for advertisers. Advertisers only need to provide basic materials to platforms, such as product pictures and textual information. Based on these source materials, the production system produces advertising creatives automatically by compositing arbitrarily designated elements, such as templates, colors of text, and sizes of pictures.</p><h3>Project Workflow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*xDw3TO4ykORiPBS4TkxCtA.jpeg" /></figure><h3>Stages of the project:</h3><h4>Data Scraping</h4><p>The data in the assets was missing a couple of crucial elements, so web scraping was the solution.</p><p>We will open the preview_link in the browser to scrape the images. The Selenium and pyautogui libraries will help us in the scraping process. <br>We will get a challenge when we try to extract the end frame images. The cause of the problem is some creatives need complicated user engagements like drawing zig zag. So we will make the process semi-automated and extract almost half of the images.</p><h4><strong>Emotion extraction</strong></h4><p>In order to extract emotion from a given image we first have to make sure the image contains a face. we will use Opencv for face detection. It takes an image, changes it to grayscale and uses the CascadeClassifier method to check if there are any faces in the image, and uses the detectMultiScale method to generate a list of rectangles for all the detected faces. We can use the length of the list to check whether or not the image contains a face.</p><p>After checking which images contain faces we use deepface to extract the emotion, gender, and race of the subject.</p><h4>Logo and CTA button detection</h4><p>We used the opencv template matching method to detect the logos and cta buttons. The method takes 2 parameters <strong>Image </strong>which is the image we will locate the logo on it, <strong>and Template</strong>, which is the logo or the button itself.</p><p>First, we locate the logo and the cta buttons in the assets folder. Then We matched those images with the start frame and endframe. The outputs are startX, startY, width, and height.</p><p>In most of the cases this method detects the logos and cta buttons perfectly. But when the images we use for matching aren’t well cropped, we get a bad prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*5mci7CaA0B8aVpEnJaMFLg.png" /></figure><h4>Color</h4><p>Given the extracted start_frame and end_frame images, we moved to extract information about the color composition of images. We chose to include two features: dominant colors and colorfulness metric.</p><p>1. <strong>Dominant Colors</strong>: We utilized extcolors library to get the color composition of an image and extracted the two most dominant colors within each image (‘dom_color_1’ and ‘dom_color_2’) and the ratio of number of pixels that carry each (‘dom_prct_1’ and ‘dom_prct_2). <br>Justification: the value of the dominant colors gives a flavor of the overall color of an image and what mixture of colors is present (ratios).<br>Limitation: extcolors gives the option of grouping colors with an adjustable Tolerance. Tolerance can take values between 0 (no grouping) to 100 (output 1 color). After little experimentation, we choose to set this value to 12 to get somewhat distinct colors. However, the optimal value could be higher.</p><p>2. <strong>Colorfulness metric</strong>: People can perceive an image as colorful, very colorful, not so colorful or not colorful at all (black &amp; white). However it is not easy to quantify this quality of images. To translate “perceived colorfulness” we follow the recipe given by a paper by Hasler and Süsstrunk (developed by surveying people to rate the colorfulness on a scale ) to define a colorfulness metric:</p><p><strong>C = rg yb +0.3 * rg yb</strong></p><p>We utilize OpenCV, in addition to the metric above to calculate the colorfulness of images.</p><h4>Text</h4><p>We used pytesseract to extract text from all images.</p><p>Limitation: using pytesseract on images as they are doesn’t give a high rate of accuracy in the text extracted. We note that images with colorful or complicated backgrounds are harder to be read by the code. We experimented by changing images to grayscale, adjusting the background color to contrast with text, and adaptive binarization; all to no avail. More experimentation and customization are needed to improve the accuracy.</p><h4>Edge detection</h4><p>Previously we can notice that the object detection model wasn’t working perfectly. We decided to add another similar feature that supports predicting the objects. In order to implement that I chose the edge detection method. We first detected the edges and then we counted the number of white pixels. When the images have so many edges, that is a sign of an image is crowded with objects.</p><h4><strong>Number of objects in an image</strong></h4><p>I used opencv to count the number of objects in an image. It takes an image and changes it to grayscale same as the face detection process, then I used thresholding on the image, then I used the dilation process, removing black distortion, next I used opencv’s findContours method to find the contours of the image and saved it as a list, the count of these contours is the count of the number of objects in the image.</p><h4>Merging the features</h4><p>I prepared independent csv files for each feature. In order to pass the features to the model, we collected and merged each csv file and we created one big csv file. The file contains all the features we extracted. We implemented this process with the help of airflow dags. We created two dags for the start frame features merging and end frame features merging.</p><h4>Modeling</h4><p>We used sklearn pipeline package to build the ML pipeline. It consists of a standardscaler and a random forest regressor model. In order to train the model I first removed unnecessary columns, did some label encoding and handled missing values. After the data has been processed I then separated the target feature from the rest, then I split the data into training and test portions, I then fitted the model using the training data. After the model has been trained I save it using pickle.</p><h3>References</h3><ul><li><a href="https://arxiv.org/pdf/2103.00436.pdf">https://arxiv.org/pdf/2103.00436.pdf</a></li><li><a href="http://www.cristinasegalin.com/research/papers/JCP19.pdf">http://www.cristinasegalin.com/research/papers/JCP19.pdf</a></li><li><a href="https://www.v7labs.com/blog/image-segmentation-guide">https://www.v7labs.com/blog/image-segmentation-guide</a></li><li><a href="https://www.fritz.ai/image-segmentation/">https://www.fritz.ai/image-segmentation/</a></li><li><a href="https://pyimagesearch.com/2021/03/22/opencv-template-matching-cv2-matchtemplate/">https://pyimagesearch.com/2021/03/22/opencv-template-matching-cv2-matchtemplate/</a></li><li><a href="https://docs.opencv.org/3.4/de/da9/tutorial_template_matching.html">https://docs.opencv.org/3.4/de/da9/tutorial_template_matching.html</a></li><li><a href="https://github.com/ultralytics/yolov5/blob/master/utils/torch_utils.py">https://github.com/ultralytics/yolov5/blob/master/utils/torch_utils.py</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=905a59573f85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build your trading pipeline(1)]]></title>
            <link>https://medium.com/@mohammedesam.mem/scalable-backtesting-infrastructure-8e518dbe9d1?source=rss-c6cd146d358c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e518dbe9d1</guid>
            <dc:creator><![CDATA[Mohammed EsamAldeen]]></dc:creator>
            <pubDate>Sat, 15 Oct 2022 19:54:24 GMT</pubDate>
            <atom:updated>2022-10-16T08:43:05.980Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jG-PaRKiG7ddL2Km_9LXyg.jpeg" /></figure><p><strong>Project objective:</strong></p><p>In This project, I will be building a reliable, large-scale trading data pipeline for a startup company called Mela. Mela is a startup that aims to enable everyone to enter the cryptocurrency industry, besides giving investors a reliable source of investment while lowering the risk associated with trading crypto.</p><p>Moreover, I will run backtests that simulate current and past particular situations as well as their trend over time, and I will store various useful artifacts in a robust data warehouse system.</p><h3><strong>Data and Explotary Data analysis(EDA):</strong></h3><ul><li>for this project, I used Bitcoin data from <a href="https://help.yahoo.com/kb/SLN2311.html">Yahoo</a> Finance, and I did some analysis shown below:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*FMl4i2RYO5-nDRWgE3iZyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*BhTxodUYdPDKD6p-RlZ0Bw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7mTORgZ5sRKHAE3ywcF4fg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pyb1Qqu93g_oQkw2A0FJCQ.png" /></figure><h3><strong>Tools used:</strong></h3><p><strong>Airflow</strong></p><p>Apache Airflow is an open-source workflow management platform for data engineering pipelines</p><p><strong>Backtrader:</strong></p><p>Backtrader is an open-source Python library that you can use for backtesting, strategy visualization, and live trading.</p><p>Although it is quite possible to backtest your algorithmic trading strategy in Python without using any special library, Backtrader provides many features that facilitate this process. In general, every complex component of ordinary backtesting can be created with a single line of code by calling special functions.</p><p><strong>Kafka</strong></p><p>Apache Kafka is a distributed data store optimized for ingesting and processing streaming data in real time. Streaming data is data that is continuously generated by thousands of data sources, which typically send the data records simultaneously. A streaming platform needs to handle this constant influx of data, and process the data sequentially and incrementally.</p><p>Kafka provides three main functions to its users:</p><ol><li>Publish and subscribe to streams of records</li><li>Effectively store streams of records in the order in which records were generated</li><li>Process streams of records in real-time</li></ol><p>Kafka is primarily used to build real-time streaming data pipelines and applications that adapt to the data streams. It combines messaging, storage, and stream processing to allow storage and analysis of both historical and real-time data.</p><p><strong>React</strong></p><p>The part of a website that the user interacts with directly is termed the front end. It is also referred to as the client side of the application. It includes everything that users experience directly: text colors and styles, images, graphs and tables, buttons, colors, and a navigation menu. HTML, CSS, and JavaScript are the languages used for Front End development.</p><p>ReactJS is a <strong>declarative</strong>, <strong>efficient</strong>, and flexible <strong>JavaScript library</strong> for building reusable UI components. It is an open-source, component-based front-end library that is responsible only for the view layer of the application. It was initially developed and maintained by Facebook and later used in its products like WhatsApp &amp; Instagram.</p><p><strong>Flask</strong></p><p>The backend is the server side of the website. It stores and arranges data, and also makes sure everything on the client side of the website works fine. It is the part of the website that you cannot see and interact with. It is the portion of software that does not come in direct contact with the users.</p><p>Flask is a web framework, it’s a Python module that lets you develop web applications easily. It has a small and easy-to-extend core: it’s a microframework that doesn’t include an ORM (Object Relational Manager) or such features.</p><p><strong>Amazon AWS</strong></p><p>AWS (Amazon Web Services) is a comprehensive, evolving cloud computing platform provided by Amazon that includes a mixture of infrastructure as a service (IaaS), platform as a service (PaaS), and packaged software as a service (SaaS) offerings. AWS services can offer an organization tools such as compute power, database storage, and content delivery services.</p><p><strong>PostgreSQL</strong></p><p>is an advanced, enterprise-class open-source relational database that supports both SQL (relational) and JSON (non-relational) querying. It is a highly stable database management system.</p><p><strong>What Is Technical Analysis?</strong></p><p>Technical analysis is a trading discipline employed to evaluate investments and identify trading opportunities by analyzing statistical trends gathered from trading activity, such as price movement and volume. Unlike fundamental analysis, which attempts to evaluate a security’s value based on business results such as sales and earnings, technical analysis focuses on the study of price and volume.</p><h3><strong>Indicators:</strong></h3><ul><li><strong>On-Balance Volume: </strong>On-balance volume (OBV) is a momentum indicator that uses volume flow to predict changes in stock price. Joseph Granville first developed the OBV metric in the 1960s. He believed that when volume increases sharply without a significant change in the stock’s price, the price will eventually jump upward, and vice versa.</li><li><strong>Moving Average (MA): </strong>In finance, a moving average (MA) is a stock indicator commonly used in technical analysis. The reason for calculating the moving average of a stock is to help smooth out the price data by creating a constantly updated average price. By calculating the moving average, the impacts of random, short-term fluctuations on the price of a stock over a specified time frame are mitigated.</li></ul><h3><strong>Metrics:</strong></h3><ul><li><strong>Return :<br></strong>The yearly average % Profit(or Loss) from your trading strategy.</li><li><strong>The number of trades:<br> </strong>A typical pattern should generate at least 20 to 25 trades over the test period to support the statistical significance of back-testing results. It would be wrong to assume that a pattern that had formed only a couple of times in the past is a guide or reference to a good trading opportunity in the future.</li><li><strong>Winning trades</strong>: <br>This is more important than the largest single-losing trade. Why? Suppose, for example, your total hypothetical profit was $A50,000 , and say $A 37,500 of this is attributed to only one trade (e.g. Short with 5X leverage, as you believed in sell in may strategy at end of April 2012 and covered at end of May 2012), then what you have is a distorted average trade figure. It’s often a good idea to remove such an exceptional single trade from the overall results and re-compute the system performance to confirm whether the trading system is good enough to trade. In real-life trading, be as realistic as possible and be prepared that you may never encounter that largest winning trade derived from the back-tested results.</li><li><strong>Losing trades:<br> </strong>This measure indicates how much of the drawdown is the result of a single losing trade. In real-life trading, this helps you adjust the initial stop loss. For example, if the average losing trade was $A 1,000 and the largest single losing trade was $A 8,000, as you would readily guess, a good portion of the average losing trade is borne by the largest losing trade.</li><li><strong>Max drawdown :<br></strong>The largest drop in Pnl or maximum negative difference in total portfolio value. It is calculated as the maximum high to the subsequent low difference before a new high is reached.</li><li><strong>Sharpe ratio :<br></strong> The reward/risk ratio or risk-adjusted returns of the strategy, calculated as Annualized Return/Annualized Volatility</li></ul><h3><strong>Backtrader results</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/0*TwN7d66e5b1TaSw5" /></figure><h3><strong>Flowchart:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r693vOlFHkyoQ3E2" /></figure><h3><strong>flow:</strong></h3><ol><li>a user of Mela will need to log in, to access the system.</li><li>After logging in, users can specify the scene parameters of the backtests they will want to run. These scene parameters will be in JSON file format and will be received by the backend once entered by the user.</li><li>Apache Kafka will then consume these scene parameters that the backend has produced. We’re going to use Backtrader’s Cerebro engine to run these backtests. It will receive data on the specific cryptocurrency to run the backtest on through an API call.</li><li>The type of indicator that will be used to run the backtests will be gotten from the scene parameter file as well. Once the backtests are run, their results will be produced in Kafka as topics (which other users can subscribe to?). Kafka will consume these topics and their contents and stream them to the back end which will then show them to the user.</li><li>The results of the metrics will also be stored in the data warehouse for easy access during the run time of the application (such that if a user requests a backtest that has already been run, it is easy to retrieve. if a user requests a backtest which has not been run, via a new indicator, a new topic will be created on Kafka and another backtest will be run).</li><li>Airflow will be used to automate backtest runs in this diagram as well as to orchestrate the movement of data from one artifact to another.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*17W4p2Snw_8-Yeqe" /></figure><ol><li>The data in the data warehouse can then be moved to the Amazon S3 Bucket for storage after the user logs out.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gh-ZBqJj7hydnRNu" /></figure><h3><strong>Entity relationship diagram:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*u3FxnUIO2uCPzoRC" /></figure><p>We will have four tables in our database. Which are the User table, Role table, Scene table, and Backtest_output table.</p><p><strong>User Table </strong>In this table we will store the user information. Each user has an id, name, email, and password. We use the Id as a primary key.</p><p><strong>Role Table </strong>This table stores the role of each user. We have admin and user roles. This table is related to the User table with the user id.</p><p><strong>Scene Table </strong>In this table we store the input parameters from the user like indicator, date range, and indicator params range. This table has a foreign key of user_id that comes from the user table.</p><p><strong>BackTest_Output Table </strong>This table is for storing the results of our backtest. It includes the return, number of trades, winning trades, losing trades, Sharpe ratio, and other results from the backtest. This table is related to the Scene table with scene_id as a foreign key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*ofPs0T8iB9sWED8oxCjkwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9lf_uqKldBE0DkRisS1FVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EOIHSr2AVj_vUx0KXo8j_w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m_eu4v0eIlB-xDkqVhqDAQ.png" /><figcaption>z</figcaption></figure><h3><strong>Lesson learned:</strong></h3><p>While working on this project I learned about some fundamental financial terms that are used in the stock market, I also build basin intuition in metrics, indicates, and backtesting.</p><h3>Future work:</h3><ul><li>complete pipeline to make data automatically go from the source to the front end without airflow using Kafka connectors.</li><li>build some ML models to learn the best strategy to implement, and build an Artificial backtrader.</li><li>use more strategies in backtrader for better results.</li><li>building an automated trading bot for crypto trading.</li></ul><h3><strong>References</strong></h3><ul><li><a href="https://keydifferences.com/difference-between-fundamental-and-technical-analysis.html">https://keydifferences.com/difference-between-fundamental-and-technical-analysis.html</a></li><li><a href="https://www.vantage-ai.com/blog/keeping-your-ml-model-in-shape-with-kafka-airflow-and-mlflow">https://www.vantage-ai.com/blog/keeping-your-ml-model-in-shape-with-kafka-airflow-and-mlflow</a></li><li><a href="https://backtest-rookies.com/2018/11/30/backtrader-on-balance-volume/#:~:text=On%2Dbalance%20volume%20(OBV),jump%20upward%2C%20and%20vice%20versa">https://backtest-rookies.com/2018/11/30/backtrader-on-balance-volume/#:~:text=On%2Dbalance%20volume%20(OBV),jump%20upward%2C%20and%20vice%20versa</a></li><li><a href="https://blog.quantinsti.com/backtrader/#:~:text=Backtrader%20is%20an%20open%2Dsource,features%20that%20facilitate%20this%20process">https://blog.quantinsti.com/backtrader/#:~:text=Backtrader%20is%20an%20open%2Dsource,features%20that%20facilitate%20this%20process</a></li><li><a href="https://medium.com/auquan/backtesting-basics-understanding-your-key-metrics-ed902c24c702">https://medium.com/auquan/backtesting-basics-understanding-your-key-metrics-ed902c24c702</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e518dbe9d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build Text to speech application]]></title>
            <link>https://medium.com/@mohammedesam.mem/how-to-build-text-to-speech-application-c033ef33710c?source=rss-c6cd146d358c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c033ef33710c</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[text-to-speech]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Mohammed EsamAldeen]]></dc:creator>
            <pubDate>Sun, 09 Oct 2022 17:06:52 GMT</pubDate>
            <atom:updated>2022-10-09T17:06:52.120Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*80j36p3fA_KwHPW2.png" /></figure><h3><strong>Introduction:</strong></h3><p>Everyone seems to have a piece of technology or software that makes their life ten times more efficient. Speech-to-text software is an incredibly accessible tech that can make typing quicker and easier.</p><p>Speech-to-text or automated speech recognition (ASR) software uses speech recognition technology to turn audio into written words.</p><p>This is useful if you need to see an audio recording down on paper, or want to dictate your ideas without typing — hands-free typing using your mobile is already quite popular. You can get more detailed ideas down quickly, without worrying about forgetting anything.</p><p>In this article, I will take you through the first step to implementing this technology.</p><h3><strong>Business objectives:</strong></h3><p>Recognizing the value of large data sets for speech-to-text data sets, seeing the opportunity that there are many text corpora for Amharic and Swahili languages, and understanding that complex data engineering skills are valuable to every Data scientist and Machine Learning engineer. To take advantage of that I will build a tool that can be deployed to process posting and receiving text and audio files from and into a data lake, apply transformation in a distributed manner, and load it into a warehouse in a suitable format to train a speech-to-text model.</p><h3><strong>Data:</strong></h3><p>I will build a data engineering pipeline that allows recording millions of Amharic and Swahili speakers reading digital texts in-app and on web platforms. There are a number of large text corpora we will use, but for the purpose of testing the backend development, I will use the recently released Amharic news text classification dataset with baseline performance dataset: <a href="https://github.com/IsraelAbebe/An-Amharic-News-Text-classification-Dataset">https://github.com/IsraelAbebe/An-Amharic-News-Text-classification-Dataset</a></p><p>You can read a brief description of the data <a href="https://arxiv.org/pdf/2103.05639.pdf">here</a>.</p><p>Alternative data:</p><p>Ready-made Amharic data was collected from different sources <a href="https://drive.google.com/file/d/1_YLX27TdACjIF1iu8e3t-kkTb1qBlLkO/view?usp=sharing">here</a>.</p><h3><strong>Exploratory data analysis (EDA):</strong></h3><p>Our dataset consists of 6 classes. The tag found this class information we get from websites and we manually verified the case and removed noises in the process. Table 3 shows a detailed description of the web pages we collected for our dataset. The web pages are local and international news sites. We have collected the datasets from different sources to increase the variety of the text.</p><p>Data frame head</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/0*DzsN12hxmD11UKKn" /></figure><p>Number of null values</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/189/0*tC1MEGTR_uKk-wnj" /></figure><p>More information about the data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/0*qRRzmxIpc0N-b2zN" /></figure><h3><strong>Used tools:</strong></h3><p><strong>Airflow</strong>Apache Airflow is an open-source workflow management platform for data engineering pipelines</p><p><strong>Dbt</strong> the T in ELT (Extract, Load, Transform) processes, and handles turning these select statements into tables and views.Orchestration: Data orchestration is the process of taking siloed data from multiple data storage locations, combining and organizing it, and making it available for data analysis tools. Data orchestration enables businesses to automate and streamline data-driven decision-making.</p><p><strong>Kafka</strong>Apache Kafka is a distributed data store optimized for ingesting and processing streaming data in real-time. Streaming data is continuously generated by thousands of data sources, which typically send the data records simultaneously. A streaming platform needs to handle this constant influx of data, and process the data sequentially and incrementally.</p><p>Kafka provides three main functions to its users:</p><ol><li>Publish and subscribe to streams of records</li><li>Effectively store streams of records in the order in which records were generated</li><li>Process streams of records in real-time</li></ol><p>Kafka is primarily used to build real-time streaming data pipelines and applications that adapt to the data streams. It combines messaging, storage, and stream processing to allow storage and analysis of both historical and real-time data.</p><p><strong>React </strong>The part of a website that the user interacts with directly is termed the front end. It is also referred to as the client side of the application. It includes everything that users experience now: text colors and styles, images, graphs and tables, buttons, colors, and a navigation menu. HTML, CSS, and JavaScript are the languages used for Front End development.</p><p>ReactJS is a <strong>declarative</strong>, <strong>efficient</strong>, and flexible <strong>JavaScript library</strong> for building reusable UI components. It is an open-source, component-based front-end library that is responsible only for the view layer of the application. It was developed and maintained by Facebook and later used in its products like WhatsApp &amp; Instagram.</p><p><strong>Flask </strong>The backend is the server side of the website. It stores and arranges data, and also makes sure everything on the client side of the website works fine. It is the part of the website that you cannot see and interact with. It is the portion of software that does not come in direct contact with the users.</p><p>Flask is a web framework, it’s a Python module that lets you develop web applications easily. It has a small and easy-to-extend core: it’s a microframework that doesn’t include an ORM (Object Relational Manager) or such features.</p><p><strong>Amazon AWS </strong>AWS (Amazon Web Services) is a comprehensive, evolving cloud computing platform provided by Amazon that includes a mixture of infrastructure as a service (IaaS), platform as a service (PaaS), and packaged software as a service (SaaS) offerings. AWS services can offer an organization tools such as compute power, database storage, and content delivery services.</p><p><strong>Spark </strong>is a data processing framework that can quickly perform processing tasks on very large data sets, and can also distribute data processing tasks across multiple computers, either on its own or in tandem with other distributed computing tools</p><p><strong>PostgreSQL </strong>is an advanced, enterprise-class open-source relational database that supports both SQL (relational) and JSON (non-relational) querying. It is a highly stable database management system,</p><h3><strong>Implementation:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/0*147tfZ3Ouhlx-c6Z" /></figure><p>The above diagram shows the process we use for our project and the steps are as follows:</p><ul><li>Connect to the AWS instance and setup the environment</li><li>We load the data and do some EDA in data so that we could understand what type of data we are dealing with</li><li>Initiatilaze Airflow and create some Dags that do loading data from CSV, build database tables based on Schema, and load data into the database after we create a unique ID for every raw.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1ndhRM7qTKAtJHSO" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mzfaPPqNYb270cR4" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UPUHkmq7UHAR4xOw" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*joFpBep785HaE1N8" /></figure><ul><li>The backend connects the database with Kafka for streaming text for end-user applications.</li><li>The backend is also integrated with Spark for voice transformation.</li><li>Kafka will do the streaming part which will share the ingested data coming from Flask and provide it in the Frontend</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/0*nATFCd105G8WlImA" /></figure><ul><li>After loading voice records from users we will do data transformation with Spark and load it into the S3 data lake using Airflow.</li></ul><h3><strong>Lesson learned:</strong></h3><p>Throughout working on this project I have built a robust intuition and Hands-on tools, I have learned how to:</p><ul><li>Build Kafka cluster</li><li>Build Apache Airflow DAGs for data manipulating</li><li>Transform voice records with Apache Spark</li><li>Build front-end applications with React</li><li>Backend development</li></ul><h3><strong>Future plan :</strong></h3><p>This is the first stage of the speech-to-text project, next stage we will train Neural network algorithms for transferring voice in Amharic into text. We will use the gathered data for training our model.</p><h3><strong>Conclusion:</strong></h3><p>This project and the upcoming ones will contribute to bridging the gap of African language representation in the AI industry and will help create helpful applications using data for the African continent.</p><p><strong>References:</strong></p><ul><li><a href="https://bernardmarr.com/what-is-kafka-a-super-simple-explanation-of-this-important-data-analytics-tool/">https://bernardmarr.com/what-is-kafka-a-super-simple-explanation-of-this-important-data-analytics-tool/</a></li><li><a href="https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html">https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html</a></li><li><a href="https://docs.databricks.com/getting-started/try-databricks.html">https://docs.databricks.com/getting-started/try-databricks.html</a></li><li><a href="https://kafka.js.org/docs/getting-started">https://kafka.js.org/docs/getting-started</a></li><li><a href="https://www.sitepoint.com/mediastream-api-record-audio/">https://www.sitepoint.com/mediastream-api-record-audio/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c033ef33710c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[First Web3 dapp]]></title>
            <link>https://medium.com/@mohammedesam.mem/first-web3-dapp-4c5ed02e53f8?source=rss-c6cd146d358c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c5ed02e53f8</guid>
            <category><![CDATA[dapps]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[algorand]]></category>
            <dc:creator><![CDATA[Mohammed EsamAldeen]]></dc:creator>
            <pubDate>Sun, 02 Oct 2022 19:21:18 GMT</pubDate>
            <atom:updated>2022-10-02T19:22:59.267Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Whvn4HclV7MdPoap.png" /></figure><p><strong>First Web3 dapp</strong></p><p><strong>What is web3 ?</strong></p><p>refers to decentralized apps that run on the blockchain. These are apps that allow anyone to participate without monetizing their personal data.</p><p><strong>Core ideas od web3 :</strong></p><p><strong>Web3 is decentralized:</strong> instead of large swathes of the internet controlled and owned by centralized entities, ownership gets distributed amongst its builders and users.</p><p><strong>Web3 is permissionless</strong>: everyone has equal access to participate in Web3, and no one gets excluded.</p><p><strong>Web3 has native payments: </strong>it uses cryptocurrency for spending and sending money online instead of relying on the outdated infrastructure of banks and payment processors.</p><p><strong>Web3 is trustless</strong>: it operates using incentives and economic mechanisms instead of relying on trusted third parties.</p><p><strong>Web 3.0 applications</strong></p><p>With blockchain at the foundation, Web 3.0 enables a growing number of different types of new applications and services to existing, including the following:</p><p><strong>NFT</strong>. Nonfungible tokens (NFTs) are tokens that are stored in a blockchain with a cryptographic hash, making the token unit unique.</p><p><strong>DeFi</strong>. Decentralized finance (DeFi) is an emerging use case for Web 3.0 where decentralized blockchain enables financial services outside the confines of traditional centralized banking infrastructure.</p><p><strong>Cryptocurrency</strong>. Cryptocurrencies like Bitcoin are Web 3.0 applications that create a new world of currency that aims to be separate from the historical world of fiat currency.</p><p><strong>dApp</strong>. Decentralized applications (dApps) are built on top of blockchain and use smart contracts to enable service delivery in a programmatic approach that is logged in an immutable ledger.</p><p><strong>Cross-chain bridges</strong>. There are multiple blockchains in the Web 3.0 world, and enabling a degree of interoperability across them is the domain of cross-chain bridges.</p><p><strong>DAOs</strong>. DAOs are set to potentially become the organizing entities for Web 3.0 services, providing some structure and governance in a decentralized approach.</p><p><strong>Objective:</strong></p><ul><li>In this project, I will build end-to-end Web3 dapps on the Algorand Blockchain that helps 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 pre-defined actions. I will use Algorand Blockchain as the foundational element of the NFT.</li></ul><p><strong>What Is Algorand?</strong></p><p>Algorand (ALGO) is both a digital currency and blockchain platform. The Algorand platform is designed to process many transactions quickly, similar to major payment processors like Mastercard or Visa. In addition, 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.</p><p>Algorand is an open-source blockchain, meaning anyone can view and contribute to the platform’s code. Algorand uses an operating protocol it calls pure proof-of-stake (PPoS), which recruits network validators from the pool of users.</p><p><strong>Algroeand blockchain states?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xfnqSMyBhxXe1vfR" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QsJSezPTB-ERkRqj" /></figure><p>A modern full-stack app consists of two major modules: frontend and backend. We typically display interactive UI elements through the app’s frontends built with React. On the other side, the backend persists and retrieves data in a remote server computer.</p><p><strong>Making first Transaction with Algorand python SDK:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/0*6crYRPkg-Td1yBSW" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/0*KBEOosOshG4bDzXa" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/0*DaWXPLoNy9FymT9Z" /></figure><p><strong>Web dapp Used technology :</strong></p><ul><li><strong>Frontend:</strong>For the frontend I used React Js</li><li><strong>Backend:</strong>For the Backend I used Fastapi</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*ehJ2AYztZqZtCE7LZjc9DA.png" /></figure><p><strong>Learned lessons :</strong></p><p>Working on this project introduced me to Web3’s important technology and I have interacted with Algorand blockchain and learned how to make transactions and create NFT assets.</p><p>I also learned how to build web3 apps with different technologies in the front and back ends like React and Fastapi respectively.</p><p>I have built a robust foundation in Web3 Industry with and on projects in Algorand Blockchain.</p><p><strong>Future plans:</strong></p><p>I intend to build a web3 dapp to let people of western Sudan -who come from minority communities and places of war- sell their organic products directly to the end users globally and let the people grow communities together in a decentralized way</p><p><strong>References</strong></p><ul><li><a href="https://developer.algorand.org/docs/sdks/python/">https://developer.algorand.org/docs/sdks/python/</a></li><li><a href="https://www.freecodecamp.org/news/how-to-consume-rest-apis-in-react/">https://www.freecodecamp.org/news/how-to-consume-rest-apis-in-react/</a></li><li><a href="https://purestake.github.io/algosigner-dapp-example/index.html">https://purestake.github.io/algosigner-dapp-example/index.html</a></li><li><a href="https://testdriven.io/blog/fastapi-react/">https://testdriven.io/blog/fastapi-react/</a></li><li><a href="https://reactjs.org/tutorial/tutorial.html#setup-option-2-local-development-environment">https://reactjs.org/tutorial/tutorial.html#setup-option-2-local-development-environment</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c5ed02e53f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building your First Data Pipeline (1)]]></title>
            <link>https://medium.com/@mohammedesam.mem/building-your-first-data-pipeline-1-c72a1e33675f?source=rss-c6cd146d358c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c72a1e33675f</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[airflow]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <dc:creator><![CDATA[Mohammed EsamAldeen]]></dc:creator>
            <pubDate>Sun, 25 Sep 2022 17:43:41 GMT</pubDate>
            <atom:updated>2022-09-25T17:43:41.196Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wU8zLMXNafwMdPjwwpvzZw.png" /></figure><p>basic walkthrough on how to build your first pipeline and the tools you will be using</p><p><strong>Introduction:</strong></p><p>Modern data pipelines enable your business to quickly and efficiently unlock the data within your organisation. They allow you to extract information from its source, transform it into a usable form, and load it into your systems where you can use it to make insightful decisions. Do it well and you will benefit from faster innovation, higher quality (with improved reliability), reduced costs, and happy people. Do it badly, and you could lose a great deal of money, miss vital information, or gain completely incorrect information.</p><h3><strong>Project context :</strong></h3><p>A city traffic department wants to collect traffic data using swarm UAVs (drones) from several locations in the city and use the data collected for improving traffic flow in the city and for several other undisclosed projects. I will create a scalable data warehouse to host the vehicle trajectory data extracted by analyzing footage taken by swarm drones and static roadside cameras.</p><p><strong>And I will consider the following:</strong></p><ul><li>The warehouse should be able to deliver future needs.</li><li>Data must be well organized so that a number of downstream projects query the data efficiently.</li><li>I will be using Extract Load Transform (ELT) framework using DBT. Because it helps analytic engineers in the city traffic department set up transformation workflows on a need basis</li></ul><h3><strong>Methodologies:</strong></h3><ul><li><strong>ELT: </strong>it stands for Extract Load and Transform, and it describes the sequence of moving data to our warehouse and performing some transformations to make it ready to use by data scientists’ BI teams.</li><li><strong>Dbt (Data building Tool): </strong>do the T in ELT (Extract, Load, Transform) processes, and handles turning these select statements into tables and views.</li><li><strong>Orchestration: </strong>Data orchestration is the process of taking siloed data from multiple data storage locations, combining and organizing it, and making it available for data analysis tools. Data orchestration enables businesses to automate and streamline data-driven decision-making.</li><li><strong>PostgreSQL:</strong> is an advanced, enterprise-class open source relational database that supports both SQL (relational) and JSON (non-relational) querying. It is a highly stable database management system,</li><li><strong>Docker: </strong>is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.</li><li><strong>Airflow:</strong> Apache Airflow is an open-source workflow management platform for data engineering pipelines</li><li><strong>Snowflake</strong>: a fully managed SaaS (software as a service) that provides a single platform for data warehousing, data lakes, data engineering, data science, data application development, and secure sharing and consumption of real-time / shared data.</li><li><strong>DAGs: </strong>In Airflow, data pipelines are defined in Python code as directed acyclic graphs, also known as DAGs. Within a graph, each node represents a task that completes a unit of work, and each edge represents a dependency between tasks.</li><li><strong>Redash: </strong>is an open-source web application. It’s used for clearing databases and visualizing the results</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zC77sSV5YBlXbf-OutV7FQ.png" /></figure><h3><strong>Data:</strong></h3><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>You may refer to the following references to understand how the data is generated from video frames recorded with swarm drones.</p><ul><li><a href="https://datafromsky.com/wp-content/uploads/2015/03/PIA15_poster.pdf">PIA15_poster.pdf (datafromsky.com)</a></li></ul><p>You may use the following GitHub packages to visualize and interact with the data (and obtain other similar data)</p><ul><li><a href="https://github.com/tud-hri/travia">tud-hri/travia: a Traffic data Visualization and Annotation tool (github.com)</a></li></ul><h3><strong>Airflow:</strong></h3><p>After downloading data we should set up airflow for automating our pipeline. We used Docker compose to run Airflow image file. I will not walk you through installing procedures but you could follow this <a href="https://towardsdatascience.com/run-airflow-docker-1b83a57616fb">Article </a>for more details.</p><p>Secondly, we will write our DAGs to do 2 specific tasks:</p><p>1-build our database table in postgresql.</p><p>2- Load data from the source into our postgresql database.</p><p>Therefore we will use airflow operators which simply are the building blocks of Airflow DAGs. They contain the logic of how data is processed in a pipeline. Each task in a DAG is defined by instantiating an operator. We will use Python, Postgres, and Bash operators.</p><p>DAG code will be like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/0*hLESk0ByixLEg69T" /></figure><p>After running airflow our DAGs should appear in Airflow dashboard with more details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_53ZMeUdX2h9cmYLH8Ol1w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VKe9mvucNjWklPE4ZXOX4Q.png" /><figcaption>Airflow dashboard</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CpQuPC23BDGbx5jEX00yjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VDaJbgKcmNz18Tg31AStVg.png" /></figure><h3><strong>Dbt (Data building tool) :</strong></h3><p>In the Transformation stage, we will initiate dbt also with docker. We will write code for transforming our data like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/0*phgeGl8jKpIn0YVX" /></figure><h3><strong>Obstacles with recommendations :</strong></h3><p>Device capability was the number one barrier, Docker need at least 4 GB of ram to run efficiently, with windows that were almost impossible for my device. So in the future, one of the solutions will be switching to building data pipelines with Airflow.</p><p>Ports configuration, all Airflow, dbt, and Redash face post configuration problems each.</p><p>Configuring the optimal ports beforehand will save time and effort in building pipelines.</p><h3>References:</h3><ul><li><a href="https://aws.amazon.com/docker/"><strong>https://aws.amazon.com/docker/</strong></a></li><li><a href="https://www.astronomer.io/guides/dags/"><strong>https://www.astronomer.io/guides/dags/</strong></a></li><li><a href="https://aws.amazon.com/rds/postgresql/what-is-postgresql/"><strong>https://aws.amazon.com/rds/postgresql/what-is-postgresql/</strong></a></li><li><a href="https://www.astronomer.io/guides/what-is-an-operator/"><strong>https://www.astronomer.io/guides/what-is-an-operator/</strong></a></li><li><a href="https://towardsdatascience.com/run-airflow-docker-1b83a57616fb"><strong>https://towardsdatascience.com/run-airflow-docker-1b83a57616fb</strong></a></li><li><a href="https://www.youtube.com/watch?v=25X0oh-H_mk"><strong>https://www.youtube.com/watch?v=25X0oh-H_mk</strong></a></li><li><a href="https://www.youtube.com/watch?v=8FZZivIfJVo"><strong>https://www.youtube.com/watch?v=8FZZivIfJVo</strong></a></li><li><a href="https://livebook.manning.com/book/data-pipelines-with-apache-airflow/chapter-1/v-6/"><strong>https://livebook.manning.com/book/data-pipelines-with-apache-airflow/chapter-1/v-6/</strong></a></li><li><a href="https://www.snaplogic.com/blog/snowflake-data-platform"><strong>https://www.snaplogic.com/blog/snowflake-data-platform</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c72a1e33675f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prompt Engineering]]></title>
            <link>https://medium.com/@mohammedesam.mem/prompt-engineering-9f70f5ec42d4?source=rss-c6cd146d358c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f70f5ec42d4</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Mohammed EsamAldeen]]></dc:creator>
            <pubDate>Sun, 18 Sep 2022 18:43:01 GMT</pubDate>
            <atom:updated>2022-09-18T18:44:58.124Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*i8q5s6Y-_i1HO37li9-rtQ.png" /></figure><h3><strong>Background:</strong></h3><ul><li>Large Language Models coupled with multiple AI capabilities are able to generate images and text, and also approach/achieve human-level performance on a number of tasks. The world is going through a revolution in art (DALL-E, MidJourney, Imagine, etc.), science (AlphaFold), medicine, and other key areas, and this approach is playing a role in this revolution</li><li>In-context learning, popularized by the team behind the GPT-3 LLM, brought a new revolution for using LLMs in many tasks that the LLM was originally not trained for. This stands in contrast to the usual fine-tuning that used to be required to equip AI models to improve performance in tasks they were not trained for.</li><li>With in-context learning, LLMs are able to constantly adjust their performance on a task depending on the prompt — from structured input that can be considered partly a few-shot training and partly a test input. This has opened up many applications.</li><li>This week’s challenge is to systematically explore strategies that help generate prompts for LLMs to extract relevant entities from job descriptions and also to classify web pages given only a few examples of human scores. You will be also required to compare responses and accuracies of multiple LLM models for given prompts.</li></ul><h3><strong>Project Overview:</strong></h3><ul><li>We want to build a system to score new given artifacts against a topic. Data is collected from web pages, tweets, Facebook posts, etc.</li><li>The score range is from 0–10, where a score of 0 means the news item is totally NOT relevant while a score of 10 means the news item is very suitable.</li><li>We give recommendation if LLMs models like GPT3 is suitable for the job or not.</li><li>If our recommendation were positive will build an MLOps pipeline that helps automate the task of using different LLMs and different topics, besides allowing future improvements</li></ul><h3><strong>Methodologies:</strong></h3><ul><li><strong>Cohere API:</strong>s centered around models. Each model has a different amount of power (i.e. parameters), to be used for different tasks. Cohere has three baseline models: small, medium, and large. Cohere also supports finetuning of baseline models to improve performance on downstream tasks or to teach the model large quantities of information that cannot be extracted with few-shot learning or prompt engineering.</li><li><strong>MLflow: </strong>is an open-source platform for managing the end-to-end machine learning lifecycle. It has the following primary components:</li><li>Tracking: Allows you to track experiments to record and compare parameters and results.</li><li>Models: Allow you to manage and deploy models from a variety of ML libraries to a variety of model serving and inference platforms.</li><li>Projects: Allow you to package ML code in a reusable, reproducible form to share with other data scientists or transfer to production.</li><li>Model Registry: Allows you to centralize a model store for managing models’ full lifecycle stage transitions: from staging to production, with capabilities for versioning and annotating.</li><li>Model Serving: Allows you to host MLflow Models as REST endpoints.</li><li><strong>DVC:</strong> is a new type of data versioning, workflow, and experiment management software, that builds upon Git (although it can work stand-alone). DVC reduces the gap between established engineering toolsets and data science needs, allowing users to take advantage of new features while reusing existing skills and intuition.</li></ul><h3><strong>Types of data used :</strong></h3><p>There are two datasets you will use for this project</p><ul><li><strong>Data 1:</strong></li></ul><p>This data comes from the client described above. The columns of this data are as follows:</p><ul><li><strong>Domain</strong> — the base URL or a reference to the source this item comes from</li><li><strong>Title</strong> — title of the item — the content of the item</li><li><strong>Description</strong> — the content of the item</li><li><strong>Body</strong> — the content of the item</li><li><strong>Link</strong> — URL to the item source (it may not functional anymore sometime)</li><li><strong>Timestamp</strong> — timestamp that this item was collected at</li><li><strong>Analyst_Average_Score</strong> — target variable — the score to be estimated</li><li><strong>Analyst_Rank</strong> — score as rank</li><li><strong>Reference_Final_Score</strong> — Not relevant for now — it is a transformed quantity</li><li><strong>Data 2:</strong></li><li>The data are job descriptions ( together named entities) and relationships between entities in JSON format.</li></ul><h3><strong>Word Embedding</strong>:</h3><ul><li><strong>Word embeddings</strong> are a type of word representation that allows words with similar meanings to have a similar representation.</li><li><strong>Word2vec </strong>is a word embedding type of vector space model that takes as input the linguistic context of words in some corpus of text and outputs an N-dimensional space of these words where each word is represented as a vector of dimension N in that space. Word2vec model projects feature on a plane, which is very hard to see in the raw data. Words can be projected on the vector space so that semantic relations of various types of words are easily seen.</li></ul><h3><strong>In-context Learning:</strong></h3><ul><li><strong>What is in-context learning</strong>? Is a way to use language models to learn tasks given only a few examples. During in-context learning, we give the LM a prompt that consists of a list of input-output pairs that demonstrate a task. At the end of the prompt, we append a test input and allow the LM to make a prediction just by conditioning the prompt and predicting the next tokens. To correctly answer the two prompts below, the model needs to read the training examples to figure out the input distribution output distribution, input-output mapping, and formatting.</li></ul><h3><strong>Fin-tuning:</strong></h3><ul><li><strong>What does fine-tuning mean? </strong>Fine-tuning in NLP refers to the procedure of re-training a pre-trained language model using your own custom data. As a result of the fine-tuning procedure, the weights of the original model are updated to account for the characteristics of the domain data and the task you are interested in.</li></ul><h3><strong>Zero-shot learning</strong></h3><ul><li>Zero-shot learning is the challenge of learning modeling without using data labeling. Zero-shot learning involves little human intervention, and the models depend on previously trained concepts and additional existing data. This method reduces the time and effort that data labeling takes. Instead of giving training examples, zero-shot learning gives a high-level description of new categories so that the machine can relate them to existing categories that the machine has learned about. Zero-shot learning methods can be used in computer vision, natural language processing, and machine perception.</li></ul><h3><strong>One-shot learning:</strong></h3><ul><li>One-shot learning performs classification tasks using past data. Facial recognition technology, including facial verification and identification, usually uses one-shot learning. Facial recognition systems learn face embedding, which is a rich low-dimensional feature representation. One-shot learning has been using the Siamese network approach. Eventually, Siamese networks were compared to comparative loss functions, after which the triplet loss function was proven to be better and the FaceNet system began using them. Contrastive loss and triplet loss functions are now used for high-quality face embeddings, which have become the foundation for modern facial recognition.</li></ul><h3><strong>Few-shot learning:</strong></h3><ul><li>Few-shot learning, also known as low-shot learning, uses a small set of examples from new data to learn a new task. The process of few-shot learning deals with a type of machine learning problem specified by say E, and it consists of a limited number of examples with supervised information for a target T. Few-shot learning is commonly used by OpenAI as GPT3 is a few-shot learner.</li><li>There are two ways to approach few-shot learning:</li><li>Data-level approach: According to this process, if there is insufficient data to create a reliable model, one can add more data to avoid overfitting and underfitting. The data-level approach uses a large base dataset for additional features.</li><li>Parameter-level approach: Parameter-level method needs to limit parameter space and use regularisation and proper loss functions to resolve the overfitting problem in few-shot learning. This will generalize the limited training samples. This approach can also improve model performance by directing it to the extensive parameter space. A parameter-level approach is useful because a smaller amount of training data will not give reliable results.</li></ul><h3><strong>Prompt Engineering:</strong></h3><ul><li><strong>What is prompt-based learning</strong>? Prompt-based learning is an emerging group of ML model training methods. In prompting, users directly specify the task they want to complete in natural language for the pre-trained language model to interpret and complete</li></ul><h3>References:</h3><ul><li><a href="https://thegradient.pub/prompting/">https://thegradient.pub/prompting/</a></li><li><a href="https://analyticsindiamag.com/how-do-zero-shot-one-shot-and-few-shot-learning-differ/">https://analyticsindiamag.com/how-do-zero-shot-one-shot-and-few-shot-learning-differ/</a></li><li><a href="https://towardsdatascience.com/fine-tuning-for-domain-adaptation-in-nlp-c47def356fd6">https://towardsdatascience.com/fine-tuning-for-domain-adaptation-in-nlp-c47def356fd6</a></li><li><a href="https://arxiv.org/abs/2109.06977">https://arxiv.org/abs/2109.06977</a></li><li><a href="https://cohere.ai/">https://cohere.ai/</a></li><li><a href="https://mlflow.org/">https://mlflow.org/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f70f5ec42d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>