<?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[Trusted Data Science @ Haleon - Medium]]></title>
        <description><![CDATA[Publishing the latest updates from Haleon’s Data Science Team. Here we’ll meet the team members, dive into technical DS topics and share case studies of our projects. - Medium]]></description>
        <link>https://medium.com/trusted-data-science-haleon?source=rss----3e46225d312e---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Trusted Data Science @ Haleon - Medium</title>
            <link>https://medium.com/trusted-data-science-haleon?source=rss----3e46225d312e---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 13:04:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/trusted-data-science-haleon" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Q&A: GenAI @ Haleon]]></title>
            <link>https://medium.com/trusted-data-science-haleon/q-a-genai-haleon-cb27f8c200ac?source=rss----3e46225d312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/cb27f8c200ac</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[women-in-data]]></category>
            <category><![CDATA[case-study]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Haleon]]></dc:creator>
            <pubDate>Mon, 29 Jul 2024 08:57:08 GMT</pubDate>
            <atom:updated>2024-07-29T08:57:08.643Z</atom:updated>
            <content:encoded><![CDATA[<h4>By <a href="https://varshitasher.medium.com/">Dr. Varshita Sher</a>, <a href="https://medium.com/@rhaecandice">Rhae Layson</a>, <a href="https://medium.com/@zohaib.x.khan">Zohaib Khan</a> &amp; <a href="https://medium.com/@sunir.x.gohil">Dr. Sunir Gohil</a></h4><p>On 17th July 2024, members of the Generative AI squad at Haleon presented a Lunch and Learn to the <a href="https://womenindata.co.uk/">Women in Data</a> Community. There was a wonderful engagement and a series of great questions that we wanted to share with the wider community.</p><h4>Are you using open-source LLM for translation and fine-tuning it?</h4><p>No; we use GPT-4 through the Azure platform, which provides security measures and ensures data privacy.</p><p>Our approach involves prompt engineering, where we establish language-specific guidelines informed by feedback from native speakers. The model also refers to a Haleon-wide glossary and a user specific glossary when translating.</p><h4>Are any of your use cases developed with the aim of making them customer facing or do they tend to be for internal use only?</h4><p>Our primary focus is on enhancing our internal capabilities. We are currently developing use cases that are aimed at improving our internal processes and systems. While these solutions are not directly customer-facing, they play a crucial role in improving our efficiency and effectiveness, which ultimately benefits our customers. However, we are continuously exploring new opportunities and remain open to the possibility of developing customer-facing solutions in the future.</p><h4>How do you deal with purely false information that may be part of the data the model was originally trained on? Google has struggled recently with its AI recommendations after it purchased the data of Reddit.</h4><p>While hallucinations and misinformation are real concerns, significant advancements have been made to address these issues. For instance, Azure OpenAI offers filters for hate speech, self-harm, violence, and sexual content. They also provide options for sanitizing prompts and shielding against jailbreaks and prompt injection attacks.</p><p>Many platforms incorporating these models implement additional guardrails. They may prohibit displaying generated information — whether text or images — if it could reinforce disinformation or misinformation about sensitive topics. For example, Canva restricts generating images of living people to prevent potential misuse.</p><p>Researchers are also exploring various approaches to mitigate LLM hallucinations in trained models. For instance, Oxford University researchers have proposed an <a href="https://www.nature.com/articles/s41586-024-07421-0">approach</a> to estimate whether an LLM is hallucinating by calculating the degree of uncertainty, or entropy, in its output based on the distribution of generated meanings. If a model is likely to generate outputs with a variety of meanings given a particular input, it increases the likelihood that the response will be a hallucination.</p><p>Retrieval augmented generation (RAG) can also offer some help in such scenarios since it extends the model’s knowledge beyond its training set. Similarly, incorporating agentic workflows, which involve tools for factual verification and reflective prompts to encourage the model to self-assess, shows promise in addressing these limitations.</p><p>Ultimately, as end users of these technologies, we bear the responsibility of verifying outputs from models trained with potentially biased or inaccurate data. By diligently checking the outputs, we can help ensure they are fair, reliable, and non-offensive, thereby minimizing potential harm.</p><h4>Do you conduct systematic bias testing eg: (specifically for this group) data scientist = male</h4><p>Conducting systematic bias testing is critical to ensure AI models are fair and inclusive. However, in the context of Generative AI models, this process presents unique challenges. Unlike traditional AI models, we rarely train Gen AI models from scratch due to the costly and time-consuming nature of training, the extensive GPU requirements, and the high level of technical expertise needed. This limits our ability to control the quality and diversity of the input data, making traditional bias testing infeasible.</p><p>Instead, we employ a different approach focused on monitoring and mitigation. Here’s how we handle it:</p><ol><li><strong>Human-in-the-Loop at Inference</strong>: We integrate human oversight during the inference phase to monitor the model’s outputs. If we observe that the model’s responses are unfairly favoring males over females, say for roles such as “data scientist,” we take immediate action.</li><li><strong>System Prompt Adjustments</strong>: To mitigate biased outputs, we update the system prompts to encourage more gender-neutral responses. This helps in reducing the model’s inclination towards gender stereotypes.</li><li><strong>Few-Shot Learning</strong>: When text generations exhibit gender bias, we use few-shot learning techniques to correct this behavior. By providing the model with specific examples, we guide it towards producing more balanced outputs.</li><li><strong>Retrieval-Augmented Generation (RAG)</strong>: In some extreme cases, we utilize RAG techniques, which involve contextualizing the instruction task with our custom datasets. These datasets are curated to be clean and bias-corrected, allowing the model to generate more equitable responses.</li></ol><p>Through these methods, we continuously monitor and adjust our generative AI models to ensure they align with our fairness and inclusivity goals. This approach allows us to address biases dynamically, even when we don’t have full control over the initial training data.</p><h4>Great to see the RAI principles in place — would be great to see more how these are operationalised in future. Do you use any particular frameworks to implement these?</h4><p>At Haleon, we have designed an internal Responsible AI policy containing principles that govern the way we build and deliver AI products. Operationalizing these principles is indeed a crucial aspect of our work. Here are some key frameworks and methodologies we use to implement them</p><ul><li><strong>Human-in-the-Loop (HITL) Systems</strong>: To maintain accountability, we integrate human oversight in our AI decision-making processes. This helps in validating the AI outputs and ensuring that they align with our ethical standards.</li><li><strong>Bias Mitigation</strong>: We do thorough research into the bias and limitations of the underlying training data before adopting a SOTA large language model. The choice often varies depending on the downstream task.</li><li><strong>Transparency</strong>: For transparency, we disclose whenever Gen AI has been used to perform or augment a task.</li><li><strong>Ethical AI Frameworks</strong>: We redact PII/CSI data before using closed-sourced Gen AI models. We have also developed an internal Gen AI standard to establish ethical usage guidelines for Gen AI models.</li><li><strong>Continuous Monitoring and Feedback Loops</strong>: We regularly monitor our Gen AI products post-deployment to ensure no data drift/model drift has occurred.</li><li><strong>Explainability</strong>: Throughout the product’s lifecycle, we engage with stakeholders to get their input on the product and build trust. This ensures the inner workings of the LLM are not a black box for them.</li><li><strong>Robustness and Security</strong>: We conduct regular audits to ensure products are built in line with Gen AI standards.</li></ul><h4>What risks relating to AI and Gen AI are most concerned about?</h4><p>Both from an AI and Gen AI perspective, one of our biggest concerns is false outputs or hallucinations. We work in a highly regulated environment and the implications of an incorrect output can span across the entire business, so we have developed a robust responsible AI program to mitigate the risk.</p><h4>I am interested in the data quality measures and metrics you have in place to train the LLMs. What were the competitive benchmark tools that you have used to evaluate &amp; develop your internal capability / model?</h4><p>1. <strong>Native Speaker Feedback:</strong> We rely heavily on feedback from native speakers to assess translation quality. This feedback is collected through live user sessions and the feedback rating feature in our app. Native speakers are essential in the development of our app, as they provide insight on whether a translation sounds natural and understand the nuances of language.</p><p>2. <strong>METEOR Score:</strong> For evaluating our translation accuracy, particularly during the prompt engineering phase, we used the METEOR score as our primary metric. Reference translations were provided by respective markets in Haleon. We found that METEOR scores closely align with native speaker feedback, making it a reliable metric for our needs. For more about the different evaluation tools we explored and why we chose METEOR as our primary metric, refer to our blog post: <a href="https://medium.com/trusted-data-science-haleon/metrics-for-evaluation-of-translation-accuracy-5d0bacd647ca">Metrics for evaluation of translation accuracy | by Guzal Bulatova | Trusted Data Science @ Haleon | Medium</a></p><p>3. <strong>Comparative Tests:</strong> We conducted tests to compare our tool against third-party translation tools used within our organization, like DeepL and Google Translate. We compared METEOR scores of the translations from different tools across many languages. The results showed that our tool achieved an average METEOR score of 0.662, higher than Google Translate’s 0.609 and DeepL’s 0.610. These findings indicate that our tool provides higher quality translations, as evidenced by its closer alignment with reference sentences.</p><p>4. <strong>Stress Testing:</strong> We performed stress testing on large datasets to evaluate translation quality across various topics. This testing helps us ensure that our translations are consistently high-quality across different domains.</p><h4>Can you give us an example of how specific governmental policy and regulation surrounding AI has impacted your work so far?</h4><p>We are a global company and need to follow both local, national and international regulations on AI and adhere to the policies and standards put in place. Most recently the EU AI act has gone into effect and we have ensured our existing Responsible AI programme adheres to the recommendations and restrictions made there.</p><h4>What’s next for GenAI at Haleon?</h4><p>We are exploring automatic accuracy metrics to reduce reliance on human feedback, especially in production environments where only source text and translations are available. We aim to establish reliable accuracy tracking mechanisms without human references.</p><p>We are also exploring evaluation metrics for languages like Mandarin and Japanese. Hieroglyphic languages have complex character-based systems and different grammatical structures, making it difficult for METEOR to accurately evaluate translations in these languages.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb27f8c200ac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trusted-data-science-haleon/q-a-genai-haleon-cb27f8c200ac">Q&amp;A: GenAI @ Haleon</a> was originally published in <a href="https://medium.com/trusted-data-science-haleon">Trusted Data Science @ Haleon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Challenges in implementing Gen AI products]]></title>
            <link>https://medium.com/trusted-data-science-haleon/challenges-in-implementing-gen-ai-products-7e4659f84096?source=rss----3e46225d312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/7e4659f84096</guid>
            <category><![CDATA[haleon]]></category>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <dc:creator><![CDATA[Dr. Varshita Sher]]></dc:creator>
            <pubDate>Mon, 29 Jul 2024 08:17:17 GMT</pubDate>
            <atom:updated>2024-07-29T08:17:17.216Z</atom:updated>
            <content:encoded><![CDATA[<h4>GEN AI @ Haleon</h4><h4>And the alternate solutions you can try</h4><p>By <a href="https://medium.com/@varshitasher">Dr. Varshita Sher</a></p><p><em>Disclaimer: The article assumes understanding of and experience with basic Gen AI terms and terminology.</em></p><figure><img alt="A robot working on a laptop" src="https://cdn-images-1.medium.com/max/1024/0*7Jlgu4Mbs7x8kJS3.jpg" /><figcaption>Image by <a href="https://pixabay.com/users/alexandra_koch-621802/">Alexandra_Koch</a> on <a href="https://pixabay.com/illustrations/ai-generated-robot-laptop-write-8741448/">Pixabay</a></figcaption></figure><p>Haleon, as a leading healthcare company, focuses on Generative AI due to the immense value it brings in processing and understanding large volumes of textual data. With vast amounts of feedback from people discussing the products we sell on social media and a plethora of internal company documents, generative AI plays a pivotal role. It enables us to efficiently analyze this data, extract meaningful insights, and enhance decision-making processes. As we build these Gen AI-driven products, we adhere to responsible AI guidelines to ensure safe and fair use, though we face certain challenges that are discussed below.</p><h3>Introduction</h3><p>The proliferation of orchestration libraries like LangChain, CrewAI, and LlamaIndex has empowered data scientists to swiftly develop a working POC that demonstrates the capabilities of complex foundational models and data pipelines. This enables faster iterations and more efficient validation of ideas. For example, you can create a simple pipeline to classify tweet sentiment or set up a RAG (Retrieval-Augmented Generation) pipeline to review content based on policy documents.</p><p>However, in most cases, the post-POC phase encounters unforeseen challenges that hinder the transition from POC to a fully developed data product. Let’s examine some of these challenges and explore potential solutions for each.</p><h4>1. The Gen AI solution is very costly</h4><p>Even with the advent of open-source models like DBRX and Mixtral, which are relatively cheaper compared to closed-source ones like the GPT family, some tasks require a significant number of tokens. This can lead to substantially higher costs even with cheaper models. Therefore, it is advisable to focus on minimizing token usage regardless of the model’s price.</p><p>A straightforward solution is to enlist a prompt engineering expert to optimize the system prompt. You might be surprised at how some of the newer LLMs can operate effectively with minimal guidance and fewer few-shot examples in the prompts.</p><p>Additionally, consider whether parts of your pipeline can benefit from a strategic selection of LLMs. For instance, if you’re handling a simpler instruction task, you could use an SLM (Small Language Model) such as Microsoft’s Phi. For more complex tasks like Agentic RAGs, it’s advisable to use more advanced LLMs like Claude or GPT-4.</p><p>You can also consider LLM response caching where frequent or repetitive API calls to the LLM are stored temporarily. This <a href="https://arxiv.org/abs/2403.02694">caching mechanism can significantly reduce latency</a> and improve overall system performance by serving previously generated responses instead of making fresh requests each time.</p><p>If you are implementing RAG, ensure you cap the number and size of relevant documents appropriately, as all these need to be processed by the LLM. Avoid using excessively large chunks or overlapping chunks. Opt for vector databases that allow metadata filtering and Exact Nearest Neighbour (ENN) to pre-filter the results and ensure relevancy. ENN guarantees retrieval of the absolute closest vectors to your query, eliminating the accuracy limitations inherent in Approximate Nearest Neighbours (ANN).</p><p>Additionally, if you are using an orchestration library like LangChain, be mindful of the multiple LLM chains called under the hood to achieve the end results. For instance, dissecting the RetrievalQA chain in LangChain reveals that it comprises the StuffDocumentsChain and combine_documents_chain. Both chains, by default, use the same model supplied during initialization and have substantially long default system prompts. Moreover, the StuffDocumentsChain uses additional sub-chains to preprocess the chunks returned from the retriever. Consequently, the output token count can be significantly higher than if you implemented RAG from scratch.</p><p>It would be beneficial to choose an expensive model for the StuffDocumentsChain, as it needs to extract relevant answers from the retrieved chunks (a complex task), and a cheaper model for the combine_documents_chain, as it only needs to summarize the intermediate answers into a comprehensive response (a simpler task).</p><p><em>Note: If you are sending numerous few-shot examples as part of few-shot prompting, it might indicate that you need to consider fine-tuning. This can help you avoid sending these examples with every single API call. For instance, if you have many guidelines and examples for classifying tweets based on your company’s marketing policy, fine-tuning the model would allow you to only send the sentence to be classified, eliminating the overhead of including examples each time.</em></p><p><em>Be aware that fine-tuning introduces additional overhead costs, including hosting the fine-tuned model, and expenses related to GPUs for training and inference. This option should be carefully evaluated before committing to ensure it aligns with your cost and performance requirements.</em></p><h4>2. The Gen AI Solution is very slow</h4><p>Yes, the POC you built was able to showcase the solution but no one likes waiting for more than a couple of seconds to get the response back from the API call to the LLM.</p><p>So what can you do?</p><p>To improve response times, consider parallelizing your code. For example, if your goal is to summarize 10 documents, you can execute these tasks concurrently because each API call is independent of the others. Libraries like asyncio can help you achieve this parallel execution, or some orchestration libraries offer built-in support for parallel processing.</p><p>If you are using a Pay As You Go model with your LLM provider, remember that the Tokens Per Minute (TPM) rate limit displayed applies to all users on the platform, not just you. This shared limit can impact your usage during peak periods, potentially leading to longer wait times or, in the worst case, encountering Error Code 429, which indicates too many requests within a short timeframe. This can disrupt your workflow and cause delays in your project timeline. (Implementing exponential backoff logic can help manage the frequency of retry attempts but will negatively impact the underlying delays as this approach progressively increases the wait time between consecutive retries.)</p><p>To mitigate these issues, consider upgrading to paid PTUs (Provisioned Throughput Units) that offer guaranteed rate limits. This allows you to optimize your codebase to maximize use of the context window and TPMs. Additionally, explore load balancing strategies to distribute requests across multiple instances, ensuring more consistent performance and reducing the likelihood of encountering rate limits or delays.</p><p>If speed is a critical concern, consider switching to quantized models in your codebase. Quantized calculations are simpler and demand less processing power, resulting in faster inference times. This allows the <a href="https://arxiv.org/abs/2402.18158">model to generate responses more quickly</a>. The main trade-off with quantization is a potential slight decrease in accuracy, but in most cases, this decrease is typically negligible.</p><h4>3. The Gen AI solution is hallucinating a lot</h4><p>One of the significant challenges observed with LLMs is their tendency to hallucinate. In some of the latest models, this hallucination isn’t related to answer accuracy or relevance but rather concerns adherence to formatting instructions. LLMs often struggle to consistently produce output in the requested format.</p><p>For example, when requesting a response in JSON format, the model might comply correctly only 80% of the time. The remaining 20% poses a risk of breaking the code if proper error handling isn’t implemented.</p><p>A straightforward approach is to retry each time the formatting instructions are not followed. However, this can result in considerable token wastage and increased latency.</p><p>Alternatively, albeit more complex, an effective solution involves manually identifying and observing the 20% of deviations. Custom parsers can then be developed to handle these format discrepancies, reducing the need for repeated retries and conserving tokens.</p><h4>4. How do I trust the outputs from the Gen AI products?</h4><p>This issue lacks a straightforward solution. Even after trying various approaches in development and user acceptance testing (UAT), issues may still arise in production. However, this doesn’t negate the importance of conducting evaluations. It’s crucial to begin planning how to evaluate LLM outputs specific to your use case — whether it’s translation, Q&amp;A, classification, etc. — from the outset and research relevant metrics to quantify results (e.g., METEOR for translations, accuracy for classification).</p><p>One approach is to utilize LLM-based evaluators such as QAG metrics for RAG-based solutions. These are easy to set up and do not require a ground truth response, but they can be resource-intensive. Alternatively, a more traditional method involves gathering a dataset of questions and their ground truth responses to generate metrics like cohesiveness, relevance, and coherence.</p><p>For the most rigorous evaluation, consider manual UAT-based testing with human-in-the-loop, which remains essential despite its time constraints.</p><p>Hopefully, being aware of these challenges in advance helps you get a head start and avoid potential pitfalls. General AI is a nascent field, with rapid advancements and ongoing updates shaping its landscape. Some of the challenges discussed today may become obsolete in the near future. Until then, it is essential to stay informed, adapt strategies accordingly, and continually innovate to harness the full potential of this evolving technology.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e4659f84096" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trusted-data-science-haleon/challenges-in-implementing-gen-ai-products-7e4659f84096">Challenges in implementing Gen AI products</a> was originally published in <a href="https://medium.com/trusted-data-science-haleon">Trusted Data Science @ Haleon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet Mohsin, Data Scientist]]></title>
            <link>https://medium.com/trusted-data-science-haleon/meet-mohsin-data-scientist-656612c6c58c?source=rss----3e46225d312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/656612c6c58c</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[data-scientist]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mentoring]]></category>
            <category><![CDATA[meet-the-team]]></category>
            <dc:creator><![CDATA[Mohsin Zafar]]></dc:creator>
            <pubDate>Mon, 15 Jul 2024 08:02:41 GMT</pubDate>
            <atom:updated>2024-07-15T08:02:40.015Z</atom:updated>
            <content:encoded><![CDATA[<h4>by<a href="https://medium.com/@mohsin.zafar"> Mohsin Zafar</a></h4><p>My name is Mohsin Zafar, and I am a Data Scientist based in London, UK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*Cl2uQO8xozIYhhnLgVpEaw.png" /><figcaption>Mohsin</figcaption></figure><h3><strong>A little bit about me</strong></h3><p>I have a background in Mathematics from the University of Warwick, with over five years of experience working as a Data Scientist in London. Currently, I am involved in diverse data science projects at Haleon, where I use data to drive innovation and informed decisions in the healthcare industry.</p><p>A fun fact about me: I <em>love</em> learning languages. My parents are from Pakistan, so I speak Urdu and Hindi. I grew up in Germany, so I speak German natively and spent an academic year abroad in Spain which allows me to practice my Spanish. Additionally, I started learning Arabic this year as well, which I am super excited about!</p><h3>What did I want to be when I grew up?</h3><p>Growing up, I had a passion for gaining knowledge and improving people’s lives. In school, I was inspired by scientists like Al-Razi (Rhazes), known for his work in medicine and chemistry. Learning about his discoveries, such as pioneering the use of alcohol in medicine and developing early antiseptics, in my biology class motivated me to pursue science further. His medical innovations, which have helped many fuelled my desire to pursue a career in STEM.</p><p>As I grew older, I found a strong affinity for mathematics, leading me to pursue a degree in the field. My goal was to combine my maths skills with my knowledge of science, biology, and chemistry to contribute to advancements in these areas. I am very fortunate that being a Data Scientist at Haleon allows me to realise my childhood passion as I work on projects that support and enhance scientific research and innovations that improve people’s lives.</p><h3>Why did I choose this career path?</h3><p>During my year abroad at the University of Barcelona in Spain, I had the chance to take some master’s courses in their data science program. I took classes like Introduction to Machine Learning Models, Time Series Analysis, and Computer Vision. I enjoyed these subjects and fell in love with the idea of combining mathematics with programming to develop machine-learning models and statistical forecasts.</p><p>After that year abroad, I knew this was the direction I wanted to go. I wanted a career that combined programming with heavy use of mathematics and statistics, and data science was the perfect fit. This path keeps me intellectually stimulated and brings me immense joy.</p><h3>How Do I Keep Up With the Field?</h3><p>Staying current in data science is essential. I regularly read research papers and articles from top journals and websites. Also attending webinars, and conferences from groups such as GraphQL and Pydata. I like taking online courses from platforms such as Linkedin Learning, Coursera and MIT OpenCourseWare to keep up with new developments. I try to take part of data science communities, both online and offline, which allows me to learn from others and share ideas.</p><h3>What’s Your Top Tip for Anyone Who Wants to Enter the Field?</h3><p>My top tip for aspiring data scientists is to build a strong foundation in math, statistics, and programming. These skills are crucial for understanding data science techniques. Work on practical projects to apply what you learn and build a portfolio. Having a personal blog and creating videos can also help you stand out from the competition. Stay curious and keep learning, as the field is always evolving. This approach will help you stand out and succeed in data science.</p><h3>What do I like most about working at Haleon?</h3><p>Haleon’s motto of “Everyday Health with Humanity” and its mission to deliver better health wherever they can deeply resonate with my childhood dream of using science and technology to improve people’s lives. This alignment of passions is what drew me to Haleon and has kept me motivated throughout my career.</p><p>At Haleon, I work with incredibly brilliant and humble individuals. The environment is collaborative and supportive, and I never hesitate to ask questions, whether from seniors, juniors, or colleagues across the globe. Everyone is down-to-earth and committed to both professional and personal growth.</p><p>We also have an amazing team of junior data scientists who go above and beyond to master both the technical and professional skills they need. Mentoring them ties in with one of my passions: teaching. It’s a great joy to guide them and watch them grow over time. This dynamic and nurturing environment makes working at Haleon truly fulfilling for me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=656612c6c58c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trusted-data-science-haleon/meet-mohsin-data-scientist-656612c6c58c">Meet Mohsin, Data Scientist</a> was originally published in <a href="https://medium.com/trusted-data-science-haleon">Trusted Data Science @ Haleon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Specificity and Sensitivity in Data Science]]></title>
            <link>https://medium.com/trusted-data-science-haleon/specificity-and-sensitivity-in-data-science-9d0c19b102ab?source=rss----3e46225d312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/9d0c19b102ab</guid>
            <category><![CDATA[technical-deep-dive]]></category>
            <category><![CDATA[evaluation-metric]]></category>
            <category><![CDATA[confusion-matrix]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Dr Shruti Turner]]></dc:creator>
            <pubDate>Mon, 17 Jun 2024 08:02:31 GMT</pubDate>
            <atom:updated>2024-06-17T08:02:30.437Z</atom:updated>
            <content:encoded><![CDATA[<h4>by <a href="https://medium.com/@shrutiturner">Dr Shruti Turner</a></h4><p>In data science, evaluation metrics are crucial for assessing the performance and effectiveness of models. A classification model in data science is an algorithm that categorises data into predefined classes or labels based on input features. It is used to predict the class or category to which new data points belong. These models are used across business contexts and industries, e.g. marketing, auditing, fraud detection, medical diagnoses.</p><p>At Haleon, we use metrics as a basis to evaluate our models to make sure they are scientifically robust, choosing the metrics to optimise based on the specific business need and the risks associated with the context. We want to create tools that not only meet the business need but do so in a transparent way that we can explain and justify. We want to deliver trusted science, which forms the foundation of our data science. Without using the appropriate success metrics, we may not know the robustness of our models, or even know if they are producing outputs correctly. It is important that we understand the strengths and weaknesses of our models to be able to determine the risks we are taking when using them.</p><p><em>Specificity</em> and <em>sensitivity</em> are used to evaluate classification models. These metrics help evaluate the performance of a model in distinguishing between different classes, providing a more nuanced understanding of its effectiveness than overall accuracy alone. However, the only way to truly understand how models should be optimised is to understand the context in which the model is being applied, allowing us to understand which metrics should be prioritised for optimisation.</p><p>In this article, we will explore the components that underly <em>sensitivity</em> and <em>specificity</em>, then dive into the details of these two metrics and how they can be utilised with a worked example.</p><h3>The Confusion Matrix</h3><p>To really understand <em>specificity</em> and <em>sensitivity</em>, we should understand the confusion matrix.</p><p>It provides a breakdown of the model’s prediction compared to the actual labels, helping to identify how many data points were correctly or incorrectly labeled (or classified). The possible relationships of the model label compared to the actual label can be represented in a matrix (figure 1) or visually (figure 2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cwyNIBCBw26R7bS-2Umm4A.png" /><figcaption>Figure 1: Confusion Matrix</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cnjT8z5szs9Voukp5ituvw.png" /><figcaption>Figure 2: Visual representation of Confusion Matrix</figcaption></figure><p>In Figure 2, the small circles represent the data points in the sample (total 23). The small circles outside the circular boundary, are the data points that the model has classified as negative (total 14) — split between the data points correctly classified as negative (true negatives — 9) and the data points incorrectly classified as negative (false negatives — 5).</p><p>Inside the boundary of the circle are the data points that the model classified as positive. These are split between the data points correctly classified (true positives — 5) and incorrectly classified (false positives — 4). The visualisation shows that the number of true positives, false positives, true negatives, and false negatives must add up to the total number in the sample.</p><p>Using this understanding, we can delve into two important metrics, <em>sensitivity</em> and <em>specificity</em>.</p><h3>Sensitivity</h3><p><em>Sensitivity</em>, also known as <strong>recall</strong> or the <strong>true positive rate</strong>, measures the proportion of data points with positive labels that are correctly classified by the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*HNFlE1TXPDe2RPd-KTQe9w.png" /></figure><h4>Importance of Sensitivity</h4><p><em>Sensitivity</em> reflects the model’s effectiveness in classifying data points with a positive label. A high sensitivity value indicates that the model successfully labelled most of the data points with an actual positive label, minimising the number of false negatives (data points with a label of positive that the model has classified as negative).</p><p>If a model has high sensitivity, it means the model correctly classified a high proportion of actual positives as positives. When <em>sensitivity</em> is high, the denominator (TP+FN) remains relatively small compared to the numerator (TP), indicating few false negative classifications.</p><p><em>Sensitivity</em> is particularly important in scenarios where missing a positive label can have serious consequences. For instance, in medical diagnostics, high <em>sensitivity</em> ensures that most patients with a disease are correctly classified and receive necessary treatment. This minimises the risk of untreated conditions, where the model may classify a patient with a disease as not having one.</p><h3>Specificity</h3><p><em>Specificity</em>, also known as the <strong>true negative rate</strong>, measures the proportion of data points with a negative label that are correctly classified by the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*d2WLk61TxtOg2fij-C-iBg.png" /></figure><h4>Importance of Specificity</h4><p><em>Specificity</em> reflects the model’s effectiveness in correctly classifying data points with a negative label. A high <em>specificity</em> value indicates that the model successfully classifies most of the data points with actual negative labels, minimising the number of false positives (data points with a label of negative that the model has classified as positive).</p><p>If a model has a high <em>specificity</em>, it means the model correctly classifies a high proportion of actual negatives as negatives. When <em>specificity</em> is high, the denominator (TN+FP) remains relatively small compared to the numerator (TN), indicating few missed negative classifications.</p><p>High <em>specificity</em> is particularly important to avoid misdiagnosing healthy individuals as diseased, preventing unnecessary anxiety and treatment. These can have serious consequences for health and finances, amongst other factors.</p><p>There is, however, a trade off between these metrics which must be optimised for the specific need. The prioritisation of metrics is determined by the real-world application in which the model will be used. The real-world application determines exactly what is “riskier” — a false positive or a false negative?</p><h3>Worked Example</h3><h4>Context</h4><p>Let’s say you are working for a hospital, and you are tasked with checking whether patients are “at risk” for a condition based on their medical history. Instead of doing this manually, you use a classification model to classify patients into “at risk” (i.e., a positive label) or not (i.e., a negative label).</p><p>You want to know how good your model is, so you see how well the model predicts the labels for a sample of 100 patients, 40 of which are “at risk” and 60 of which are not.</p><p>When you compare the output of the model to the actual labels, you find that of the 40 “at risk” patients, the model only classified 35 of them correctly. Of the 60 patients <strong><em>not</em></strong> “at risk”, 15 patients were classified incorrectly.</p><h4>How can we use this information to evaluate the model’s performance?</h4><p>Thinking in terms of the confusion matrix, we should identify the number of patients in each category that were classified correctly and incorrectly, i.e. calculate TP, TN, FP, FN.</p><p>Directly from the context, we can deduce the following (figure 3):</p><p>TP — the number of “at risk” patients the model classified correctly (35)</p><p>FP — the number of patients who were not at risk classified incorrectly (15)</p><p>We know from the Confusion Matrix that actual positives are a sum of the true positives and the false negatives, and that the actual negatives are a sum of the false positives and the true negatives. Ergo, we can calculate TN and FN:</p><p>TN — the number of patients who were not at risk classified correctly (45)</p><p>FN — the number of “at risk” patients the model classified incorrectly (5)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*N6JO8_-YedIlnx__TDc5PQ.png" /><figcaption>Figure 3: Completed Confusion Matrix for Worked Example</figcaption></figure><p>We can substitute the values to the <em>sensitivity</em> and <em>specificity</em> calculations to understand the model&#39;s performance:</p><p>Specificity = 45 / (45+15) = 45 / 60 = 0.750</p><p>Sensitivity = 35 / (35+5) = 35 / 40 = 0.875</p><h4>What does this tell us?</h4><p>The model has a <em>specificity </em>of 0.750, which means that the model correctly classifies patients not at risk 75.0% of the time. As the model has a<em> sensitivity</em> of 0.875, it shows that it classifies “at risk” patients correctly 87.5% of the time.</p><p>For this context, we can evaluate the <em>specificity</em> of 0.750 to understand that for every 100 patients that are classified as not being at risk, 25 (or 1/4 of patients) who are not “at risk” will receive interventions or treatments even though they don’t need it.</p><p>From the <em>sensitivity</em> of 0.875, we can deduce that 12.5% of patients who are “at risk” do not get classified correctly, meaning for every 100 patients who are “at risk”, 13 (rounding 12.5 to whole humans!) will not receive the appropriate treatment/intervention which could potentially prevent the disease and save their life.</p><p>From here, it is up to you (and your stakeholders) to determine whether this is an acceptable level of risk. Or should you be refining the model to improve one or both of these metrics? Which is the more important one — is it better to treat people who don’t need it or not treat people who do? This question can really only be answered by experts in the medical field for each real disease, as the cost, time, and risk of these is not known in this hypothetical example.</p><h3>Sensitivity and Specificity Trade Offs</h3><p>Determining the priority between a high <em>sensitivity</em> and <em>specificity</em> is crucial for developing robust classification models. Achieving the right prioritisation depends on the specific application and the consequences of false positives and false negatives. There are some strategies and guidelines to help you balance these metrics:</p><h4>Adjusting the Decision Threshold</h4><p>The decision threshold is the probability cutoff at which a model assigns a positive label. By adjusting this threshold, you can shift the prioritisation between <em>sensitivity</em> and <em>specificity</em>, e.g., lowering the threshold increases sensitivity (more positives identified) but decreases specificity (more false positives) and vice versa.</p><h4>Cost-Benefit Analysis</h4><p>Evaluate the costs and benefits of false positives and false negatives for your specific application. This analysis helps determine whether to prioritise <em>sensitivity</em> or <em>specificity</em>. In disease screening, the cost of missing a disease (false negative) is often higher than the cost of a false alarm (false positive), thus prioritising sensitivity.</p><p>We can also introduce <a href="https://en.wikipedia.org/wiki/Evaluation_of_binary_classifiers#Single_metrics">other metrics</a>, using the values that make up the confusion matrix to complement the insights from using <em>specificity</em> and <em>sensitivity</em>, such as precision or F1 score.</p><p>It might seem that using many metrics (even ALL the metrics!) would be the way to get the most robust model. However, as can be seen with <em>sensitivity</em> and <em>specificity</em>, there may be trade-offs in terms of performance due to conflicting focuses of the metrics. There is also a resource cost involved with increasing number of metrics to be optimised, if it is even possible. For each case, there will be an optimum choice and number of metrics to use based on the resources available for the project (including, time, money, computational power).</p><h3>Round Up</h3><p>Understanding and correctly using <em>specificity</em> and <em>sensitivity</em> is fundamental in developing robust classification models, with known weaknesses and strengths. These metrics provide insights into a model’s performance, particularly in distinguishing between positive and negative labels. <em>Sensitivity</em> measures the model’s ability to correctly identify positive labels, and <em>specificity</em> evaluates the model’s ability to correctly identify negative labels.</p><p>Incorporating <em>specificity</em> and <em>sensitivity</em> into your evaluation process ensures an optimized approach to model performance, helping you to make informed decisions based on the trade-offs between these metrics.</p><p>Using metrics to evaluate models and understand their strengths and weaknesses is a vital part of Trusted Science. Making the models more understandable to the users so they can make an informed choice about using them. Machine Learning should not just be a black box we know nothing about!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d0c19b102ab" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trusted-data-science-haleon/specificity-and-sensitivity-in-data-science-9d0c19b102ab">Specificity and Sensitivity in Data Science</a> was originally published in <a href="https://medium.com/trusted-data-science-haleon">Trusted Data Science @ Haleon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MLOps in practice: Automated deployment of ML solution to multi environments.]]></title>
            <link>https://medium.com/trusted-data-science-haleon/mlops-in-practice-automated-deployment-of-ml-solution-to-multi-environments-19f195a9329c?source=rss----3e46225d312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/19f195a9329c</guid>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[technical-deep-dive]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[haleon]]></category>
            <dc:creator><![CDATA[Jagadish Kakhandaki]]></dc:creator>
            <pubDate>Mon, 20 May 2024 08:31:44 GMT</pubDate>
            <atom:updated>2024-05-20T08:31:43.936Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction:</h3><p>In recent years, Machine Learning (ML) has shifted from almost purely academic applications to becoming an integral part of decision making processes for the most top performing companies in the world. With this shift to industry applications, came the necessity for more reliable deployment and operation of machine learning models creating a new discipline — MLOps. As a senior Machine Learning Engineer at Haleon, I am really passionate about creating robust ML pipelines that ensure smooth and efficient deployment and reliable running of models. I helped develop and deploy some of the key ML applications at Haleon, and here I will share with you how we do it to deliver Machine Learning projects for our users.By incorporating software engineering practices, MLOps streamlines the transition from developing ML models (data science) to their successful deployment and operation in production (software engineering). This approach improves efficiency and ensures smooth model integration into real-world applications.</p><p>By incorporating software engineering practices, MLOps streamlines the transition from developing ML models (data science) to their successful deployment and operation in production (software engineering). This approach improves efficiency and ensures smooth model integration into real-world applications.</p><p>At Haleon, we are solving problems using AI/ML which includes predictive analytics, image recognition, generative AI and much more. All these applications are -built as global data products that consistently help Haleon make better decisions. This is why we need to make sure that we build infrastructure to reliably support these applications and ensure their scalability. To achieve this, we have built a multi environment setup of MLOps with best practices from software engineering, such as version control, continuous integration, deployment (CI/CD), automated testing, monitoring, and model versioning to cultivate clean, maintainable, and reproducible data science code and machine learning models.</p><h3>Architecture overview:</h3><p>Whole MLOps architecture is designed in Azure cloud. We followed deploy code workflow.</p><figure><img alt="MLOps architecture for multi environment deployment" src="https://cdn-images-1.medium.com/max/1024/1*9VEpZirqYk60hMV2W34ncg.png" /><figcaption>MLOps architecture for multi environment deployment.</figcaption></figure><p><strong>Below are the key components:</strong></p><ol><li><strong>Code version control</strong>: GitHub is used for code version control. Branches are created and protected for each environment deployment.</li><li><strong>Azure Data Lake Gen2: </strong>Data from multiple sources are processed through Data Engineering pipeline and published in Azure Data Lake Gen2 as optimised layer for ML consumption. Outputs from MLOps pipelines are also pushed back to data lake for downstream applications to consume.</li><li><strong>Azure ML studio</strong>: Compute instances from Azure ML studio are used by data scientists for development work and then MLops pipelines are run in ML studio and deployed through CI/CD pipelines. MLflow is used for experiment tracking, logging and model registry within Azure ML.</li><li><strong>Azure container registry</strong>: Docker images are created with source code and environment to run the code and pushed to ACR(Azure container registry) as part of CI pipeline. Later this image from ACR(with code commit versions as tag) is used for creating Azure ML environment to run MLOps pipelines.</li><li><strong>CI/CD pipeline</strong>: GHA(Github action) is used for running CI/CD pipelines. CI pipeline runs unit tests and integration tests, builds docker image and pushes it to ACR. CD pipeline creates MLOps pipelines using Azure ML sdk, pushes them and runs them in Azure ML studio.</li></ol><p><strong>Different environments and their purpose</strong>:</p><p><strong>Devtest</strong>: In the devtest environment, data scientists and ML engineers can collaborate on all pipelines in an ML project, committing their changes to source control. Once the PR is created from feature branch to develop branch, CI pipeline runs. ML engineers help configuring environment, compute resources and CI pipelines. Both ML engineers and Data scientists write unit tests which are run as part of CI pipeline.</p><p>Once PR is merged to dev branch, all the MLOps pipelines (training, evaluation and inferencing pipelines) run in devtest environment through CD pipeline. A successful run makes the dev branch ready for UAT environment.</p><p><strong>UAT</strong>: UAT environment facilitates the code transition from dev-test to prod. In here, MLops pipelines are run with production data, and results are made available for users to test. Once users are satisfied with the results, the code is ready for deployment to production.</p><p><strong>Production</strong>: The production environment is typically managed by a select set of ML engineers and is where ML pipelines directly serve the business or application. In production, model artifacts, pipelines, and predictions are registered as assets in the governance tool and predictions are published to downstream tables and/or applications. And entire process is monitored to avoid performance degradation and instability.</p><h3><strong>Best practices used for reducing tech debts and improving scalability</strong></h3><p><strong>Code standards and pre-commit checks</strong>: To enhance the code quality and readability, a number of pre-comit checks like flake8, pydocstyle, black, isort and mypy are added to repo. These checks run as part of the CI pipeline making sure that any committed code follows our defined standards.</p><p><strong>Unit tests and integration tests</strong>: Unit tests ensure individual parts of your ML code (functions, classes) work as expected. Integration tests verify how these parts work together as a whole. Both are crucial for catching errors early, improving ML project reliability and maintainability.</p><p><strong>PR review process</strong>: It provides a second pair of eyes to catch errors in code or analysis, preventing bugs from slipping into production. Reviewers can also suggest best practices and ensure the changes align with project goals, fostering knowledge sharing within the team. A clear and concise pull request description outlining the changes and their rationale is essential to maximize the effectiveness of peer reviews.</p><p>We have set minimum of 2 peer review approvals and passing of CI pipeline is prerequisite for PR merge.</p><p><strong>Yaml configuration files</strong>: These files centralise configuration details, keeping them separate from code. This simplifies updates and experiments, as you modify values in the YAML file without touching the code itself. This promotes better code organisation and maintainability. YAML’s simplicity also makes it easy to version control alongside your code, enabling easy tracking of configuration changes.</p><p>In our projects, we used files where infra defined parameters like storage account and infra-independent values such as model hyperparameters.</p><p><strong>Logging and monitoring:</strong> Logging captures key events and metrics during your data science project, while monitoring actively tracks these logs and performance indicators to identify issues and ensure smooth operation.</p><p>We use the standard Python logging library to handle logging .Using OpenCensus Python SDK, logs are exported to Azure Monitor and through Azure Application Insights, monitoring is enabled for model key metrics.</p><p><strong>Cloud cost management</strong>: Auto scaled clusters are used for running MLOps pipelines. Personal Dev compute provisioned for Data Science team are enabled with auto-stopping based on inactivity.</p><p><strong>Vulnerability scan</strong>: As we are using open source libraries in our code base, it is essential to scan the code for vulnerability to ensure security. Any vulnerabilities found are mitigated according to our SLAs.</p><p>Following a similar approach, we also scan our Docker images for underlying operating system vulnerabilities so assure security.</p><p><strong>Documentation</strong>: Clear documentation is vital for data science projects. It explains the project’s purpose, methods, and results, enabling others to understand the work, reproduce findings, and ensure the project’s long-term value.</p><p>We ensure to document what the code does, how it works and why it is written that way. We also document developer setup and track known issues. All of these activities help our teams to manage onboarding as well as understand and maintain the applications, ultimately saving time and reducing errors.</p><p>Infrastructure documentation is also created to capture details about project’s technical setup. It outlines environment configuration, access control and deployment process.</p><h3>Conclusion</h3><p>This architecture serves as a reusable blueprint for deploying machine learning projects. It incorporates best practices, streamlining the development and deployment process for bringing your ML solution to real-world business applications. Furthermore, this architecture acts as a foundational template that can be adapted for various use cases, such as streaming inference or deployments on different cloud providers. Additionally, you can seamlessly integrate advanced features like a feature store to enhance the functionality of your ML pipeline.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19f195a9329c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trusted-data-science-haleon/mlops-in-practice-automated-deployment-of-ml-solution-to-multi-environments-19f195a9329c">MLOps in practice: Automated deployment of ML solution to multi environments.</a> was originally published in <a href="https://medium.com/trusted-data-science-haleon">Trusted Data Science @ Haleon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet Vaibhav, Senior Data Scientist]]></title>
            <link>https://medium.com/trusted-data-science-haleon/meet-vaibhav-senior-data-scientist-7140fdc6181f?source=rss----3e46225d312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/7140fdc6181f</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[haleon]]></category>
            <dc:creator><![CDATA[Vaibhav Kherde]]></dc:creator>
            <pubDate>Mon, 06 May 2024 08:16:58 GMT</pubDate>
            <atom:updated>2024-05-06T08:16:57.415Z</atom:updated>
            <content:encoded><![CDATA[<h4>By Vaibhav Kherde</h4><p>About Me.</p><p>Hello, I’m Vaibhav Kherde, a Data Scientist specializing in Generative AI and Machine Learning. With 8+ years of experience, I have a strong foundation in healthcare data analysis, my expertise extends to developing and deploying Generative AI models for tasks like text generation, image generation, and creative applications.</p><figure><img alt="Photo of Vaibhav at Marine Drive" src="https://cdn-images-1.medium.com/max/1024/1*ZbrlQ-3b4oLxpq--r4R-Bw.jpeg" /><figcaption>Photo of Vaibhav at Marine Drive</figcaption></figure><p><strong>Can you talk a bit more about your background?</strong></p><p>My diverse background blends my passion for data science with hands-on experience specializing in consumer knowledge and strategic insights. I began my journey by enrolling in specialized courses and certifications, where I developed a strong foundation in data analysis, machine learning, and statistical modeling. Over the years, I’ve been fortunate to work extensively with image analytics, text analytics, and large language models, gaining valuable experience in these areas. Additionally, my exposure to industries like healthcare and insurance has enriched my understanding of how data science can drive meaningful insights and solutions. Overall, my background has equipped me to tackle diverse challenges in the field of data science, and I’m excited about the opportunities ahead to leverage data for innovative solutions.</p><p><strong>What did you want to be when you grew up?</strong></p><p>I was always fascinated by technology and how they were shaping the world around us, from smartphones that make us smarter to gaming consoles that console us after a long day! This fascination fueled my curiosity and desire to understand the inner workings of computers, software, and emerging technologies. As I progressed through my academic journey, my passion for technology deepened, and I realized that pursuing a career in computer engineering would be the perfect avenue to channel my interests and skills. While my childhood aspirations may have been more focused on technology and problem-solving, they eventually lead me to the exciting field of data science.</p><p><strong>What is your DS specialty and how long have you been doing it?</strong></p><p>My specialty in data science revolves around machine learning, artificial intelligence, statistical modeling, and machine learning operations (<em>MLOps</em>). I’ve been actively involved in these areas for 8+ years, honing my skills and expertise through hands-on projects and continuous learning. Recently, with the advancements in generative AI, I’ve been particularly excited about its potential to transform various industries. I’m enthusiastic about further expanding my expertise and making it my specialty to drive groundbreaking solutions and advancements in the field.</p><p><strong>What do you do day to day?</strong></p><p>My day often starts with checking emails, and updates from the team. I also participate in sync-up meetings where we discuss progress, goals for the day, and any blockers with my team ensuring alignment. A significant portion of my day is dedicated to writing code and developing software solutions. This could involve working on new features, fixing bugs, optimizing code, engaging in code reviews, or implementing algorithms based on project requirements.</p><p>As we work in agile, I attend meetings such as sprint planning sessions, design reviews, and technical discussions. These meetings help in coordinating efforts, resolving technical challenges, and aligning with project timelines. Toward the end of the day, I summarize the progress, update task boards or project management tools, and reflect on accomplishments, and lessons learned.</p><p><strong>How do you keep your knowledge current?</strong></p><p>Staying updated with the latest advancements and trends is crucial for any data scientist in the ever-evolving world. Here’s how I keep my knowledge:</p><ol><li>Continuous Learning</li><li>Hands-On Projects</li><li>Following Industry Blogs and News</li><li>Participation in Workshops and Conferences</li></ol><p>Furthermore, I regularly engage in self-directed learning through online platforms and industry resources to stay updated with the latest advancements in data science.</p><p><strong>What’s your top tip for anyone who wants to enter the field?</strong></p><p>When I started in data science, I was overwhelmed by the wide range of technical skills it requires, including efficient programming, statistical analysis, machine learning, data visualization, and big data technologies, as well as mastering these skills to apply them effectively.</p><p>But always remember, every challenge is an opportunity to learn and grow. Rome wasn’t built in a day, and neither is expertise in the field of data science. Always take small, deliberate steps and develop your skills gradually over time. Each step, no matter how small, contributes to your growth and progress in the field.</p><p>Apply your knowledge by working on hands-on projects. Explore a wide range of tools, techniques, and methodologies and start with small problems and gradually tackle more complex ones.</p><p>My key suggestion would be to connect with peers, mentors, and professionals working within the data science community. Engage with them any chance you get in data science meetups, forums, and online communities, share ideas, collaborate on projects, and gain insights from others’ experiences.</p><p><strong>What do you like most about working at Haleon?</strong></p><p>Teamwork is a cornerstone for every organization’s success. Haleon has provided me with a collaborative environment where team members openly share ideas, knowledge, and expertise. The one aspect that I adore above anything else is working alongside experienced professionals, and I am grateful for the opportunity to learn from these experts in their respective fields. I believe their mentorship and guidance will play a crucial role in my growth and development, making me feel privileged to be part of such a knowledgeable team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7140fdc6181f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trusted-data-science-haleon/meet-vaibhav-senior-data-scientist-7140fdc6181f">Meet Vaibhav, Senior Data Scientist</a> was originally published in <a href="https://medium.com/trusted-data-science-haleon">Trusted Data Science @ Haleon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Metrics for evaluation of translation accuracy]]></title>
            <link>https://medium.com/trusted-data-science-haleon/metrics-for-evaluation-of-translation-accuracy-5d0bacd647ca?source=rss----3e46225d312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/5d0bacd647ca</guid>
            <category><![CDATA[machine-translation]]></category>
            <category><![CDATA[technical-deep-dive]]></category>
            <category><![CDATA[translation]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[evaluation]]></category>
            <dc:creator><![CDATA[Guzal Bulatova]]></dc:creator>
            <pubDate>Tue, 23 Apr 2024 12:18:10 GMT</pubDate>
            <atom:updated>2024-04-23T12:18:10.705Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>In this article, we’re giving an overview of the translation accuracy evaluation and comparison of the performance of three metrics — BLEU, ROUGE-L and METEOR against human evaluation. Our findings indicate that <strong>METEOR</strong> exhibits the closest alignment with human assessment, while the widely adopted BLEU metric falls short in comparison.</blockquote><h3>Background and use case</h3><p>At Haleon, the demand for accurate translations is very high. As a multinational company, we operate around the globe and require translations to be done quickly and at scale—for packaging information, website content, quality and regulatory documents, consumer queries and more.</p><p>Mostly the information we’re translating is about our products, which means that we require a very specific type of text (e.g., package leaflet) and a specific choice of words. For instance, in most cases, we require our translations to be accurate and not deviate much from the original. For instance, you would not want to paraphrase Theraflu instructions a lot. We also need the translations to capture nuances of the context because the target audience for the texts ranges from healthcare professionals who would use a lot of medical terms like dentinal tubules, to customers who would not require that kind of terminology and would prefer a more accessible concept like dentin instead.</p><p>This is why we are developing an internal automated language translation tool. We’re basing it on a large language model (LLM) because they satisfy our requirements for accuracy and flexibility better than machine translation (MT) models.</p><p>As for any other machine learning (ML) task, the choice of metrics is crucial. With translation, accuracy metric is needed at multiple stages of project development:</p><ul><li>Model selection;</li><li>Evaluation;</li><li>Model tracking in production.</li></ul><p>We have assessed some of the most popular translation accuracy evaluation metrics and have chosen the one that suits our purposes most. Below we will summarise a “bake-off” we did for this article.</p><h3>Accuracy for translation task</h3><p>The way we measure the accuracy depends on the ML task. For example, in binary classification the proportion of correct predictions (both true positives and true negatives) among the total number of cases examined.</p><figure><img alt="Formula for calculating accuracy for a classification problem." src="https://cdn-images-1.medium.com/max/1024/1*mDhhr5rENrdFHUbe5aPQCw.png" /><figcaption>Accuracy in classification</figcaption></figure><p>To calculate that we must know what is a <em>correct</em> prediction. And here comes the main reason for the impossibility to simply lift and shift accuracy estimation approaches that work well for other tasks: there are typically <strong>multiple ways to communicate the same meaning</strong>. Moreover, there might be no single “right” translation at all, for example for very culturally specific phenomena, when a translator typically has to simply explain the piece of text in source language.</p><p>Let’s examine the following examples that put us in a pickle on how to evaluate the accuracy and penalise excessiveness / insufficiency.</p><figure><img alt="Examples of cases where the difference in one word affects the accuracy in different ways: preserving the meaning and changing it completely." src="https://cdn-images-1.medium.com/max/1024/1*pBkpbdAHEL18HtkUPtDkDQ.png" /><figcaption>Examples of caveats in translation accuracy evaluation</figcaption></figure><p>Typically for automatic translation evaluation we have the input text and human reference text — a human validated translation.</p><p>In both cases above the reference translation (expected) is on the right, and the model (actual) translations are on the left. The difference is in one word, but while <em>“like”</em> and <em>“love”</em> are synonyms, and communicate the same meaning with different intensity, replacing <em>“often”</em> with <em>“not”</em> in the second example changes the meaning of the sentence entirely. So in the second case we’d like to penalise one word inaccuracy more than in the first.</p><h3>Units and metrics</h3><p>For word sequences comparisons the <em>n</em>-grams are used, which is a sequence of <em>n</em> adjacent symbols in particular order. For example, one word is a unigram, two words — a bigram, and so on:</p><figure><img alt="Picture of a sentence with highlighted parts corresponding to unigram (one word), bigram (two words) and n-gram (3 words and more)." src="https://cdn-images-1.medium.com/max/1024/1*bpKvdeTmXZLVI-GTPiup3g.png" /><figcaption>Example of n-grams in a sentence</figcaption></figure><p>We can use them to calculate the overlap of n-grams between the actual and reference translation and get a score, the <a href="https://en.wikipedia.org/wiki/ROUGE_(metric)">ROUGE-1</a>, 1 standing for n-grams we used as a unit for comparison.</p><p>Let’s take the following example:</p><p><em>Reference (human): </em>It is warm outside. <br><em>Output translation: </em>It is <strong>very</strong> warm outside.</p><p>After breaking the sentences down into unigrams<br>4 unigrams in the reference: <em>it, is, warm, outside</em>; <br>5 unigrams in the output: <em>it, is, very, warm, outside.</em></p><p>we can calculate precision, recall and F1-score (the ROUGE-1):</p><figure><img alt="Formulas of Recall, Precision and F1-score and calculations for the particular example." src="https://cdn-images-1.medium.com/max/1024/1*FAnvQCrrUB7rhq6dCBVgng.png" /><figcaption>Recall, Precision and F1-score for example sentences</figcaption></figure><p>As you can already guess, this metric doesn’t consider the word order and doesn’t account for the meaning. For example, we’d get the exact same score, 0.89, for following pair:</p><p><em>Reference (human): </em>It is warm outside. <br><em>Output translation: </em>It is <strong>not</strong> warm outside.</p><p>In order to account for word order we can use larger n-grams, for example, bi-grams, with which we can calculate ROUGE-2 for our second example:</p><p>3 bigrams in the reference: <em>it is, is warm, warm outside</em>; <br>5 bigrams in the output: <em>it is, is not, not warm, warm outside.</em></p><figure><img alt="Formulas of Recall, Precision and F1-score and calculations for the particular example." src="https://cdn-images-1.medium.com/max/1024/1*vQUIegk6YEpE281IO3vwHQ.png" /><figcaption>Recall, Precision and F1-score for example sentences with bigrams</figcaption></figure><p>With this metric we’re still not covering the meaning of the words. To account for that other metrics like <a href="https://en.wikipedia.org/wiki/METEOR">METEOR</a> use stemming and synonymy matching along the standard exact word matching. In metrics like <a href="https://en.wikipedia.org/wiki/BLEU">BLEU</a> a <em>set</em> of good quality reference translations is used, instead of a single reference, to cover the different phrasing and synonyms.</p><h3><strong>Data and approach</strong></h3><p>For our metrics comparison we used a set of internal data, which are texts about Haleon products (e.g., toothpaste, nasal spray) or packaging information. Each sample consists of</p><ul><li>a sentence long source text,</li><li>human reference,</li><li>translation,</li><li>native speaker score (1 to 5).</li></ul><p>Dataset consists of 306 such samples. To avoid bias, we selected the samples for 7 language pairs. The native speaker evaluation is completed by 8 different people.</p><h3>Metrics comparison</h3><p>The metrics we chose for this exercise are</p><ol><li><a href="https://en.wikipedia.org/wiki/BLEU"><strong>BLEU</strong> (BiLingual Evaluation Understudy)</a>,</li><li><a href="https://en.wikipedia.org/wiki/ROUGE_(metric)"><strong>ROUGE-L </strong>(Recall-Oriented Understudy for Gisting Evaluation — Longest Common Subsequence)</a> and</li><li><a href="https://en.wikipedia.org/wiki/METEOR"><strong>METEOR</strong> (Metric for Evaluation of Translation with Explicit ORdering)</a>.</li></ol><p>We are comparing them against a native speaker score. We believe the closer our metric is to a native speaker evaluation, the more accurate it is.</p><p>On a correlation heatmap we can see that the metrics correlate higher between each other than with a native speaker score. And on the heatmap it looks like all of them are quite similar:</p><figure><img alt="Visualisation of correlation between Native score and BLEU (0.38), ROUGEL (0.43) and METEOR (0.43)." src="https://cdn-images-1.medium.com/max/1024/1*FS0-5nvnWT3mrJPR3q_X-w.png" /><figcaption>Correlation heatmap for the three metrics vs native speaker score</figcaption></figure><p>However if we look at error distribution, we can see how native speaker score is shifted towards right and how METEOR score distribution is way closer to the native speaker score distribution.</p><figure><img alt="Visualisation of error distribution for the four scores. METEOR and ROUGE resemble Native score with right shift (more values around 0.8), while BLEU seems to have heavy left shift (more values are around 0.2)." src="https://cdn-images-1.medium.com/max/1024/1*6qgueAHSKiMwJjeJ58_kEA.png" /><figcaption>Violinplot for error distribution for the three metrics the Native speaker score</figcaption></figure><p>Here we can clearly observe that the metrics ranking would look like this:</p><ol><li>METEOR</li><li>ROUGE-L (close second)</li><li>BLEU</li></ol><p>The BLEU metric would perform better if we could provide a set of human reference translations. This is unfeasible in our setup, and in general obtaining just one human reference per source sample is not an easy feat, so we lean towards the metrics that work well with one “correct” translation.</p><p>In the examples below we see that both BLEU and METEOR capture the accuracy of the first output. However due to BLEU focusing on precision, it is scoring significantly higher in the second case than in the third case. In the second translation the model is missing some words from the output and in third BLEU is penalising the word selection of the model translation. However, the words that differ are synonyms (<em>“very”</em> and <em>“quite”</em>, <em>“say”</em> and<em> “tell”</em>) and the meaning is maintained quite close to the reference. In general the two variants are quite close by meaning to the reference, which is better reflected in METEOR score.</p><figure><img alt="Model translated (candidate) sentences and their corresponding scores with highlighted difference between the candidates and the human reference." src="https://cdn-images-1.medium.com/max/1024/1*Rb2A1Wph366yfyEHzApQUQ.png" /><figcaption>Example of candidate sentences and their corresponding METEOR and BLEU scores.</figcaption></figure><h3>Conclusion</h3><p>The significant limitation here is that all the metrics above require the human reference to compare the model output, which is not readily available, especially for model monitoring purposes. One solution is to have a set of samples with human references and with every model update we use them for “sanity checks” to ensure that the quality hasn’t degraded. Another solution is to <a href="https://arxiv.org/pdf/2302.14520.pdf">prompt the LLM to evaluate the translation given the output</a>.</p><p>For our use case, we selected the METEOR score due to its closeness to the native speaker evaluation. We are using it for model selection (out-of-the-box model evaluation) and validation of prompt engineering results. METEOR is also our go-to in automatic quality assurance tests to ensure that changes in the code base don’t have a negative effect on the accuracy of translations.</p><p>Regarding monitoring the model performance live in production, we’ve implemented a rating mechanism to allow users to rate and provide feedback to the generated translations. Although we have found the METEOR score to align most closely with human assessment, the native score remains the most accurate metric to evaluate the translation quality, and that’s what we stick to where possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d0bacd647ca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trusted-data-science-haleon/metrics-for-evaluation-of-translation-accuracy-5d0bacd647ca">Metrics for evaluation of translation accuracy</a> was originally published in <a href="https://medium.com/trusted-data-science-haleon">Trusted Data Science @ Haleon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet Shahan, Data Scientist]]></title>
            <link>https://medium.com/trusted-data-science-haleon/meet-shahan-data-scientist-d43cb811dcaa?source=rss----3e46225d312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/d43cb811dcaa</guid>
            <category><![CDATA[haleon]]></category>
            <category><![CDATA[consumer-health]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[meet-the-team]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[Shahan Silva]]></dc:creator>
            <pubDate>Mon, 15 Apr 2024 08:12:05 GMT</pubDate>
            <atom:updated>2024-04-15T08:12:05.175Z</atom:updated>
            <content:encoded><![CDATA[<h4>by Shahan Silva</h4><p>My name is Shahan Silva, Junior Data Scientist at Haleon, a consumer healthcare company based in London — fuelled by curiosity, innovation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*tqh8Vu3bDENvGjGSK3mRQw.jpeg" /></figure><h3><strong>What were my aspirations growing up?</strong></h3><p>I was an extremely curious child growing up, constantly questioning the “How’s” and the “Why’s” of the world around me. I would often sneak into lectures at universities during my secondary school years and watch countless hours of science videos online. I firmly believe that understanding things at a fundamental level allows you to deeply enjoy the world around you. For example, how the high and low tides are caused by the gravitational pull of the eEarth and the moon and the earth rotating within that bulge, or how the colours of the sunset are caused by the Rayleigh scattering effect, which is when sunlight passes through the earth’s atmosphere at different wavelengths. This insatiable curiosity and thirst for knowledge is what propelled me towards obtaining my degree in science.</p><h3><strong>What is My Background?</strong></h3><p>My academic journey took me into the realm of Biomedical Sciences, where I specialized in Virology and Genetics. During my university years, I dedicated my time in researching viral glycoprotein epitopes for lyssavirus with the goal of developing rabies vaccines. I utilized models such as Chimera and SWISS-MODEL to create and design protein structures. This experience not only honed my research skills but also instilled in me a passion for problem-solving and attention to detail.</p><h3><strong>Why did I choose this career path?</strong></h3><p>After graduating, I found myself at a crossroads, with a need to differentiate myself in a competitive landscape. Data science emerged as the perfect intersection of science and technology, offering limitless opportunities for innovation and creativity. I saw it as a gateway to merge my background in science with the cutting-edge data analytics, allowing me to approach problem-solving from a novel perspective. However, since I was a complete novice in the field of data, I decided to start my career as a Data Analyst apprentice in Haleon’s Data Science team, which at that time was the consumer healthcare unit of GlaxoSmithKline.</p><h3><strong>What do I do day-to-day?</strong></h3><p>Now as a Data Scientist, I wear many hats. From developing methodologies supporting data analysis to integrating agile ways of working and project management practices. I am constantly expanding my skill set to meet the demands of the job. My technical expertise has evolved from supporting builds for inventory management, formulation modelling, and stability analysis to delving into natural language processing for text extraction. Currently, I am immersed in developing AI methodologies and supporting initiatives to raise awareness of AI within our company. My attention to detail, and the ability to take novel approaches to problem solving has not only allowed me to support multiple projects throughout the organization, but also to lead projects onmy own.</p><p>I also host a weekly knowledge-sharing forum for data scientists, featuring sessions led by internal and external experts. As the facilitator, I encourage discussions and sharing of new technologies and their applications within our team. This forum fosters a culture of learning and collaboration and helpus to stay updated and innovate at work.</p><h3><strong>Key Takeaways from my experiences:</strong></h3><ul><li>Your skills and experiences are what makes you unique. Whether it is a talent for drawing, photography or public speaking. Incorporating these skills into your work will set you apart.</li><li>Approach every scenario as a learning opportunity. There is always something to take away from an experience; whether it is a success or a setback.</li><li>The industry is data driven. But data does not make decisions, people do.</li><li>Do not be afraid to ask for help when needed and offer help in return. We can go further by fostering a culture of collaboration and support.</li></ul><h3><strong>How do I keep up with the field?</strong></h3><p>After completing my Level 4 Data Analyst apprenticeship, I decided to further expand my knowledge in Data science techniques, leading me to pursue a Level 7 qualification equivalent to a master’s degree and as a part of this programme. I have allocated 20% of my work hours for learning and research on Data Science and AI, and I then apply those learnings in real life use cases, supporting new and exciting projects.</p><p>Data science is a field where information and learnings are actively shared.There is abundant study material available on the internet for enthusiasts to explore.</p><p>At Haleon, I am fortunate to have access to many learning opportunities and resources and I am able to collaborate with senior staff and knowledgeable team members. Having worked across multiple squads, following agile methodologies has given me the opportunity to further develop my interpersonal and teamwork skills while building a solid foundation in data science.</p><h3><strong>What do you like most about working for Haleon?</strong></h3><p>I love working at Haleon for a multitude of reasons. I am surrounded by bright, passionate, and kind-hearted colleagues since the day one and it is an environment that celebrates diversity and individual strengths. Moreover, the leadership team is deeply committed to foster growth and development of each member of the team and constantly offers learning opportunities tailored to our objectives. Additionally, Haleon is forward-thinking company, always striving to drive innovation and living up to their core values. I feel not only supported and inspired to contribute to our shared mission of making the world a better place with humanity.thus making it an immensely fulfilling workplace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hazjFJCtTwWuXNrQnbc48w.png" /></figure><p>My journey as a Data Scientist till this point has been a testament to the power of curiosity, perseverance, and love for innovation. As I continue on this path of discovery, I am excited to see where it will lead me and the impact I can make along the way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k_-VIaHWDYV9fdEMqHDlMQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d43cb811dcaa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trusted-data-science-haleon/meet-shahan-data-scientist-d43cb811dcaa">Meet Shahan, Data Scientist</a> was originally published in <a href="https://medium.com/trusted-data-science-haleon">Trusted Data Science @ Haleon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Priors to P-Values: Bayesian vs Frequentist Perspectives on Probability]]></title>
            <link>https://medium.com/trusted-data-science-haleon/priors-to-p-values-bayesian-vs-frequentist-perspectives-on-probability-300857a2ea62?source=rss----3e46225d312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/300857a2ea62</guid>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[frequentists]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[bayesian]]></category>
            <category><![CDATA[technical-deep-dive]]></category>
            <dc:creator><![CDATA[Anahita Talwar]]></dc:creator>
            <pubDate>Mon, 08 Apr 2024 10:18:27 GMT</pubDate>
            <atom:updated>2024-04-08T10:18:27.031Z</atom:updated>
            <content:encoded><![CDATA[<h4>by <a href="https://medium.com/@anahitatalwar">Dr. Anahita Talwar</a></h4><p>In the domain of statistical inference, two prominent paradigms have been developed: the frequentist and Bayesian frameworks. Whilst these approaches diverge in their techniques for statistical inference, their key differences stem from fundamentally distinct interpretations of <em>the kind of uncertainty</em> that probability is being used to describe. In this comprehensive exploration, we delve into the foundational principles and philosophical underpinnings of both, shedding light on their respective strengths, weaknesses, and the ongoing debate surrounding their merits.</p><figure><img alt="A coin balancing on its edge. The coin is a British pound coin and the  heads side is facing us. The heads side features Queen Elizabeth II’s profile." src="https://cdn-images-1.medium.com/max/1024/1*XLmx9EPVhXhu0vg2XaMcMg.jpeg" /></figure><h4>The Two World Views</h4><p>At the heart of frequentist and Bayesian perspectives lie fundamental differences in philosophical interpretations of what probability is measuring. Let’s explore this with a classical coin toss example.</p><p>Imagine you’ve got a coin in your hand, and you’re about to flip it.</p><p>Now, a frequentist would say, “Hey, there’s uncertainty here because this is a random event.” From a frequentist perspective, the concept of uncertainty revolves around true or inherent randomness, and crucially, it is only uncertainty due to random events that probability can be used to describe. “The probability of getting a heads on a coin flip is defined as the proportion of heads observed if you were to flip the coin countless times. If you were to flip this coin over and over again, and it fell heads on half of them, the probability of getting a heads is 0.5.” In the case of a coin flip, they would consider probability of the outcome as the proportion of times that outcome appears when flipping the coin many times. More generally, a frequentist therefore views probability as the long-run relative frequency of a random event occurring over many trials. Importantly, regardless of who is flipping the coin or who is asked about the outcome, the experimental results would be expected to converge to a consistent probability value. When probability is used to describe random events, as in the frequentist approach, it is called <strong>objective probability</strong>.</p><p>In stark contrast, referring to the same scenario of a coin flip, a Bayesian might say, “The reason that we are uncertain about the outcome, is not because of inherent randomness — that doesn&#39;t exist — but because of our lack of complete information. If only I could meticulously analyse the coin tosser’s muscle movements in real-time. With that additional information, I might estimate a 70% chance that the coin will land heads. And if I could factor in other forces like air resistance, I might claim a 90% chance of heads.” In the extreme Bayesian view, everything in the universe operates according to deterministic principles — and uncertainty arises because we don’t have enough data, models, and understanding to perfectly predict outcomes. Further, if I then come in and assure the Bayesian that it’s a fair coin, they may plausibly incorporate this information into their probability estimate, taking it as true, or alternatively, they might say given my track record of embellishing the truth, they suspect foul play. Importantly, the confidence in predicting the outcome shifts again. When probability is used as a measure of uncertainty stemming from incomplete information or degrees of belief, as in the Bayesian approach, it is called <strong>subjective probability</strong>.</p><p>At this point, it is worth considering which of these views aligns with various descriptions of uncertainty in the real world, and whether one or the other feels more intuitive or more scientific to you.</p><h4>The Frequentist Approach to Statistical Inference</h4><p><em>Maximum Likelihood of Misinterpretation</em></p><p>As we saw, the frequentist views uncertainty through a lens of objectivity, only using it to describe inherently random events such as the outcome of a coin toss. Under this view, we therefore cannot assign probabilities to things that aren’t random, such as parameters or hypotheses. So, under this framework, and maintaining consistency with this definition of uncertainty, how do we get to an estimated parameter value such as the probability of getting heads on a single coin toss, <em>⍬</em>?</p><p>If we take our coin, toss it ten times, and we get three heads, we can calculate something called the likelihood function, <strong><em>L</em>(</strong><em>⍬</em><strong>).</strong> For each potential value of <em>⍬</em>, the likelihood function computes the probability of obtaining this data <strong>p(D|</strong><em>⍬</em><strong>), </strong>using the binomial probability distribution in the coin toss example<strong>.</strong> In this way, we generate a curve that illustrates how likely the observed data is given a specific set of parameter values in a statistical model. The parameter value that maximises this likelihood curve (the maximum likelihood estimate) corresponds to the parameter values that make the observed data most probable under the assumed statistical model. Crucially, maximum likelihood estimation does not provide us with the probability of a parameter being true given our data, <strong>p(</strong><em>⍬</em><strong>|D)</strong>, but rather offers a point estimate of the parameter value that maximises the likelihood of observing the data.</p><figure><img alt="Diagram illustrating the likelihood function for ten coin tosses with three heads observed. The x-axis represents the probability of heads (p), while the y-axis represents the likelihood of observing the given outcome. The curve peaks at the maximum likelihood estimate of 0.3, indicating the parameter value most consistent with the observed data." src="https://cdn-images-1.medium.com/max/1024/1*l6-CNnxK3OnzYaixuTqKUA.png" /><figcaption>The likelihood function for ten coin tosses, with three heads observed. The x-axis represents the probability of getting heads in a single toss, while the y-axis represents the likelihood of observing the given outcome (3 heads in 10 tosses) for each probability value. The star at the peak shows the maximum likelihood estimate, indicating the parameter value most consistent with the observed data (0.3).</figcaption></figure><p>Although under the frequentist framework, probabilities are not assigned to nonrandom values like parameters, we can still gauge our confidence in the estimated parameters using confidence intervals. These signify the proportion of times, in repeated sampling, that the true parameter value will lie within the constructed interval. For example, a 95% confidence level gives us a way that if we were to construct 100 confidence intervals from 100 different experiments, we would expect about 95 of them to contain the true parameter value.</p><p>In a similar vein, hypotheses aren’t random so we can’t talk about the likelihood of hypotheses being true. Rather, frequentists use Null Hypothesis Significance Testing (NHST) to make binary decisions about the truth of hypotheses based on observed data. Stemming from the same concepts of repeated sampling, the approach defines an optimal test that will control long term error rates, such that in using this procedure, we will not often be wrong. This approach largely depends on calculating p-values, which quantifies the probability of obtaining the observed data or more extreme results under the assumption that the null hypothesis is true. Comparing the p-value to a predetermined threshold (usually 0.05) indicates whether the null hypothesis should be accepted or rejected.</p><p>This NHST framework underlies the basis of statistical inference in scientific research in academia, as well as drug development trials in the pharmaceutical industry, where extensive analysis plans are written in advance of any data collection. Despite it’s widespread use, the frequentist approach is often criticised for being extremely counterintuitive and difficult to teach or use correctly (so don’t worry if you felt a bit lost reading that section). It is particularly common for users to incorrectly talk about the probability of their inferred parameter being the true value, despite it being inconsistent with the frequentist take on what probability can and can’t measure, as previously discussed. This more intuitive conditional probability distribution of parameters given the observed data, that may feel like a more natural conclusion of inference, is not the same. To calculate the latter properly, you have to use Bayes’ theorem.</p><h4>The Bayesian Approach to Statistical Inference</h4><p><em>I’ll believe it before I see it</em></p><p>Named after the Reverend Thomas Bayes, Bayes’ theorem is a fundamental principle in probability theory that describes how to update our beliefs about the probability of an event as new evidence or information becomes available. It’s mathematical expression is given in the image below.</p><figure><img alt="Equation representing Bayes’ theorem, with each component labeled. P(theta|D) represents the posterior probability, P(D|theta) is the likelihood, P(theta) is the prior probability, and P(D) is the marginal likelihood, or constant of integration." src="https://cdn-images-1.medium.com/max/1024/1*U1Q72S8g_Ichzd1dAae7kQ.png" /><figcaption>Bayes’ theorem equation with each component labeled for clarity.</figcaption></figure><p><strong>The Prior</strong> is a probability distribution that represents the initial belief or uncertainty about the parameters of a statistical model before observing any data. It is based on existing knowledge, experience or assumptions. <strong>The Likelihood</strong>, the function described in the frequentist approach, represents the probability of observing the data given a particular parameter value. It represents the consistency between the evidence (data) and parameter values. <strong>The constant of integration</strong> is the marginal probability of observing the data across all possible parameter values. It serves as a normalisation factor to ensure that the conditional probability is properly scaled. <strong>The Posterior</strong> is the updated probability distribution about the parameters of a statistical model after observing the data. This is the key conditional probability that may feel like a more natural conclusion of statistical inference, and one we can only get from using Bayes’ theorem. It is calculated by combining the prior probability with the likelihood of the observed evidence, thus the prior that we use will influence the resulting posterior distribution over our parameters.</p><figure><img alt="Three examples of prior, likelihood, and posterior distributions, demonstrating the effect of different priors on the posterior distribution. Each distribution is labeled, highlighting the relationship between the prior, likelihood, and resulting posterior distribution." src="https://cdn-images-1.medium.com/max/1024/1*9ALOtztk6kSCZnY5K3n-aw.png" /><figcaption>Three plots depicting prior, likelihood, and posterior distributions. Each plot shows the effect of different priors (pink) combined with the same likelihood function (green) on the posterior distribution (blue). The variations in the prior distributions lead to distinct posterior distributions, demonstrating the impact of prior beliefs on the final inference. The distributions have not been normalised for visual clarity.</figcaption></figure><p>Bayes’ theorem provides a systematic framework for updating beliefs or probabilities based on new evidence, making it a powerful tool in various fields, including statistics and machine learning. In the Bayesian framework, probability represents uncertainty due to lack of information or degrees of belief, and so it can be used to describe almost everything, including specifying probability distributions over parameters and hypotheses (in contrast to the frequentist framework). This makes it a more intuitive and flexible approach, which can be useful when you have a strong reason for wanting to incorporate a prior, such as background knowledge or restricting parameter estimates within certain spaces. The prior can also help to regularise extreme parameter values that can result from maximum likelihood estimates when using small samples. Finally, the Bayesian framework allows for the use of more complex hierarchical models with which researchers can explicitly model the variability and uncertainty at different levels of the data hierarchy. For example, in a study involving patients nested within hospitals, a hierarchical model can capture not only the individual variability among patients but also the variability between hospitals. This approach is also applied in marketing strategies at Haleon, where the interplay between various brand and sub-brands or national and regional market dynamics necessitates a nuanced understanding. To delve deeper into how hierarchical models are leveraged in marketing contexts, check out our blog <a href="https://medium.com/trusted-data-science-haleon/optimising-marketing-allocation-with-marketing-mix-models-382c9e471dde">here</a>.</p><p>The Bayesian approach is often considered as relatively new but it actually came about before frequentist methodology. Yet, the frequentist approach became more mainstream for two key reasons:</p><ol><li>As backlash against the prior. It really bothered people that you have to come up with this prior, because it isn’t clear how to accurately write down subjective beliefs as a fully defined probability distribution. They also couldn’t get on board with the idea that you could get different results by choosing different priors — it didn’t feel scientific.</li><li>The constant of integration in Bayes’ theorem is something that you don’t hear about a lot, but it is often very hard to calculate. In these cases, the posterior distribution over your parameters is mathematically intractable, and using the Bayesian approach isn’t an option.</li></ol><p>In 1990, a paper introduced Markov chain Monte Carlo (MCMC) sampling, a method that provided a way to estimate the posterior distribution without having to calculate the constant of integration, making it more accessible for Bayesian inference and alleviating the second problem. However, the first problem of using or coming up with a prior still remains a huge source of debate between statisticians today.</p><figure><img alt="Colorful abstract representation with various squiggly lines, potentially representing different probability distributions." src="https://cdn-images-1.medium.com/max/1024/1*SOxYMzKyRGk6TVpOonc4Cw.jpeg" /></figure><h4>The Debate</h4><p>The ongoing debate between Bayesian and frequentist statisticians encompasses a range of nuanced arguments and perspectives that shape the practice of statistical inference. As previously alluded to, frequentists often raise concerns about the subjective influence of priors in Bayesian analysis, emphasising the importance of objectivity in scientific inquiry. They argue that the arbitrary selection of priors can introduce bias and undermine the credibility of statistical results. In response, Bayesians highlight the inherent subjectivity present in various aspects of experimentation, such as hypothesis selection and data collection methods. They advocate for embracing the inevitable influence of subjectivity and formalising it within the mathematical framework of Bayesian statistics.</p><p>Within the frequentist camp itself, debates also arise regarding the most robust methods for interpreting statistical results. Hardcore frequentists emphasise the necessity of adhering to predetermined significance thresholds to ensure the rigour and reproducibility of analyses. Conversely, other frequentists argue for a broader consideration of factors beyond statistical significance, such as effect sizes, which may offer more meaningful insights into the underlying phenomena of interest. In particular, the latter group often blames some of the perceived flaws of institutional science — high levels of bias in the publication system, and frequent failures to replicate results — on an overreliance on stringent p-values and the NHST framework.</p><p>Similarly, among Bayesians, debates centre on the choice of priors and the objectivity of Bayesian inference. Objective Bayesians advocate for the development of priors that are more objective and less influenced by subjective beliefs, aiming to enhance the reliability of Bayesian analyses. In contrast, subjective Bayesians contend that Bayesian statistics inherently involve the use of probability to represent beliefs or knowledge about the data. They maintain that subjectivity is an integral aspect of Bayesian inference and should be embraced as such.</p><p>These ongoing debates demonstrate the complexity and richness of statistical methodology, as researchers grapple with fundamental questions about the nature of probability, the role of subjectivity, and the interpretation of statistical results. By engaging in constructive dialogue and exploring diverse perspectives, statisticians continue to refine and advance the practice of statistical inference in pursuit of more robust and reliable scientific conclusions.</p><h4>Further Resources</h4><p><strong>Bayesian and Frequentist Approaches</strong></p><p>Book | Understanding Psychology as a Science by Zoltan Dienes</p><p>Talk | <a href="https://www.youtube.com/watch?v=eDMGDhyDxuY">All About that Bayes: Probability, Statistics, and the Quest to Quantify Uncertainty by Kristin Lennox</a></p><p><strong>Frequentist Debates and the Replication Crisis</strong></p><p>Book | Statistical Inference as Severe Testing: How to Get Beyond the Statistics Wars by Deborah Mayo</p><p>Article | <a href="https://amstat.tandfonline.com/doi/full/10.1080/00031305.2016.1154108">The ASA Statement on <em>p</em>-Values: Context, Process, and Purpose</a></p><p><strong>Bayesian Tools</strong></p><p>WebPage | <a href="https://chi-feng.github.io/mcmc-demo/app.html">Interactive Sampling Demonstration</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=300857a2ea62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trusted-data-science-haleon/priors-to-p-values-bayesian-vs-frequentist-perspectives-on-probability-300857a2ea62">Priors to P-Values: Bayesian vs Frequentist Perspectives on Probability</a> was originally published in <a href="https://medium.com/trusted-data-science-haleon">Trusted Data Science @ Haleon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet Galina, Data Scientist]]></title>
            <link>https://medium.com/trusted-data-science-haleon/meet-galina-data-scientist-40196a56addc?source=rss----3e46225d312e---4</link>
            <guid isPermaLink="false">https://medium.com/p/40196a56addc</guid>
            <category><![CDATA[meet-the-team]]></category>
            <category><![CDATA[data-scientist]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Galina Chernikova]]></dc:creator>
            <pubDate>Mon, 25 Mar 2024 11:03:22 GMT</pubDate>
            <atom:updated>2024-03-25T11:03:22.168Z</atom:updated>
            <content:encoded><![CDATA[<h4>By Galina Chernikova</h4><p><strong>A little bit about me</strong></p><p>My name is Galina Chernikova and I am a data scientist with a background in Applied Mathematics and Informational Technologies, with 3+ years of experience in leading consumer health companies. Currently, I work in with Haleon, where I am involved in diverse data science projects. My passion lies in using data to drive innovation and informed decisions in the healthcare industry.</p><figure><img alt="Photo of Galina at Kew Gardens" src="https://cdn-images-1.medium.com/max/819/1*s0J3OK4wpykJku7O9Wuw_w.png" /><figcaption>Photo of Galina at Kew Gardens</figcaption></figure><p><strong>What did you want to be when you grew up?</strong></p><p>Growing up, I found myself being pulled in two different directions. On one hand, I dreamed of becoming a ballet dancer, spending hours practicing. On the other hand, my grandmother, who is a chemist, played a significant role in sparking my interest in science. Eventually, I realized chemistry was not for me and I opted for mathematics leading me to pursue a Computer Science degree. Despite my focus on technology, I’ve always held onto my creative side. During my university years, I immersed myself in the theatre community, spending my free time in drama classes and participating in the university productions. Even now, as I am advancing my career in technology, I continue to engage in with the arts and nurture my creative side.</p><p><strong>Why did you choose to get into this career path?</strong></p><p>I chose this career path because of my passion for mathematics, the subject I thoroughly enjoyed during my school years. Initially, I aspired to become a physicist. However, after observing that many individuals with in pure maths or physics experience ended up delving into programming, I decided to take a more direct route. I wanted to study something that I could immediately apply in the workplace. Thus, I pursued a degree in Applied Mathematics at the Faculty of Computer Science. I can now directly apply the knowledge and skills that I acquired during my university years.in my current work, solidifying my decision, and bringing me fulfilment in my chosen career path.</p><p><strong>What do you do day to day?</strong></p><p>On a typical day, my tasks can vary significantly. Some days are filled with numerous meetings, where I spend majority of my time communicating with colleagues, discussing project plans, and determining the value our work brings to the company. Other days, which I particularly enjoy, are focused on coding and building solutions. During these days, I collaborate with colleagues to brainstorm ideas and implement unique features. There are also days that are filled with administrative work. Overall, my daily activities encompass a blend of communication, problem-solving and coding.</p><p><strong>What is your top tip for anyone who wants to enter the field?</strong></p><p>Starting out in tech can feel overwhelming, but focusing on the fundamentals can set a solid foundation for success. Begin by mastering the basics of linear algebra and calculus, as they form the backbone of many technical concepts in the field. Additionally, pick one coding language and become proficient in it; this will serve as a valuable tool in your arsenal.</p><p>However, don’t stop there. Tech is a vast and diverse field, so once you’ve grasped the essentials, explore different areas and find what truly excites you. Stay curious, keep challenging yourself, and never underestimate the power of continuous learning in this dynamic industry.</p><p><strong>What do you like most about working at Haleon?</strong></p><p>What I appreciate most about working at our company is our exceptional team dynamics. Our team is wonderfully diverse, comprised of individuals with various backgrounds, experiences, and expertise. This diversity fosters an environment of continuous learning and growth.. I find immense value in being able to learn from and collaborate with my colleagues, as each person brings a unique perspective and skill set to the table. This enriches our work environment and enables us to tackle challenges with creativity and innovation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40196a56addc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trusted-data-science-haleon/meet-galina-data-scientist-40196a56addc">Meet Galina, Data Scientist</a> was originally published in <a href="https://medium.com/trusted-data-science-haleon">Trusted Data Science @ Haleon</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>