<?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 Beyond DuMont Data on Medium]]></title>
        <description><![CDATA[Stories by Beyond DuMont Data on Medium]]></description>
        <link>https://medium.com/@BeyondDuMontData?source=rss-385ca0a5299d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*92Vve2F-M9kUE-vJRcGR9A.png</url>
            <title>Stories by Beyond DuMont Data on Medium</title>
            <link>https://medium.com/@BeyondDuMontData?source=rss-385ca0a5299d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 03:11:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@BeyondDuMontData/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[Leveraging the power of ChatGPT to find user needs]]></title>
            <link>https://medium.com/@BeyondDuMontData/leveraging-the-power-of-chatgpt-to-find-user-needs-07084dc54557?source=rss-385ca0a5299d------2</link>
            <guid isPermaLink="false">https://medium.com/p/07084dc54557</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[user-needs]]></category>
            <dc:creator><![CDATA[Beyond DuMont Data]]></dc:creator>
            <pubDate>Wed, 30 Oct 2024 12:30:58 GMT</pubDate>
            <atom:updated>2024-10-30T12:30:58.854Z</atom:updated>
            <content:encoded><![CDATA[<h3>Leveraging the power of ChatGPT to find User Needs</h3><h4>Lessons on how to use LLM to classify news articles into User Needs categories</h4><p>The modern approach to evaluating data has shifted our understanding and perspectives toward viewing relevant content through the audience’s lens.</p><p>Therefore, alongside traditional methods, such as assessing the audience’s age and location, a more user-oriented way to analyze consumed content is to consider the user’s interests — essentially, their needs. This shift now focuses on the user’s intention behind engaging with relevant content, which, in our case, are articles. The idea behind user needs is to make a user’s interests not only accessible but also quantifiable.</p><p>User needs can be broken down into four categories <strong>(Know, Understand, Feel and Do)</strong>, as suggested by <a href="https://smartocto.com/">Smartocto</a> in their User Need Model 2.0:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iUg2VzvbZxjId-M615s9lQ.jpeg" /><figcaption>Source: smartocto.com</figcaption></figure><p>These categories encapsulate the general idea of a user’s need to know, understand, feel, or do something after engaging with the respective article.</p><p>For example, articles about local news satisfy the user’s need to know something, while an article explaining photosynthesis relates to the need for understanding. Reading a scary story during Halloween can fulfill the user’s need to feel something, just as articles about community events like group runs or pub crawls meet the need for engagement.</p><p>It’s important to note that framing user needs is not a rigid procedure; in fact, the categorization can and should be adjusted or fine-tuned into subcategories based on your audience, content, or personal evaluation.</p><blockquote><strong>This approach enhances the relevance of articles, increasing the likelihood that the audience will find them valuable and encouraging readers to return for more.</strong></blockquote><p>From a technical standpoint, user needs also provide a framework for evaluating produced content against what users actually read. By considering users’ natural interests, we can analyze the intention behind their engagement with specific articles from a broader perspective. This allows us to identify whether articles that may not align with audience interests, but are produced in similar quantities, should be redirected or reevaluated.</p><p>Manually categorizing even a small number of articles is a time-consuming task, so we aimed to leverage a large language model (LLM) to automatically categorize articles based on user needs. Therefore, to implement this automated categorization, we utilized OpenAI’s ChatGPT. This choice was driven by its reputation as one of the most sophisticated and reliable LLM, which is also the focus of extensive AI performance research. <a href="https://smartocto.com/company/news/how-chatgpt-helped-shape-our-user-needs-model/">And after all ChatGPT itself was used to shape the current user need model.</a> However, it’s important to note that alternative LLMs, including those you can train yourself, may also suit your needs better, but they typically require more effort to implement and maintain.</p><p>To validate our decision to use ChatGPT, we tested its responses with our data and compared the results to our manual categorization. <strong>Initially, ChatGPT’s performance exceeded our expectations, however we observed a significant decline in its accuracy when we prompted it for categorization just once and then requested additional categorizations.</strong> Fortunately, we identified a solution: by initiating the relevant prompt each time before requesting the categorization of an article, we were able to maintain consistent performance.</p><p>To further automate this process, we constructed a customized GPT by initiating it with a prompt that encompassed all relevant user needs, a clearly defined output format and an example of how to structure the data. By resetting this prompt ahead of any categorization request, we ensured that the output format remained consistent, enabling us to analyze the data. We specify that there are a maximum of 2 user needs and that these are prioritized against each other as either primary or secondary user needs. The automated requests to ChatGPT and to our articles were executed using the respective APIs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*IQJQk7l3O1Vkpt78Qa8JYg.png" /></figure><p>In conclusion, the final output of our categorization process aligns well with our personal evaluations, ensuring that the content resonates with both the intended audience and their interests. Our goal is to implement recommendations not only on an article-to-article basis but also to develop suggestions that take into account individual user needs alongside their topic interests.</p><p>We are aware of the fact that inaccuracies may arise in the categorization process, but are confident that they will average out, as supported by our own assessments. By focusing on user needs, we can improve the relevance of our content and enhance engagement in the future. This approach enables us to provide insights that are more closely aligned with our audience’s preferences.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=07084dc54557" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Customer Data Platforms (CDP): Fueling the Future of Data-Driven Work]]></title>
            <link>https://medium.com/@BeyondDuMontData/customer-data-platforms-cdp-fueling-the-future-of-data-driven-work-c6891b620f86?source=rss-385ca0a5299d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6891b620f86</guid>
            <category><![CDATA[cdp]]></category>
            <category><![CDATA[customer-data-platform]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Beyond DuMont Data]]></dc:creator>
            <pubDate>Mon, 23 Sep 2024 12:14:33 GMT</pubDate>
            <atom:updated>2024-09-23T12:42:18.348Z</atom:updated>
            <content:encoded><![CDATA[<h4>What is a CDP? How did we introduce it? How do we use it? And why you should you use it too.</h4><p>As data team in the Digital Competence Center of KStA Media our primary goal is to enable our colleagues to work data-driven, leverage data insight and unlock business potentials.</p><p>Therefore, we built up a strong data stack over the past years to provide reporting and analysis to stakeholders to gain insights from data, create awareness of our users’ needs by conducting A/B-tests and make data applications available to enhance the user experience in our products. Especially, our data cloud infrastructure is a powerful enabler for generating deep insights and creating automated and AI-based applications within our organization.</p><p>Nevertheless, in recent years we have repeatedly come to a point where we noticed that our data stack lacks the ability to fully empower stakeholders within our organization to activate and fully leverage data by themselves. While gaining insights from data about our users is a common means of improving our products, in most of our teams we are not able to enable stakeholders to activate the data and use it for targeting in their respective cases.</p><p>We therefore decided to add a customer data platform to our data stack to empower everyone in our organization to work data-driven and being able to easily activate (or let´s say “make use” of) data for their specific use cases.</p><h4>Customer data platform — shortly explained</h4><p>A customer data platform (CDP) is a tool that merges data from various sources to create uniform customer profiles. As user profiles get enriched with data from many different data sources, we generate a 360-degree view on the user. This enables us to effectively classify users based on specific criteria into audiences and activate them for different destinations. These could for example be any advertising platform, Mailing- or Marketing-tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Og_iJocZhxzN3_EDN5ToRA.png" /><figcaption>generated by ChatGPT</figcaption></figure><p>To leverage full power of the CDP, it is important what kind of data you are feeding into the system. As a news publisher our biggest data source is traffic data from our news websites. Behavioral data holds key information about our users and serves as basis for many of our audiences created in the CDP. However, we also collect login- and subscription data from our customers and Push- and Mailing-Information of each user.</p><p>Besides the collection of our first-party data, we are also increasingly collecting zero-party data to enrich user profiles with information they are freely willing to share with us. We therefore set up a dedicated zero-party data strategy to retrieve data through e.g. micro surveys in a very homeopathic way. This lets us generate insights from users we normally would not have access to and provide unique audiences within our CDP.</p><p>Overall, we can say that the CDP gives us the ability to actively make use of our first- and zero-party data by merging data from our various sources and effectively segmenting and activating them in different destinations. We can do GDPR compliant marketing by addressing each individual privacy and consent preferences and breaking up data silos. Moreover, the CDP provides an interface that easily enables any stakeholders to work on data and activate it for their specific use cases. And that is key for us!</p><h4>Creating trust within the organization</h4><p>However, we of course must admit that it is not done by just buying a CDP, integrating all sources, and then going to the teams and say: “here you go!”.</p><p>As with every other tool, onboarding, explaining, and proving value is key for the success of our customer data platform. For one, the tool, its mechanism and value is self-explaining, others are very skeptical, reserved, and cautious and for both it seems like a work overload in the first place — another thing to incorporate into tasks and daily doing.</p><p>Besides having several kick-offs, trainings, and planning sessions with our CDP vendor, we internally hold workshops for every team within our Digital Competence Center. Within these workshops we deeply explain the functionalities of the CDP but more importantly develop use cases for each team and stakeholder. This significantly increases the participants’ understanding of the CDP and its value for each of them.</p><p>Furthermore, we take every chance to promote our CDP within the organization in learning sessions, all hands meetings or LinkedIn Post making sure that everybody is aware of its potential.</p><p>It sometimes is very challenging, but often also very pleasing and satisfying to see stakeholders work with the CDP and gain significant value from it.</p><p>Because that is the heart of the matter: a CDP is only as valuable as you make it by empowering everyone to work with it and let your data help to improve your business!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6891b620f86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use classification rules in Adobe Analytics to enrich your data and save eVars]]></title>
            <link>https://medium.com/@BeyondDuMontData/how-to-use-classification-rules-in-adobe-analytics-to-enrich-your-data-and-save-evars-32847151e585?source=rss-385ca0a5299d------2</link>
            <guid isPermaLink="false">https://medium.com/p/32847151e585</guid>
            <category><![CDATA[tracking]]></category>
            <category><![CDATA[classification]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[adobe-analytics]]></category>
            <dc:creator><![CDATA[Beyond DuMont Data]]></dc:creator>
            <pubDate>Fri, 23 Aug 2024 12:57:14 GMT</pubDate>
            <atom:updated>2024-08-23T12:57:14.476Z</atom:updated>
            <content:encoded><![CDATA[<p>Adobe Analytics offers a lot of potential for collecting, processing and analysing data. One of their features we like to use are classification rules. With their help we can correct errors in data collection in retrospect, manage resources (like the number of used dimensions/eVars) or enhance our data collection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LV9wCyhnY-cYZJbMqr4kSQ.png" /><figcaption>generated by ChatGPT</figcaption></figure><h3>What are Classifications rules in Adobe Analytics and how can we create them?</h3><p>To sum it up in one sentence: Classifications are used to summarise, break down or redefine values from a variable into new specific values. <br>They can be seen as a lookup table that translates tracked dimension values (e.g. tracking codes or product information) into another value that is more suitable for your reporting.</p><p>To create Classifications for a dimension in Adobe Analytics, we have to call up <strong>Admin &gt; Report Suites &gt; Edit Settings,</strong> open <em>Traffic Classifications</em> or <em>Conversion Classifications</em> and choose a variable which should be redefined. As soon as the classifications are enabled, you can use the rule builder by following the path in Adobe Analytics <strong>Admin</strong> &gt; <strong>Classification Rule Builder </strong>to classify specific values.</p><p>In this area we click on “<strong>Add Rule Set</strong>” to create a new rule set. A rule set means here a group of classification rules for a specific variable. Before defining a condition for your classification, it is necessary to apply the rule set to report suites and variables. To be sure that your condition is valid, you can test rules for validation by editing them in draft mode. Especially, in case of using regular expressions it makes sense to validate your conditions. And do not panic: while in draft mode, rules cannot run. As soon as you active the rule, it will process the data (historical data as well).</p><h3>Two example approaches to use Classifications rules in Adobe Analytics</h3><h4>Saving eVars by splitting one eVar in three eVars</h4><p>As a publisher, we collect a lot of information about our article pages, but there are also other features that we want to test and analyse. As a result, we use a lot of eVars and therefore we have to use them sparingly and efficiently. Classification rules can help us to limit this usage.</p><p>In our example, we look at the values for the article length. We collect the number of words, characters and paragraphs in the articles in our variable. These values are separated by ‘::’. However, these values are not helpful for an analysis. So what do you do if you don’t want to waste three eVars? That’s right! We use the Classification Rules to create three eVars from one!</p><p>The following example of a value in the eVar: <strong>‘170::1092::3’</strong><br>That means 170 words, 1092 characters, 3 paragraphs.</p><p>So, how do we separate them?</p><p>By using regular expressions, we can define the string in the variable and we say that the different sections are separated by ‘::’. After entering the match criteria we set the classification and define which part of the string should be mapped to the classification.</p><p>All in all we have following definition for our classification rule:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0QINQsboYoCnEe_tGBGV9Q.png" /><figcaption>Classification rules to spilt eVars</figcaption></figure><p>That’s it already! By defining the criteria and the classification we can split the input of one eVar in three other eVars to reduce the number of dimensions and to analyze the data easily! Meanwhile, most of our Adobe Analytics users will not see the difference between classified vs. a tracked value in the interface, because the workspace in Adobe Analytics shows them the same way.</p><h4>Enriching data by using data from URL</h4><p>As a regular website, we naturally measure the views and interactions on our pages and regularly include both, the url and the url with all its parameters, in an eVar for different events. The parameters in an url can contain important information for our analysis, such as the tracking code for campaigns. However, there are other special parameters that we have not always included in the tracking, but we were able to add them at short notice via the classification rules.</p><p>One example is the measurement of clicks in our image galleries. In addition to the gallery names, the url and the article in which they are embedded, we also wanted to analyse the gallery id and the page within the gallery. To reduce the amount of work involved, we looked at the parameters in the url: <br><em>https://www.express.de/sport/fussball/saison-2024-25-das-sind-die-stadien-der-bundesligisten-849282?</em><strong><em>487889=2</em></strong></p><p>The parameters after the question mark give us the gallery id and the page called up in the embedded gallery. Now, we need to extract these using the classification rules:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1h94ELG0HbmVJl45jOub3w.png" /><figcaption>Classification rules to generate data from url</figcaption></figure><p>Again, we have used regular expressions to extract the parameters from the eVar containing the url and write them into a variable. From the third section of the url we get the gallery id and from the fourth section the page in the gallery.</p><p>And bang! We have separated the data that we already have and can therefore carry out more in-depth analyses.</p><h3>Last words to put it in a nutshell</h3><p>To be honest, these are only two approaches for using classification rules in Adobe Analytics. You can do a lot more with the classification rules. Nevertheless, these are the options we have used the most so far and they are fun. They are not only helpful to improve your data collection or to reduce eVars. They also can be useful, when you are not able or do not have the ressources to adjust your tracking implementation. We like!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32847151e585" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Direct vs. Indirect Customer Feedback: Which is Better for Personalization?]]></title>
            <link>https://medium.com/@BeyondDuMontData/direct-vs-indirect-customer-feedback-which-is-better-for-personalization-3efd736d6aeb?source=rss-385ca0a5299d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3efd736d6aeb</guid>
            <category><![CDATA[news-articles]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[case-study]]></category>
            <category><![CDATA[customer-feedback]]></category>
            <category><![CDATA[personalization]]></category>
            <dc:creator><![CDATA[Beyond DuMont Data]]></dc:creator>
            <pubDate>Tue, 09 Jul 2024 11:30:32 GMT</pubDate>
            <atom:updated>2024-07-09T12:04:02.430Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1wjw5iE8wqjXltd91oQU0A.png" /><figcaption>Generated with ChatGPT</figcaption></figure><p>When it comes to customer feedback, organizations rely on both direct and indirect signals to understand and meet their customers’ needs. These signals are critical to customer satisfaction, loyalty, and overall business performance.</p><blockquote>The question arises: Is one type of feedback inherently better than the other, especially when it comes to personalization, such as in recommendation systems?</blockquote><p>Let’s take a look at a case study that compares the two types of feedback.</p><h3>The Case Study</h3><p>We conducted a survey asking users about their interests. The aim was to find out their preferences directly. The survey was conducted on the news portal. Participation in the survey was very high. Users were keen to ensure that the products they used were tailored to their needs. Focusing on highly loyal users, we selected participants who had at least five visits and direct entry to our platform.</p><h4>Survey Results</h4><p>The survey revealed that the most common interests among users included:</p><ul><li><strong>Sports</strong></li><li><strong>World Affairs &amp; Politics</strong></li><li><strong>Specific Interests</strong> like Cars &amp; Motorbikes, Computers, Technology, Music, and Gardening.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-yCj0H6quT3K_5MqiO3xGQ.png" /><figcaption>Copyright: Own Results</figcaption></figure><h4>Indirect Feedback</h4><p>For comparison, we analyzed the actual reading habits of these users over the past three months, tracking which articles they read from the categories they mentioned in the survey. The results were revealing:</p><ul><li><strong>Sports</strong> and <strong>Celebrity &amp; Entertainment</strong> were the most clicked categories.</li><li><strong>World Affairs &amp; Politics</strong> also saw significant engagement.</li><li>However, specific interests such as <strong>Cars &amp; Motorbikes</strong>, <strong>Music</strong>, and <strong>Gardening</strong> had minimal engagement.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S8osmP97WnhO1fSCxfA2Ew.png" /><figcaption>Copyright: Own Results</figcaption></figure><p>Of course, there may not be a consistent interest in the topics, even though people may have read individual articles from the categories. This is why we look at the percentage of people who regularly read the different categories. However, this also confirms the previous results:</p><ul><li><strong>Sports</strong>: 56%</li><li><strong>Celebrity &amp; Entertainment</strong>: 32%</li><li><strong>World Affairs &amp; Politics</strong>: 5%</li><li><strong>Family &amp; Baby</strong>: 1%</li><li><strong>Cars &amp; Motorbikes</strong>: 0.5%</li><li><strong>Music</strong>: 0.5%</li></ul><h4>Insights and Analysis</h4><p>Several patterns emerged from the data:</p><ol><li><strong>Mismatch of Stated vs. Actual Interests</strong>: While many users listed specific interests, their reading habits didn’t align. This could be due to:<br>* Lack of enough articles on these topics.<br>* Lack of engaging articles in these categories.<br>* Users not finding the articles on the site.</li><li><strong>Hobby vs. Reading Interests</strong>: Some interests, such as hobbies, may be more about the activity itself than reading about it. For example, while many users expressed interest in <strong>Family &amp; Baby</strong> topics, only 8% stated it as an interest, yet 55% read articles on it. This suggests that users may prefer to experience some hobbies rather than read about them.</li><li><strong>Social Desirability Bias</strong>: Users may feel compelled to list topics such as <strong>Politics</strong> as interests due to their perceived importance. However, only a small percentage read about them regularly, indicating a discrepancy between stated and actual interests.</li></ol><h4>Direct vs. Indirect Feedback: What Does It Mean?</h4><p>The findings suggest that while direct feedback is valuable, it may not always reflect true user behavior. People might not fully understand their preferences or may overestimate their interest in certain topics. Therefore, relying solely on direct feedback can be misleading.</p><p><strong>Indirect feedback</strong>, such as actual user behavior data, provides a more accurate picture of interests and engagement. However, it is critical to combine both types of feedback to get a holistic view. Direct feedback can guide content creation, while indirect feedback can refine and validate these insights.</p><h3>Conclusion</h3><p>Effective personalization, especially in recommendation systems, requires a balanced approach that uses both direct and indirect customer feedback. While direct feedback provides insight into users’ intentions, indirect feedback reveals their actual behavior. By integrating both, organizations can better understand and address their customers’ real interests, ultimately increasing user satisfaction and engagement.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3efd736d6aeb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Speed Up Your Data Science Insights: From Days to Minutes with BigQuery]]></title>
            <link>https://medium.com/@BeyondDuMontData/speed-up-your-data-science-insights-from-days-to-minutes-with-bigquery-0dfde34816ad?source=rss-385ca0a5299d------2</link>
            <guid isPermaLink="false">https://medium.com/p/0dfde34816ad</guid>
            <category><![CDATA[efficiency]]></category>
            <category><![CDATA[bigquery]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[window-functions]]></category>
            <dc:creator><![CDATA[Beyond DuMont Data]]></dc:creator>
            <pubDate>Wed, 19 Jun 2024 15:14:02 GMT</pubDate>
            <atom:updated>2024-06-19T15:40:36.332Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8hY8klilq8UH7NLQkITq7g.png" /><figcaption>Generated by AI</figcaption></figure><p>In the fast-paced world of data science, Python and its powerful library Pandas have been the go-to tools for most data scientists. These tools excel at manipulating and analyzing data, but they have their limitations, especially when working with extremely large datasets.</p><p>This is where Google’s BigQuery comes into play — a robust, serverless data warehouse that dramatically accelerates data analysis, moving from days to minutes.</p><h3>Introduction to BigQuery</h3><p>BigQuery is a fully-managed enterprise data warehouse that performs large-scale data analytics with ease and efficiency. It stands out due to its impressive ability to execute extensive queries across billions of rows in seconds. BigQuery’s speed and performance are detailed in Google’s own deep dive into its query processing engine <a href="https://cloud.google.com/blog/products/bigquery/anatomy-of-a-bigquery-query?hl=en">here</a>.</p><h4>Utilizing BigQuery Beyond Basic Queries</h4><p>While familiar functions like WHERE, GROUP BY, and JOINS are commonly used, BigQuery’s real power is exemplified through its advanced features such as window functions. These functions allow for complex calculations across a set of rows while retaining access to the data in each row. This capability is not just for aggregate analysis but extends to detailed insights at the individual row level, providing dynamic classifications and calculations without the need for multiple query layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/0*BkwNAkh0-MTD58Rn.png" /><figcaption>Copyright: <a href="https://medium.com/@axel-thevenot?source=post_page-----e0a6ca3f9502--------------------------------">Axel Thevenot</a></figcaption></figure><h3>Case Study: Window Functions vs. Python Execution</h3><p>To illustrate the efficiency of BigQuery, let’s consider a scenario involving a dataset with random `visitor_id`, `date_time` over a two-week span, and `resort` categories including “Sports”, “Economics”, and “Local News”.</p><h4>Python Implementation</h4><p>In Python, categorizing visitors and counting specific interactions involves several steps:<br>1. Classifying each visitor based on their interaction within certain time frames.<br>2. Counting daily interactions for a specific category (“Sports”).</p><pre>import pandas as pd<br>import numpy as np<br>import timeit<br><br># Seed for reproducibility<br>np.random.seed(0)<br>date_range = pd.date_range(start=&quot;2023-06-01&quot;, end=&quot;2023-06-14&quot;, freq=&#39;H&#39;)<br>visitor_ids = np.random.randint(1000, 1100, size=50)<br>resorts = np.random.choice([&#39;Sports&#39;, &#39;Economics&#39;, &#39;Local News&#39;], size=50)<br>df = pd.DataFrame({&#39;visitor_id&#39;: visitor_ids, &#39;date_time&#39;: random_dates, &#39;resort&#39;: resorts})<br>df.sort_values(by=&#39;date_time&#39;, inplace=True)<br><br>def classify_visitor(df, current_index):<br>    current_time = df.iloc[current_index][&#39;date_time&#39;]<br>    past_24h = current_time - pd.Timedelta(hours=24)<br>    past_7d = current_time - pd.Timedelta(days=7)<br>    past_visits = df[(df[&#39;visitor_id&#39;] == visitor_id) &amp; (df[&#39;date_time&#39;] &lt; current_time) &amp; (df[&#39;date_time&#39;] &gt;= past_7d)]<br>    if past_visits.empty:<br>        return &#39;new&#39;<br>    elif past_visits[&#39;date_time&#39;].max() &gt;= past_24h:<br>        return &#39;hot&#39;<br>    else:<br>        return &#39;recent&#39;<br><br>df[&#39;visitor_type&#39;] = [classify_visitor(df, i) for i in range(len(df))]<br>sports_counts = df[df[&#39;resort&#39;] == &#39;Sports&#39;].groupby([df[&#39;date_time&#39;].dt.date, &#39;visitor_type&#39;]).size().unstack(fill_value=0)<br><br>execution_time = timeit.timeit(lambda: analyze_data(df), number=10) / 10<br>print(f&quot;Average execution time: {execution_time} seconds&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*JkwKhAiqqG1XQEK8PdqWGA.png" /></figure><p>Average execution time: <strong>1.57 seconds.</strong></p><h3>BigQuery Implementation</h3><p>Conversely, implementing the same logic in BigQuery using a window function drastically reduces complexity and increases speed:</p><pre>WITH visitor_classifications AS (<br>  SELECT<br>    visitor_id,<br>    date_time,<br>    resort,<br>    CASE<br>      WHEN MAX(date_time) OVER (PARTITION BY visitor_id ORDER BY UNIX_SECONDS(date_time) RANGE BETWEEN 604800 PRECEDING AND 1 PRECEDING) IS NULL THEN &#39;new&#39;<br>      WHEN MAX(date_time) OVER (PARTITION BY visitor_id ORDER BY UNIX_SECONDS(date_time) RANGE BETWEEN 86400 PRECEDING AND 1 PRECEDING) IS NULL THEN &#39;recent&#39;<br>      ELSE &#39;hot&#39;<br>    END AS visitor_type<br>  FROM<br>    `test_data`<br>)<br><br>SELECT<br>  DATE(date_time) AS date,<br>  visitor_type,<br>  COUNT(*) AS count<br>FROM<br>  visitor_classifications<br>WHERE<br>  resort = &#39;Sports&#39;<br>GROUP BY<br>  date, visitor_type</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*Y1hAdlA_jbYvyhp1JqJPmg.png" /></figure><p>This query executes in just <strong>386 milliseconds</strong>, showcasing BigQuery’s ability to handle complex queries with ease.</p><p>This is just a sample of 1000 entries and we can already see an improvement of almost a factor of 4. The processing time for such calculations increases exponentially with larger amounts of data.</p><p><strong>I myself was able to reduce the calculation time for a dataset with more than 50 million records from more than 1 day to less than 14 minutes without using threads or the like.</strong></p><h3>Conclusion</h3><p>When dealing with large datasets, the efficiency of BigQuery is undeniable.</p><blockquote>If your analysis can be performed in BigQuery, it should be.</blockquote><p>By leveraging BigQuery for data analysis tasks, data scientists can save time and resources, allowing them to focus on deriving insights rather than managing data processing bottlenecks.</p><p>As seen in our example, what takes Python several seconds to compute can be done in milliseconds with BigQuery, translating into faster insights and more agile data-driven decision-making. For those looking to dive deeper into the capabilities of BigQuery’s window functions, further reading and examples can be found <a href="https://medium.com/google-cloud/bigquery-window-functions-advanced-techniques-for-data-professionals-e0a6ca3f9502">here</a>.</p><p>Embrace BigQuery, and transform your data analytics from days to minutes!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0dfde34816ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>