AI Glossary / Graphs and symbolic AI / Advanced
Pointwise product
Definition
A pointwise product multiplies corresponding values of functions or arrays. For functions f and g on the same domain, the result h satisfies h(x) = f(x) × g(x) for each input x. In probabilistic inference, the corresponding operation combines factors by matching assignments to their shared variables. It is distinct from ordinary matrix multiplication, which generally multiplies and sums across an index.
What it means
The important question is what counts as corresponding. For equally shaped arrays, it can mean the same position. For factors, it means the same values of the same variables, even when the factors involve different sets of variables.
Suppose one factor depends on A and another on A and B. Their product depends on A and B. For each assignment to those variables, use the first factor's value for that A and the second factor's value for that A and B. Matching row numbers without checking variable meanings can produce the wrong result.
How it works
To multiply factors, identify their combined variable scope, enumerate assignments over that scope, and multiply the relevant input values for each assignment. Shared variables must agree. Variables appearing in only one factor remain in the output.
This multiplication does not itself sum out a variable or normalize the result. Those are separate operations used when the inference task requires them. A factor can contain nonnegative weights without being a probability distribution whose entries sum to one.
For numerical arrays, NumPy's multiply performs element-wise multiplication and permits compatible broadcasting. Broadcasting expands the effective shapes according to array rules; it does not understand variable labels. Aligning dimensions correctly remains the user's responsibility.
Three practical examples
- A probabilistic inference routine combines a prior factor with an evidence likelihood factor. The product gives unnormalized weights for the candidate states. Normalization can turn these into posterior probabilities when the total weight is positive and the model justifies the factorization.
- A neural-network computation applies a gate to corresponding activations. Activations [2, -1, 4] multiplied by gate values [0, 1, 0.5] become [0, -1, 2]. No cross-coordinate sums occur in this operation.
- An image-processing step multiplies each pixel by a matching mask value. A zero mask suppresses the corresponding value. A shifted mask can produce an arithmetically valid result that affects the wrong locations.
Think of it this way
Think of matching labeled cards before multiplying their numbers. Cards about the same assignment belong together. If one card specifies only A, its number can be reused for every relevant B value associated with that A. The labels determine the match; the order in which someone placed the cards on a desk does not.
Worked example
Let A and B each take values 0 or 1. Define a weight factor f(A) with f(0) = 2 and f(1) = 3. Define g(A,B) by four entries: g(0,0) = 0.25, g(0,1) = 0.75, g(1,0) = 0.60, and g(1,1) = 0.40.
The product h(A,B) = f(A) × g(A,B) has these entries:
h(0,0) = 2 × 0.25 = 0.50; h(0,1) = 2 × 0.75 = 1.50; h(1,0) = 3 × 0.60 = 1.80; h(1,1) = 3 × 0.40 = 1.20.
The entries total 5, so h is not normalized. Dividing every entry by 5 gives [0.10, 0.30, 0.36, 0.24] in the stated order. Under this explicitly defined normalized model, B = 1 has probability 0.30 + 0.24 = 0.54. Multiplication, normalization, and summation are three distinct steps.
If the rows of g represent A, the weights 2 and 3 must scale those rows. Incorrectly scaling the columns instead yields [0.50, 2.25, 1.20, 1.20], a different result. Compatible array dimensions do not detect this semantic mistake.
For a separate matrix comparison, let U have rows [1,2] and [3,4], and V have rows [5,6] and [7,8]. Their pointwise product has rows [5,12] and [21,32]. Ordinary matrix multiplication instead gives rows [19,22] and [43,50], because it sums products across the shared inner dimension.
Illustrative case study
Fictional team Alder Analytics combines likelihood tables for an equipment-monitoring prototype. Two data sources both supply a two-entry vector, but one orders its labels as normal, alert while the other uses alert, normal. A direct positional product silently pairs incompatible states.
The team adds explicit label alignment and checks the result against a small hand-calculated example. It also reviews whether the two observations can be treated as conditionally independent before multiplying their likelihoods. Correct arithmetic would not justify counting the same underlying observation twice. This fictional case illustrates two separate checks: matching assignments and validating the model that makes their product meaningful.
Common misconceptions and mistakes
Pointwise multiplication is not a dot product. A dot product includes summation after multiplying paired vector entries.
Factor multiplication need not preserve the input table's size. Combining different scopes can require a larger table over their union.
Multiplying probability-looking numbers does not automatically produce a normalized distribution or a justified inference.
A zero product may express impossible support under a model; an all-zero result cannot be normalized by dividing by its total.
Broadcasting success establishes shape compatibility, not correct variable alignment.
Business use
This operation often sits inside scoring, masking, and probabilistic systems. Teams should document what each dimension or key means before combining values. Use small examples with deliberately reordered labels to check alignment, and test missing, zero, and very small weights. When products are interpreted as evidence, review dependencies and duplicate inputs as carefully as the arithmetic. Numerical correctness and sound modeling are different requirements.
People also ask
Is a Hadamard product the same thing?
For equally shaped matrices, it names their element-wise product.
Does multiplying factors remove shared variables?
No. Shared variables remain unless a separate operation, such as summation, eliminates them.
Can a factor product be computed without storing the whole output table?
Sometimes. An implementation can exploit structure or compute entries as needed, while preserving the same mathematical operation.
Check your understanding
What is h(1,0) in the example?
Answer: 1.80.
What is the normalized probability of B = 1?
Answer: 0.54 under the defined model.
Why is column scaling wrong in the example?
Answer: The weights are indexed by A, which labels the rows, not by B, which labels the columns.
Related terms
- Factor
- Dot product
- Broadcasting
- Variable elimination
- Marginalization
- Normalization
- Likelihood
- Hadamard product
- matrix multiplication
Learn next
Sum h over B before normalizing and verify that the resulting A weights are 2 and 3. Then reorder the A labels in one input and explain how a correct implementation restores alignment before multiplication.
More in Graphs and symbolic AI
- Planning graph - A planning graph is a layered data structure that summarizes which facts and actions may become available as a planning problem progresses.
- Playout - A playout is a simulated continuation from a game state to an outcome, with moves selected according to a specified policy.
- Ply - A ply is one move by a single player in a game, corresponding to one action step down a game tree under the usual convention.
- Policy search - Policy search is a reinforcement-learning approach that improves a decision rule by searching over candidate policies or their parameters.
- Polynomial kernel - A polynomial kernel compares two feature vectors by raising a scaled, shifted dot product to an integer power. A common form is K(x, z) = (1 + x dot z)^d.
- POMCP - POMCP stands for Partially Observable Monte Carlo Planning.
Sources
MIT, Bayesian-network lecture notes, pointwise products and variable elimination: https://courses.csail.mit.edu/6.034s/handouts/spring12/chapter14_mod_a.pdf NumPy, multiply: https://numpy.org/doc/stable/reference/generated/numpy.multiply.html AIMA glossary, pointwise product: https://github.com/aimacode/aima-glossary/blob/master/glossary.md
Previous: Pointer jumping Next: Poisson-Dirichlet distribution