How to build an effective drug recommendation system?

Tags
11 December 2020
Complete Guide for CTO & IT Directors
Microservices under X-Ray Three books image Download free ebook

If we want to create a recommendation system for a service or platform we can approach the goal in many ways. Looking at the current trends, in particular the fashion for deep learning, we may be impressed that the use of only very complex algorithms will result in success. However, it is not so. We can apply recommender systems in scenarios where many users interact with many items and the system will help to suggest items that have been hosted by users that are similar.

The challenge with more complex approaches is that they can be sometimes difficult to tune and interpret. In other words, they can be very powerful but require a lot of knowledge to implement properly. Associations analysis from another side is relatively light on the math concepts and easy to explain to laypeople. In addition, it is an unsupervised learning tool that looks for hidden patterns so there is a limited need for data prep and feature engineering. It is a good start for certain cases of data exploration and can facilitate more insightful approaches to data.

A useful technique that we will show here as the first one is called association analysis, which attempts to find common patterns of items in large data sets. The important assumption is that we built an unsupervised rule based on GPI with 10 dig level and Drug Name level. We didn’t want to separate recommendations based on dose; for example, GPI for Lipitor Oral Tablet 10 MG.

The main idea in apriori rules is that we are looking for association rules between drugs, based on the basket (set of products that people buy). It is necessary to remember we are looking for users that buy more than one item. In the case of prescription users (SingleCare clients in this case), the number of drugs that they bought is not so big as in everyday situations in the supermarket. Therefore, we first chose only the customers that bought more than one drug. For simplicity, we created an artificial basket based on one year of user history. Based on the experiment and the results, we are choosing the customers who buy more than 4 drugs per year. Keep in mind that after preprocessing, we are creating rules from 3 important components: member_id, drug_name, count_of_drug (for each drug & client separately).

Important terminology:

Support is the relative frequency that the rules show up. In many instances, you may want to look for high support in order to make sure it is a useful relationship. However, there may be instances where low support is useful if you are trying to find “hidden” relationships, one of the measures of interest. These relationships describe the usefulness and certainty of the rules. 5% Support means 5% of transactions in the database follow the rule.

Confidence is a measure of the reliability of the rule. Confidence of 0.5 in the above example would mean that in 50% of the cases where amoxicillin and vitamin C were purchased, the purchase also included ibuprofen. For product recommendation, a 50% confidence may be perfectly acceptable but in a medical situation, this level may not be high enough. Confidence: A confidence of 60% means that 60% of the customers who purchased amoxicillin and vitamin C also bought ibuprofen.

Lift is the ratio of the observed support to that expected if the two rules were independent. The basic rule of thumb is that a lift value close to 1 means the rules were completely independent. Lift values > 1 are generally more “interesting” and could be indicative of a useful rule pattern.

The most interesting part of the algorithm is that rules have the direction where one drug is antecedents and the other is consequents. A patient who buys a cancer drug (antecedents) also buys a painkiller (consequents) indicates a strong rule. Inversely, it doesn’t work: not everyone suffering from pain has cancer. We are able to filter this kind of recommendation automatically by apriori algorithm parameters. Now based on the strongest rules (filtered by lift metrics), we are able to achieve some interesting results:

  1. more than 60% of the rules are related to popular drugs (first 50 drugs for all drugs available).
  2. more than 50% of the drugs that are recommended are cheaper for clients.  
  3. over 40% of strong apriori rules recommended by apriori increase profitability for a company.

Michał Olędzki

Latest Posts
angular apps

Angular Apps: Top 7 Web Application Examples, Advantages, and Considerations

Angular is a leading development tool for building sophisticated web apps. Check out the top applications fueled by this Google-backed platform and learn about its strengths and weaknesses. Angular is a household name in the front-end development industry and the key competitor of React (aka ReactJS). As one of the leading web development frameworks, it […]

/
ux writing samples

UX Writing Samples. How to Enhance Usability With Effective Microcopy?

Text is an integral part of UI design and user experience. High-quality, usability-focused copy helps engage users and turn them into customers. User experience (UX) writing is much more than a buzzword. It combines writing proficiency and inventiveness with a strong focus on user actions. The goal is to make things smooth, easy, and informative […]

/
gregg castano news direct

How to Pick a Good Software Partner? Q&A with Gregg Castano of News Direct  

A few years ago, we had the opportunity to work with News Direct on developing their platform. After carefully analyzing their needs, we’ve helped them design the system and developed a microservices-based architecture incorporating state-of-the-art modern technology allowing for communication using both synchronous and asynchronous calls to ensure high system flexibility and scalability. The main […]

/
cert pinning android

Mobile Development and Security: Certificate Pinning on Android

In today’s increasingly interconnected digital world, the importance of security for mobile apps and web services cannot be overstated. As cyber threats evolve, so must the defenses and measures we deploy to safeguard sensitive data and maintain trust. One of the pivotal practices in enhancing network security is certificate pinning, a technique that ensures a […]

/
django apps

Django Apps, Projects, and Other Caveats

Django, emerging as a significant player in the realm of web frameworks, stands out as a Python-based toolset that revolutionizes the way developers approach web application development. It is not merely a framework but a holistic environment that encapsulates a developer’s needs for building robust, efficient, and scalable web applications. Born out of a practical […]

/
rxjs react

RxJs & React: Reactive State Management

In the ever-evolving realm of web development, the quest for efficient, scalable, and maintainable tools never ends. Two such tools, React and RxJS, have garnered significant attention in the recent past. React, the brainchild of Facebook focuses on crafting intuitive user interfaces by leveraging a component-based architecture. On the other hand, RxJS offers a fresh […]

/
Related posts
python vs scala

Scala vs Python: What’s Better for Big Data?

In the world of big data processing and analytics, choosing the right programming language is crucial for efficient data management and effective decision-making. Python and Scala are two popular programming languages used in data science projects and processing, each with its unique strengths and features. This article will explore the key differences between Python and […]

/
predictive analytics retail

Predictive Analytics: Retail Industry Use Cases

Retail businesses have always been driven by data, whether it’s sales figures, inventory levels, or customer behavior. With the rise of predictive analytics, retailers have the ability to analyze large volumes of data to uncover data-driven insights and patterns that can help them make more informed decisions. Predictive analytics is a branch of advanced analytics […]

/

Python Web Application Examples. Top 7 Cases

Python lies at the heart of many leading web applications. Businesses and programmers love this language for its simplicity which, paradoxically, facilitates the development of very complex systems. Find out how top big tech companies use Python in their platforms. Python is the language of choice for data scientists, machine learning experts, and backend developers. […]

/

Economy business cycle prediction using LSTM neural networks

Economy as a whole goes through business cycles that consist of alternating expansions and contractions. It is not immediately obvious  what cycle the economy is currently in; it is difficult to tell if it is at the peak of an expansion or the trough of a contraction. The ability to predict economy cycles would be […]

/

How to build an effective drug recommendation system?

If we want to create a recommendation system for a service or platform we can approach the goal in many ways. Looking at the current trends, in particular the fashion for deep learning, we may be impressed that the use of only very complex algorithms will result in success. However, it is not so. We can apply […]

/
Talk with experts

We look forward to hearing from you to start expanding your business together.

Email icon [email protected] Phone icon +1 (888) 413 3806