<?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 Ahmad Droobi on Medium]]></title>
        <description><![CDATA[Stories by Ahmad Droobi on Medium]]></description>
        <link>https://medium.com/@ahmad.droobi1999?source=rss-dda8d032037c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*AEaVsOMoCht4wtjfLatCag.jpeg</url>
            <title>Stories by Ahmad Droobi on Medium</title>
            <link>https://medium.com/@ahmad.droobi1999?source=rss-dda8d032037c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 18:27:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ahmad.droobi1999/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[**From Scalar Fields to SPI Packets: A Framework for Reverse-Engineering Any Scientific Paper**]]></title>
            <link>https://medium.com/@ahmad.droobi1999/from-scalar-fields-to-spi-packets-a-framework-for-reverse-engineering-any-scientific-paper-b81b62f78113?source=rss-dda8d032037c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b81b62f78113</guid>
            <dc:creator><![CDATA[Ahmad Droobi]]></dc:creator>
            <pubDate>Thu, 20 Aug 2026 02:37:33 GMT</pubDate>
            <atom:updated>2026-08-20T02:37:33.864Z</atom:updated>
            <content:encoded><![CDATA[<p>A practical method for going from abstract mathematics and physics all the way to algorithms, sensors, electronics, software, and real-world engineering systems.</p><p>— -</p><p>You’ve been staring at a dense paper for hours. Somewhere on page three sits the symbol</p><p>\[ \phi(x) \]</p><p>A few sections later the authors are talking about measurements, numerical solvers, GPU benchmarks, or experimental results. You understand the individual equations well enough, yet you still cannot answer the only questions that matter to an engineer:</p><p>What does this actually *do*? <br>How would I measure it? <br>What sensor produces the data? <br>How do those bits become a decision that moves a robot, cools a processor, or estimates a state?</p><p>Ordinary summarization does not close that gap. A paper is a compressed representation of a much larger system of knowledge. The useful skill is not reading the text linearly. It is reverse-engineering the chain of representations that runs from abstract mathematics down to physical reality — and back up again.</p><p>That is the method presented here.</p><p>— -</p><p>### Why Ordinary Reading Fails</p><p>A research paper can pack years of mathematics, physics, algorithm design, hardware choices, software architecture, experimental methodology, and domain knowledge into twenty pages. The result is that symbols appear disconnected from the systems they ultimately describe.</p><p>A better mental model looks like this:</p><p>```<br> PAPER<br> │<br> ┌─────────────┼─────────────┐<br> ↓ ↓ ↓<br> PROBLEM THEORY PRIOR WORK<br> │ │ │<br> └─────────────┼─────────────┘<br> ↓<br> MODEL<br> ↓<br> ALGORITHM<br> ↓<br> HARDWARE + SOFTWARE<br> ↓<br> DATA<br> ↓<br> EXPERIMENT<br> ↓<br> RESULTS<br> ↓<br> LIMITATIONS<br> ↓<br> ENGINEERING<br> ↓<br> REAL WORLD<br>```</p><p>A summary tells you what the authors wrote. <br>A reverse-engineering analysis tells you how the thing works, where it can be measured, how it can be implemented, and where it will break.</p><p>— -</p><p>### The Abstraction Ladder</p><p>The central organizing tool is a bidirectional ladder that runs between everyday engineering and pure mathematics:</p><p>```<br>ABSTRACT MATHEMATICS<br> ↕<br> GEOMETRY<br> ↕<br> PHYSICAL THEORY<br> ↕<br> MATHEMATICAL MODEL<br> ↕<br> ALGORITHM<br> ↕<br>DIGITAL REPRESENTATION<br> ↕<br> ELECTRICAL SIGNAL<br> ↕<br> SENSOR / ACTUATOR<br> ↕<br> ENGINEERED SYSTEM<br> ↕<br> REAL / EVERYDAY WORLD<br>```</p><p>You can travel in either direction.</p><p>- Bottom-up: start with a thermostat, a LiDAR, or a robot arm and ask what mathematics ultimately describes it. <br>- Top-down: start with a scalar field, a manifold, a Hamiltonian, or a functional and ask how it could eventually become something an engineer measures or builds.</p><p>The power of the method lies in forcing the model (or yourself) to keep moving until the abstract object is connected to a concrete signal, register, or actuator.</p><p>— -</p><p>### “What Kind of Thing Is This?”</p><p>When a paper introduces \(\phi(x)\), do not begin by asking “What does phi mean?” Begin by classifying the mathematical object.</p><p>Construct a short identity card:</p><p>- **Symbol**: \(\phi\) <br>- **Type**: scalar field <br>- **Domain**: \(x \in M\) (What is \(M\)? A vector space? A manifold? Spacetime? A computational grid?) <br>- **Codomain**: \(\mathbb{R}\) <br>- **Structure**: smoothness, topology, metric, symmetries, boundary conditions <br>- **Operations**: gradient, divergence, Laplacian, variation, integration <br>- **Physical interpretation**: potential, temperature, density, probability amplitude, electromagnetic quantity… (paper-dependent) <br>- **Measurement relationship**: Is \(\phi\) directly observable? If not, what observable depends on it?</p><p>This single habit — treating every important symbol as a typed object with a domain, geometry, and measurement relationship — turns isolated equations into nodes in a larger system.</p><p>— -</p><p>### Mathematical Lineage and Geometry</p><p>Theoretical papers become far less mysterious once you reconstruct the dependency graph:</p><p>```<br>Axiom / Definition<br> ↓<br> Assumption<br> ↓<br>Lemma / Theorem<br> ↓<br> Model / Equation<br> ↓<br>Numerical Approximation<br> ↓<br> Algorithm<br> ↓<br>Simulation / Computation<br> ↓<br>Measurement / Validation<br>```</p><p>Equally important is locating the geometry in which the mathematics lives:</p><p>```<br>Number → Vector → Vector space → Inner-product space<br>→ Metric space → Manifold → Tangent space → Cotangent space<br>→ Tensor field → Connection → Curvature<br>```</p><p>A robot’s configuration space is a manifold. A temperature field lives over a spatial domain. A quantum state lives in a Hilbert space. Once the underlying space is identified, many equations stop looking arbitrary.</p><p>— -</p><p>### Frames, Symmetry, and Engineering Consequences</p><p>Physics papers require one more question: relative to what?</p><p>```<br>Reference frame<br> ↓<br>Coordinates<br> ↓<br>Basis<br> ↓<br>Metric<br> ↓<br>Transformation<br> ↓<br>Invariant quantity<br> ↓<br>Measurement<br>```</p><p>Symmetry analysis provides one of the cleanest bridges from theory to engineering:</p><p>```<br>Symmetry<br> ↓<br>Transformation<br> ↓<br>Invariant<br> ↓<br>Conservation law<br> ↓<br>Physical constraint<br> ↓<br>Engineering consequence<br>```</p><p>Time-translation symmetry yields energy conservation. Energy conservation becomes an energy balance. The energy balance becomes power. Power is voltage times current. Voltage and current become quantities that power electronics, batteries, motors, and thermal management systems must handle. The distance between Noether’s theorem and a power-supply design is shorter than it first appears.</p><p>— -</p><p>### From Fields and PDEs to Sensors</p><p>This is the most useful universal pipeline in the entire framework:</p><p>```<br>FIELD<br>φ(x,t)<br> ↓<br>DYNAMICS<br>∂φ/∂t = F(φ, θ)<br> ↓<br>PARAMETERS<br>θ<br> ↓<br>OBSERVABLE<br>y = h(φ, θ)<br> ↓<br>SENSOR<br>z = y + noise<br> ↓<br>ANALOG SIGNAL → ADC<br> ↓<br>DIGITAL DATA / REGISTER<br> ↓<br>BUS (SPI / I²C / UART / CAN)<br> ↓<br>DRIVER → SOFTWARE VARIABLE<br> ↓<br>ESTIMATOR / ALGORITHM<br> ↓<br>φ̂(x,t), θ̂<br> ↓<br>DECISION / CONTROL / ACTUATION<br>```</p><p>A concrete temperature example:</p><p>```<br>Temperature field T(x,t)<br> ↓<br>Heat equation / thermal model<br> ↓<br>Parameters (conductivity, heat capacity…)<br> ↓<br>Thermistor / RTD / thermocouple<br> ↓<br>Resistance → Voltage<br> ↓<br>ADC<br> ↓<br>I²C or SPI register<br> ↓<br>Driver → floating-point array<br> ↓<br>Kalman filter or numerical solver<br> ↓<br>Estimated temperature → thermostat or thermal control loop<br>```</p><p>The same pattern appears in LiDAR time-of-flight (photon arrival → detector → TDC → point cloud → perception → vehicle control) and in robot arms (configuration manifold → forward/inverse kinematics → joint encoders over SPI or CAN → state estimation → torque commands).</p><p>A PDE is never the endpoint. It is the beginning of an implementation chain that ends in sensors, buses, and software variables.</p><p>— -</p><p>### The Bottom of the Ladder: Signals, Buses, and Code</p><p>Extremely abstract science eventually terminates in something as mundane as a digital bus. That is a feature, not a bug.</p><p>The information-loss ladder makes the cost of every transformation explicit:</p><p>```<br>REALITY<br> ↓<br>Physical phenomenon<br> ↓<br>Sensor<br> ↓<br>Analog signal<br> ↓<br>Sampling<br> ↓<br>Quantization<br> ↓<br>Compression / feature extraction<br> ↓<br>Model<br> ↓<br>Decision<br>```</p><p>At every arrow ask: What information was lost? What assumptions were introduced?</p><p>Errors receive the same treatment. Trace them from physical source through sensor, signal, digital representation, algorithmic propagation, and finally to engineering consequence. The result is a real error budget rather than a vague “limitations” paragraph.</p><p>— -</p><p>### Observability, Causality, and the Three-Axis Model</p><p>A mathematical model can contain thousands of variables while the physical system exposes only a few measurements. That is the observability problem:</p><p>```<br>Hidden state → Physical state → Observable → Sensor → Measurement → Estimator → Estimated state<br>```</p><p>The critical engineering question is simply: Can the hidden state actually be reconstructed from the available sensors?</p><p>The same systems can be located on three independent axes:</p><p>- **Abstraction**: abstract mathematics → theory → model → physics → engineering → device → reality <br>- **Scale**: quantum → atomic → material → device → subsystem → machine → environment <br>- **Representation**: continuous → discretized → sampled → quantized → digital → software</p><p>When you encounter a new concept, ask where it sits on each axis. Then zoom:</p><p>- Zoom out: What larger theory does this belong to? <br>- Zoom in: What does this concept contain? <br>- Zoom down: How is it implemented? <br>- Zoom up: What larger system uses it?</p><p>— -</p><p>### Theory → Experiment → Product</p><p>Every theoretical prediction must eventually connect to an instrument:</p><p>```<br>Theory → Prediction → Observable → Experimental quantity → Instrument → Measurement → Noise model → Statistical inference → Comparison<br>```</p><p>The same chain continues to a product. Electromagnetic theory becomes wave propagation, antenna models, RF circuits, radio modules, wireless subsystems, Wi-Fi routers, networks, phones, and human communication. Geometry becomes camera models, feature extraction, neural networks, object detection, and robot perception. Mechanics becomes rigid-body dynamics, state estimation, control, motor commands, and robot motion.</p><p>— -</p><p>### A Practical Reading Checklist</p><p>Next time you open a paper, work through these questions in order:</p><p>1. What real-world problem would still exist if this paper had never been written? <br>2. What is the central mathematical object, and what *kind* of thing is it? <br>3. What geometric space and frame of reference does it live in? <br>4. What physical quantity or phenomenon does it ultimately describe? <br>5. What can actually be measured, and by what sensor? <br>6. How does that measurement become bits (ADC, bus protocol, register)? <br>7. What algorithm turns those bits into an estimate or decision? <br>8. Where does the method fail — assumptions, edge cases, information loss? <br>9. Could I prototype a simplified version of this system with the hardware and software I already know? <br>10. What is the single biggest bottleneck preventing a 10× improvement?</p><p>These ten questions turn the frameworks into a repeatable habit.</p><p>— -</p><p>### The Final Universal Map</p><p>The entire method can be summarized in one bidirectional diagram:</p><p>```<br>ABSTRACT MATHEMATICS<br> │<br> ↓<br> GEOMETRY<br> │<br> ↓<br> PHYSICAL THEORY<br> │<br> ↓<br> FIELD / STATE<br> │<br> ↓<br> PARAMETERS<br> │<br> ↓<br> DYNAMICS<br> │<br> ↓<br> OBSERVABLE<br> │<br> ↓<br> MEASUREMENT<br> │<br> ↓<br> SENSOR<br> │<br> ↓<br> SIGNAL<br> │<br> ↓<br> ELECTRONICS<br> │<br> ↓<br> ADC / BUS<br> │<br> ↓<br> DIGITAL DATA<br> │<br> ↓<br> ALGORITHM<br> │<br> ↓<br> SOFTWARE<br> │<br> ↓<br> ESTIMATION<br> │<br> ↓<br> DECISION<br> │<br> ↓<br> CONTROL<br> │<br> ↓<br> ACTUATION<br> │<br> ↓<br> ENGINEERED SYSTEM<br> │<br> ↓<br> EVERYDAY WORLD<br>```</p><p>And the reverse direction is equally important.</p><p>— -</p><p>### The Ultimate Question</p><p>When you encounter an intimidating object — a manifold, a tensor, a Hamiltonian, a Lagrangian, a scalar field, a Hilbert space, a Green’s function, a functional, an operator, or a probability distribution — do not simply memorize its definition. Ask the sequence:</p><p>What is it? <br>Where does it live? <br>What structure does it have? <br>What does it represent? <br>What assumptions define it? <br>What equations govern it? <br>What can be calculated from it? <br>What can be observed? <br>What instrument could measure that observable? <br>How does the measurement become data? <br>What algorithm processes that data? <br>What engineering decision does the result enable? <br>Where does that decision eventually appear in the physical world?</p><p>That sequence turns a symbol into a system.</p><p>A scalar field can become a PDE. <br>A PDE can become a numerical solver. <br>A solver can become an estimator. <br>An estimator can consume sensor measurements that arrive over SPI. <br>Those packets become variables in a program. <br>The program can drive a controller. <br>The controller can command a motor. <br>And the motor can move a robot.</p><p>The distance from abstract mathematics to everyday engineering is not a collection of disconnected subjects. It is a chain of representations. Learning to traverse that chain — forward and backward — is one of the most powerful ways to read papers, understand repositories, learn new fields, and ultimately build systems yourself.</p><p>Start reverse-engineering instead of merely reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b81b62f78113" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recruit Restaurant Visitor Forecasting]]></title>
            <link>https://medium.com/@ahmad.droobi1999/recruit-restaurant-visitor-forecasting-c632f6a691ac?source=rss-dda8d032037c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c632f6a691ac</guid>
            <dc:creator><![CDATA[Ahmad Droobi]]></dc:creator>
            <pubDate>Tue, 11 Oct 2022 04:51:26 GMT</pubDate>
            <atom:updated>2022-10-11T04:51:26.096Z</atom:updated>
            <content:encoded><![CDATA[<p>(Step by Step Data Science Project)</p><h3>🥘🌮🥩🥪🍿🦀🧆🥙</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*_oWvcAs4Xe34kefEW3yraQ.png" /></figure><p>Predict how many future Employees a restaurant will hire, based on number of visitors and other feature, In this article I reached an answer to the number of visitors per day predicted to visit a specific restaurant, and base on that the Manager will hire the required stuff for each task .</p><p>The Data Science Project Life cycle.</p><ol><li>identify the problem.</li><li>write down keywords and start searching (Googling, reading articles, papers, videos, documentations).</li><li>know the business domain you are working on, that will help you to know your problem better, and wider (point 1).</li><li>find the right Data (the hardest part).</li><li>working with Data (data visualization, data cleaning, data representation, finding patterns and correlations).</li><li>Feature Engineering (the time to connect point 1 with 5).</li><li>choose a ML model (it’s experimental in nature).</li><li>validate the best Machine learning model (find MSE, P-value, etc.…).</li><li>when choosing a model we must consider its performance, the system <a href="https://www.google.com/search?sxsrf=ALiCzsY_T5hNFfBU_uRTvFaR3J5XYrWWvw:1664862221135&amp;q=architecture&amp;spell=1&amp;sa=X&amp;ved=2ahUKEwjIoqmK78X6AhUt_rsIHW7sAJ0QkeECKAB6BAgBEDQ"><strong><em>architecture</em></strong></a>, pipelining, some SWE solutions.</li><li>convert the model to Django, Flask, Node.js</li><li>Deployment, and MLOps.</li><li>keep Research and Developing your model(adding more features, or deleting some of them, testing the data if your application real time, connecting some experiments with each other (point 7).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5NVPSoIIH24dNbI3gCvIUw.png" /><figcaption>Data Science life Cycle</figcaption></figure><h4>🍓 In this article I will go a step by step to Data science project I am working on in the last 10 months.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rN1LLwjNTi7yX7rrYqV--Q.jpeg" /><figcaption>Simpler Approach</figcaption></figure><p>🥥🥥 Now I will go throw the Life cycle of the project (the 12 points): :/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1QWjrbDymezGY_6sGLYrGQ.png" /><figcaption>tracking the project (12 stages)</figcaption></figure><blockquote>✔✔ <strong><em>①+②</em></strong> ➳➳ <strong>To define your Problem</strong> you have to be <strong>Excellent communicator,</strong> <strong>attention to details</strong>, <strong>ask you manager, Colleagues, sometimes the business owners</strong> and <strong>product to summarize to where to search</strong>, and the constrains of the product that<strong> you have to deliver in the end.</strong></blockquote><p>🍒<strong>In the project that I work on</strong> the problem was to predict # of Employees Restaurants/Retails will hire at a specific day (like predict something in the future), based on history of two years before.</p><p>🍒<strong>The Problem</strong>: Prediction -&gt; for specific -&gt;Forecasting -&gt;more specific -&gt;Demand forecasting -&gt;… (here you keep Googling and reading till you have a system understanding.</p><p>🍒<strong>asking Manager (training Supervisor)</strong>-&gt; Directing to recourses to read from, Courses →Time series -&gt;data Visualization -&gt;data cleaning -&gt;Feature Engineering -&gt;ML Algorithms (you will use them in training).</p><p>🍒<strong>the process of “ASKING “</strong>I would like to descript it, in the End you are storyteller, the more you could explain it to someone outside the technical industry, the more you willing to find a solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*cezTl-V5NRhZCQDLJvPQ4Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*lTm4Ch_3kqoVhhccKTVSFQ.jpeg" /><figcaption>Understanding the Problem and the business domain</figcaption></figure><p><strong><em>✔③ ➳➳</em></strong></p><h4>🍓 <strong><em>The business domain</em></strong> of the problem was Companies, Restaurants, and Retails talent attraction, workforce management, employee engagement and compliance technologies enable organizations to intelligently attract, <strong>manage, engage and retain the best talent to run and improve their business.</strong></h4><p>for specific I want to predict and analyze the features I need to go and find the right Data (next Step)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S7oReeUeYd7Y6E_pcrC7lw.png" /></figure><p>✔<strong><em>④ ➳➳</em></strong></p><h4>🍓 <strong>The Data Part was the more challenging part</strong>, how? in <strong>time series</strong> problems the more data you have the more the model will understand the behavior of the business, if you want to predict the number of employees you should two things in consideration:</h4><blockquote>First the Features you will add (weekends, the summer holiday, the End of year holiday, the location, the branch of the restaurant, type of food it offers, etc.…),</blockquote><blockquote>Secondly, the size and consistency of data for each restaurant, the data I found at Kaggle not as I imagined, not piece of cake :(, Like I didn&#39;t have regular Timeline for each restaurant (number of visitors in each hour), so I needed to partition each restaurant Alone then combine (merge) them again, so at least I have something in common between.</blockquote><h4>🍓The Data:</h4><h3>Contents</h3><p>Source (Kaggle)</p><ul><li><strong>air_reserve.csv — Reservation information via Air Cash Register</strong></li><li>air_store_id — Air Cash Register Restaurant ID</li><li>visit_datetime — estimated time of visit at the time of booking</li><li>reserve_datetime — Date and time at the time of booking</li><li>reserve_visitors — Number of people booked</li><li><strong>air_store_info.csv — Air Cash Register Restaurant Information</strong></li><li>air_store_id — Air Cash Register Restaurant ID</li><li>air_genre_name — Restaurant genre</li><li>air_area_name — Restaurant location</li><li>latitude — latitude</li><li>longitude — longitude</li><li><strong>air_visit_data.csv — Number of real customers per day at each restaurant at the Air Cash Register</strong></li><li>air_store_id — Air Cash Register Restaurant ID</li><li>visit_date — Date</li><li>visitors — real number of visitors</li><li><strong>data_info.csv — Basic information about dates</strong></li><li><strong>hpg_reserve.csv — Booking information via hot pepper</strong></li><li>hpg_store_id — Hot Pepper Restaurant ID</li><li>visit_datetime — estimated time of visit at the time of booking</li><li>reserve_datetime — Date and time at the time of booking</li><li>reserve_visitors — Number of people booked</li><li><strong>hpg_store_info.csv — Hot Pepper Restaurant Information</strong></li><li>hpg_store_id — Hot Pepper Restaurant ID</li><li>hpg_genre_name — Restaurant genre</li><li>hpg_area_name — Restaurant location</li><li>latitude — latitude</li><li>longitude — longitude</li><li><strong>sample_submission.csv — Sample Submission File</strong></li><li>id — ID that is the concatenation of air_store_id and visit_date</li><li>visitors — expected number of customers</li><li><strong>store_id_relation.csv — Linking your Air Cash Register and Hot Pepper ID (only for shops that use both services)</strong></li><li>hpg_store_id — Hot Pepper Restaurant ID</li><li>air_store_id — Air Cash Register Restaurant ID</li></ul><h4>🍓target</h4><p>Predict the number of customers who visited your restaurant in each day from the last week of April 2017 to the end of May 2017 at 821 restaurants based on historical reservation and actual customer data.<br>821 stores × 39-day real customer base forecast⇒</p><h4>🍓Samples of the Data</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*9C9GWe0x2VBP9RejU64ZRA.png" /><figcaption>Sample data</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*RMJEXM59da8Yf1YYavcQQA.png" /><figcaption>Combining all together</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*ZIaYiaZnjwDTutUqucp0oQ.png" /><figcaption>other features</figcaption></figure><p><strong><em>✔⑤ ➳➳</em></strong></p><h4>🍓 <strong>Data visualization, Representation and correlation </strong>and Analysis (the photos talk about themselves) to start the next step (Feature Engineering)</h4><blockquote>note: if you notice that the process of solving ML/Data science Problem is sequential, you need the step(current) to guide you to the other (Next) like Puzzle of treasure hunting :)</blockquote><p><em>The hole period analysis:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yt7fyIzeA2Xd7O7XaFPOdQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ShiUNtsl6PjcYet0oVMrYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4bfbVcjrmd310Ex91OX5OQ.png" /></figure><p><strong><em>Visits per (month, week):</em></strong></p><p>we note that in Month picture (DEC, FEB, MAR) are Trends.</p><p>In weeks perspective the Weekend (FRI, SAT) are trends (FRI night)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*zeRPwAkhA9uNY4uD590ESA.png" /></figure><p><strong><em>✔⑥ ➳➳</em></strong></p><h4>🍓 <strong>Feature Engineering</strong> part is the most fun part especially if you try to find the right model to begin training with.</h4><p>we take some Features under <strong>R&amp;D</strong> (we will not take all of them in the training, some of them will be considered in other training Algorithms)</p><p><strong>Before moving on to the analysis, I’ll generate some key business questions that I’d like to answer from analyzing this data.</strong></p><h3># These questions are 🍓🍓:</h3><p><strong>1) What’s the distribution of total number of visitors per day?</strong></p><p><strong>2) What’s the median number of visitors per day of the week and month?</strong></p><p><strong>3) How our reservations data compares to the actual visitor numbers?</strong></p><p><strong>4) What are the most common types of cuisine?</strong></p><p><strong>5) What the areas with most restaurants?</strong></p><p><strong>6) What’s the distribution of holidays through the year?</strong></p><p><strong>7) What’s the average number of visitors by restaurant type?</strong></p><h4>🍓<strong>Data/Time Engineering (year, Week ,24 hours tracking/Day)</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*T-R9HYF17Cw-l4asyIDTdw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*uFEocdOWi5-_sQSlbQMflg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*rGkkP5GZQZHyCZjNzgKuuQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*AaiQvQgVH5mTLUfS7Kw79A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*Ubj7IBSdRDwXM1yJPwMnbQ.png" /><figcaption>Density per month</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*wk_uRU3JNNFOUCe5Y-Y48A.png" /></figure><h4>🍓<strong><em>Food Type Feature Engineering :.</em></strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*b9Ls7Mxw5Z7v43ySnLB3Ag.png" /><figcaption><strong>Types of food with number of visitors</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*Rmun4tspR_PKDX6rPOOrvQ.png" /></figure><h4>🍓 Location Engineering:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*qmPjBgWnkz-Pz1jQp0e_gw.png" /><figcaption>Location with number of visitors</figcaption></figure><p>we note in the below diagram that the density of the Restaurants with high number of visitors are located in the middle and in the diagonal,</p><p>the clever reason for this is that the dataset is for Japanese restaurants (location in Japan), and the density of people in Japan in the middle and diagonal because of tsunamis that are active there&#39;s</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*oAxAWrwAplksQi3ZEzvo6A.jpeg" /><figcaption>Japan Map</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*QZQE9OmuPpDWHgrW-9cM5w.png" /><figcaption><strong>latitude</strong> and <strong>longitude</strong></figcaption></figure><p><strong><em>✔⑦ ➳➳</em></strong></p><h4>🍓Training</h4><p>In this Project I used more than 7 Algorithms and techniques to find results and predictions, and I said before the training is experimental in nature, but sometimes you get some feedback about similar problems about which algorithms working and which are not.</p><p>For example, I didn&#39;t try ARIMA “autoregressive integrated moving average” it does bad in these problems. instead, I used SARIMA which do better in these type of problems (Seasonal “Time series”)</p><h4>I will take about three Algorithms in this Context:</h4><h4>🍓 Smoothing:</h4><p>First, let’s smooth by the previous 7 days so we get weekly trend more clearly.</p><p>the Second, smooth by the previous 2 days so we get trend more clearly without losing extra high values of visitors on weekends</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*m-A7Lb_esrs4zNetW0lcPQ.png" /><figcaption>smoothing before training</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*tbY-e9HCv4V6qghOnJ184g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kcq7gVkBjfPmPuhnb-Efjg.png" /><figcaption>Expo Smoothing</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*XHuVpvL_zMcmQXh9B7tYRw.png" /><figcaption>Double Expo Smoothing 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*gEB_PEpT4Q6_e9kHWlJxsA.png" /><figcaption>Double Expo Smoothing2</figcaption></figure><h4>🍓Holt-Winters Method:</h4><blockquote><strong><em>Holt-Winters is a model of time series behavior.</em></strong> Forecasting always requires a model, and Holt-Winters is a way to model three aspects of the time series: a typical value (average), a slope (trend) over time, and a cyclical repeating pattern (seasonality).</blockquote><blockquote><strong>Time series anomaly detectio</strong>n is a <strong>complicated problem</strong> with plenty of practical methods. It’s easy to get lost in all of the topics it encompasses. Learning them is certainly an issue but implementing them is often more complicated.</blockquote><blockquote>A key element of anomaly detection is forecasting — taking what you know about a time series, either based on a model or its history, and making decisions about values that arrive later. You know how to do this already. Imagine someone asked you to forecast the prices for a certain stock, or the local temperature over the next few days. You could draw out your prediction, and chances are it’s a pretty good one. Your brain works amazingly well for problems like this, and our challenge is to try to get computers to do the same. If you take an introductory course on time series, you’ll learn how to forecast by fitting a model to some sample data, and then using the model to predict future values. In practice, especially when monitoring systems, this approach doesn’t work well, if at all! Real systems rarely fit mathematical models. There’s an alternative. You can do something a lot simpler with exponential smoothing.</blockquote><blockquote>Holt-Winters Triple Exponential Smoothing Formula Explained</blockquote><blockquote>The Holt-Winters method uses exponential smoothing to encode lots of values from the past and use them to predict “typical” values for the present and future. Exponential smoothing refers to the use of an exponentially weighted moving average (EWMA) to “smooth” a time series. If you have some time series <em>xt</em>, you can define a new time series <em>st</em> that’s a smoothed version of <em>xt</em>.</blockquote><h3><em>st</em>=<em>αxt</em>+(1−<em>α</em>)<em>st</em>−1</h3><blockquote>In the late 1950s, Charles Holt recognized the issue with the simple EWMA model with time series with trend. He modified the simple exponential smoothing model to account for a linear trend. This is known as Holt’s exponential smoothing. This model is a little more complicated. It consists of two EWMAs: one for the smoothed values of <em>xt</em>, and another for its <em>slope</em>. The terms <em>level</em> and <em>trend</em> are also used.</blockquote><h3><em>st</em>=<em>αxt</em>+(1−<em>α</em>)(<em>st</em>−1+<em>bt</em>−1)</h3><h3><em>bt</em>=<em>β</em>(<em>st</em>−<em>st</em>−1)+(1−<em>β</em>)<em>bt</em>−1</h3><blockquote>Notice how the smoothed values are much better at following the original time series with double exponential smoothing. This means you’ll get much better forecasts.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EeI29BdCgKYrs3qrh27pww.png" /><figcaption><strong><em>Holt-Winters </em>triple<em> Expo Smoothing</em></strong></figcaption></figure><h4>🍓economic approach🍓:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*snYS_soMfF7FCoOT8zWpNQ.png" /></figure><h4>🍓SARIMA model:</h4><p>Pseudo <em>Code:</em></p><blockquote>def optimize SARIMA (parameters list, d, D, s):</blockquote><blockquote>“””</blockquote><blockquote>Return data frame with parameters and corresponding AIC</blockquote><blockquote>parameters list — list with (p, q, P, Q) tuples</blockquote><blockquote>d — integration order in ARIMA model</blockquote><blockquote>D — seasonal integration order</blockquote><blockquote>s — length of season</blockquote><blockquote>“””</blockquote><p>results of SARIMA:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*NYxalr0fD79v5ODBL7S9zQ.png" /><figcaption>Results SARIMA</figcaption></figure><h4>analysis of the model</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*dUhdGXbd2za13Jk-2QFcBw.png" /><figcaption>Stationary</figcaption></figure><h4>Result:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*scFETw2fz-JaivyjXpKz8A.png" /><figcaption>SARIMA</figcaption></figure><p>the Lags:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*qUFsGTVEhw79u18-kayZVQ.png" /><figcaption>Lags (7–22)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-65ECSGXl4ihw_zKXXLXsg.png" /><figcaption>SARIMA result</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-o4iqL6KMRfUXGjoVj3Vtg.png" /><figcaption>Lags representation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cUNRhIQMIZaaUIuN75RfsQ.png" /><figcaption>List of public and common local holidays in Japan adding to the Model</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*aryEpsz7JTajWgQkrTkaoA.png" /><figcaption>Encode Features</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mRq1ZbUK2Gc7QHbWJYOKuQ.png" /><figcaption>After adding Holidays of Japan as Features</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*VsU0H-aRRucUJTu8nf2X0g.png" /><figcaption>the Lags of the Above trained model</figcaption></figure><p>Pseudo Code :</p><blockquote># Finally, let’s put all the transformations together in a single function.</blockquote><blockquote>def prepareData(series, lag_start, lag_end, test_size, target_encoding=False):</blockquote><blockquote>“””</blockquote><blockquote>series: pd.DataFrame</blockquote><blockquote>dataframe with timeseries</blockquote><blockquote>lag_start: int</blockquote><blockquote>initial step back in time to slice target variable</blockquote><blockquote>example — lag_start = 1 means that the model</blockquote><blockquote>will see yesterday’s values to predict today</blockquote><blockquote>lag_end: int</blockquote><blockquote>final step back in time to slice target variable</blockquote><blockquote>example — lag_end = 4 means that the model</blockquote><blockquote>will see up to 4 days back in time to predict today</blockquote><blockquote>test_size: float</blockquote><blockquote>size of the test dataset after train/test split as percentage of dataset</blockquote><blockquote>target_encoding: boolean</blockquote><blockquote>if True — add target averages to the dataset</blockquote><p>SARIMA Final result:</p><p>After adding and enhancing Features this was the final result from SARIMA model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BjEjZqBf_4HIlktZRCOupw.png" /><figcaption>FINAL SARIMA</figcaption></figure><p>Heat map :</p><p>checking Overfitting :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*nqScxlV-vCqq8zyWMV0BGQ.png" /></figure><p>Perform Ridge (L2) regression</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xA2DUE6Xhq6-bBfVRmFFbQ.png" /><figcaption>Perform Ridge (L2) regression</figcaption></figure><h4>🍓 XGBoosting &amp;</h4><h4>LightGBM (Microsoft open source) Model:</h4><ul><li>XGBoost is an implementation of the gradient boosting ensemble algorithm for classification and regression.</li><li>Time series datasets can be transformed into supervised learning using a sliding-window representation.</li><li>How to fit, evaluate, and make predictions with an XGBoost model for time series forecasting.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*W_5R3Un-QN-yAXzVst6xJw.jpeg" /><figcaption>XGBoosting Source</figcaption></figure><p>Code :</p><blockquote>from xgboost import XGBRegressor</blockquote><blockquote>xgb = XGBRegressor(booster=’gblinear’, alpha=11, updater=’coord_descent’, feature_selector=’greedy’, top_k=7)</blockquote><blockquote>xgb.fit(X_train_scaled, y_train)</blockquote><blockquote>plotModelResults(xgb, X_train=X_train_scaled, X_test=X_test_scaled,plot_intervals=True, plot_anomalies=True)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cpGu6Yl6C0FgQEb1JM7Trg.png" /><figcaption>XGBoosting Learning Algorithm</figcaption></figure><h4>🍓RNN &amp;LSTM:</h4><p><strong>Recurrent neural networks (RNNs)</strong> are deep learning models, typically used to solve problems with sequential input data such as time series. What are they, and how do we use them in time series forecasting?</p><p>RNNs are a type of neural network that retains a memory of what it has already processed and thus can learn from previous iterations during its training.</p><h3>Long Short-Term Memory Network</h3><p>The Long Short-Term Memory network, or LSTM network, is a recurrent neural network trained using Backpropagation Through Time that overcomes the vanishing gradient problem.</p><p>As such, it can be used to create large recurrent networks that, in turn, can be used to address difficult sequence problems in machine learning and achieve state-of-the-art results.</p><p>Instead of neurons, LSTM networks have memory blocks connected through layers.</p><p>A block has components that make it smarter than a classical neuron and a memory for recent sequences. A block contains gates that manage the block’s state and output. A block operates upon an input sequence, and each gate within a block uses the sigmoid activation units to control whether it is triggered or not, making the change of state and addition of information flowing through the block conditional.</p><p>There are three types of gates within a unit:</p><ul><li><strong>Forget Gate</strong>: conditionally decides what information to throw away from the block</li><li><strong>Input Gate</strong>: conditionally decides which values from the input to update the memory state</li><li><strong>Output Gate</strong>: conditionally decides what to output based on input and the memory of the block</li></ul><p>Each unit is like a mini-state machine where the gates of the units have weights that are learned during the training procedure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*6_bVkRVR4Ebbw39UEvCuiQ.png" /><figcaption>LSTM Flow</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*njZ3eRZx68xO8Ir-M07mzw.png" /><figcaption>LSTM Model Creation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*TYn3zTW625yvjvS-A-xk8w.png" /><figcaption>Training lose</figcaption></figure><h4>🍓🍓Final Result of LSTM:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*8z9eB1PkWwxvEKMCdeqHrA.png" /><figcaption>Number of Visitors LSTM Prediction</figcaption></figure><h4>🍓🍓🍓🍓🍓🍓🍓🍓🍓🍓🍓🍓🍓🍓🍓🍓🍓🍓</h4><p><strong><em>✔⑧ +⑨+①∅ +①① +①②➳➳</em></strong></p><p><strong>Deployment and testing the model in real timely System, Architecture, Data Pipelines, Search for other higher level SWE Solutions</strong></p><p>those Points are higher level than Junior Level, so I just Add some photos I understand about those things.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FvMpJq4jRqcqTYnKeKwz5w.jpeg" /><figcaption>Django MVT Arch</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*UjA3w7nJqGu0OJvij4vzWA.png" /><figcaption>System design of Predictive application</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TSy1fDxGXSLjiQrnYAc1Fw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZT2UvzC9E9PJp5YUSJFRPA.png" /><figcaption>Model Deployment</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DnQJ3Sq5YlHVf7piR9v5bA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*ZY6SXkTDaih4qVW8srkSUA.jpeg" /><figcaption>what&#39;s after Deployment?</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*nsgVh5ejSrHIZ-umKHeR-w.jpeg" /><figcaption>Training with prediction sequences</figcaption></figure><h4>Conclusion:</h4><p>In this Scientific Technical article tried to summarize 10 months of work, research, develop, ask, and living the whole process of Data science problem, reading tones of articles and solutions to Customize to the problem Iam trying to solve.</p><p>The journey was so inspiring and its continuing to develop my understanding of the Learning Algorithms in the brain.</p><blockquote>In the end I want to say this “In software Engineering you Master the Problem then you solve it (Bottom-up approach), on the other hand in Data Science it&#39;s the opposite, you solve the problem then you become professional in Trying any Experimental Solution you Find Touching”</blockquote><h3><strong>Future </strong>Work:</h3><p>Looking Forward to writing other part two, where I could add more features to the existing model, like Weather, Type of food, emotional Intelligence in prediction, Analysis of social media about the restaurants.</p><p>And I am looking to convert my Project to Django, and maybe try to make it real time, connecting it to Data pipelines from a real time system flow,</p><p>and adding more restaurants to it, every restaurant has its own features and Circumstances and make the model dynamic that could afford more and more feature without overfitting and offer services to more than just one client.</p><blockquote>its applicable but difficult, <strong>its Data problem</strong>.</blockquote><h3>References:</h3><p><a href="https://machinelearningmastery.com/time-series-prediction-lstm-recurrent-neural-networks-python-keras/">Time Series Prediction with LSTM Recurrent Neural Networks in Python with Keras (machinelearningmastery.com)</a></p><p><a href="https://www.svds.com/models-lab-factory/">Models: From the Lab to the Factory — Silicon Valley Data Science (svds.com)</a></p><p><a href="https://towardsdatascience.com/stoend-to-end-data-science-life-cycle-6387523b5afc">Data Science life Cycle | Towards Data Science</a></p><p><a href="https://machinelearningmastery.com/sarima-for-time-series-forecasting-in-python/">A Gentle Introduction to SARIMA for Time Series Forecasting in Python (machinelearningmastery.com)</a></p><p><a href="https://medium.com/data-science-at-microsoft/introduction-to-feature-engineering-for-time-series-forecasting-620aa55fcab0">Introduction to feature engineering for time series forecasting | by Francesca Lazzeri | Data Science at Microsoft | Medium</a></p><p><a href="https://www.phdata.io/blog/the-ultimate-mlops-guide-how-to-deploy-ml-models-to-production/">The 4 Pillars of MLOps: How to Deploy ML Models to Production | phData</a></p><p><a href="https://towardsdatascience.com/time-series-in-python-part-3-forecasting-taxi-trips-with-lstms-277afd4f811">Time Series in Python — Part 3: Forecasting taxi trips with LSTMs | by Benjamin Etienne | Towards Data Science</a></p><h4>Data :</h4><p><a href="https://www.kaggle.com/c/recruit-restaurant-visitor-forecasting">Recruit Restaurant Visitor Forecasting | Kaggle</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c632f6a691ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>