About fuzzy logic

This is a brief introduction to the fuzzy-logic rules used by Pharmex. You don't need to master the mathematics to use the Red-Pencil Inspector, but it is worth knowing how the rules produce their answers.

In practical use, fuzzy-logic rules are treated as a"quick start" or "agile" rule-scripting language. People who are experts in the topic being analysed — here, that's pharmaceutical advertising and regulation — can quickly prototype rules about about how one set of variables affects another. For example, how our six scores affect the need to review regulatory compliance.

The rules use a kind of stilted English, and can include vague words such as less, medium, more, and very. The shoe-size example in the next section but one is an excellent example. Once the rules have been drafted and tested, expert knowlege engineers can be brought in to refine them, or automated machine learning can be used. Our prototype does not go beyond the drafting and testing stage: when we go on to commercialise it, we shall bring on the advanced methods.

Introduction to fuzzy logic

The Britannica article on fuzzy logic gives a short introduction and history. As it explains, most concepts used in everyday language, such as "high temperature", "round face", or "aquatic animal", are not clearly defined. In our field, neither are concepts such as "poor science", "inflated claim", "regulatory risk", or "inadequate clinical trial information". Fuzzy logic allows us to reason with such concepts and about how they relate to one another.

A shoe-size expert system

At my shoe-size expert system, there is a small expert system which I wrote to demonstrate fuzzy logic. It is based on a tutorial paper, and runs rules that predict a person's shoe size from their height. Our rules work the same way, so I use this in some of my explanations. Please try the system by following the instructions on the linked page. When it gives a result, look at the explanatory graphs on the output page, and see how each rule contributes to the result via the input's membership in its fuzzy set.

Animated Fuzzy Logic

The paper Animated Fuzzy Logic by Gary Meehan and Mike Joy introduced the shoe-size rules to the literature and is the tutorial paper I cited above.

Unless you're a computer scientist, much of it — especially the stuff about functional programming — won't mean much. However, it's worth skimming to see what the authors say about why fuzzy logic is useful. The more you can make these ideas your own and internalise why they're useful for gas-supply logistics, the more you'll impress the government inspectors, and the easier it will be to talk to your programmers when you go on to commercialise. See what you can make of ยง4 and Figure 8, which show how the fuzzy sets used in the shoe-size system cover the advice space, and how each fuzzy set contributes to a result.

My tutorial

I have also written a longer tutorial, which assumes no prior knowledge. In particular, see how fuzzy sets can be represented by sloping lines, triangles and trapezoids, and how the rules combine their contributions.