AI Glossary / Graphs and symbolic AI / Advanced
Units function
Definition
A units function is a function used in a knowledge representation to connect a numerical value with a measurement unit and the quantity it denotes. For example, Meters(1.2) can denote a length rather than the bare number 1.2. The surrounding ontology defines its meaning, conversion rules, and permitted operations.
What it means
A number alone often cannot answer a practical question. A panel described as “1.2” might be measured in meters, centimeters, or another unit. A symbolic units function makes that information part of the represented quantity so a reasoning system can compare measurements consistently.
The function notation is a modeling convention, not a universally standardized programming interface. This entry uses the supplied glossary's ontology sense. It is unrelated to a neural-network unit, a unit clause, or a software unit test.
How it works
One representation maps numbers to abstract quantities: Length(panel)=Meters(1.2). A conversion axiom can then express Meters(x)=Centimeters(100×x). Under that interpretation, Meters(1.2) and Centimeters(120) denote the same length value even though the expressions differ.
An alternative representation maps a quantity to its numerical value in a chosen unit. A function such as ValueInMeters(Length(panel)) would return 1.2. These directions should not be mixed accidentally: one produces a quantity, while the other produces a number describing it in a specified unit.
Useful reasoning also requires types and arithmetic rules. Lengths can be compared after compatible conversion; a length and a mass cannot simply be added. Multiplying two lengths produces an area, with a squared conversion factor. The ontology must establish these relationships rather than expecting the spelling of a function name to supply them automatically.
Three practical examples
- A packaging planner compares a product length recorded in millimeters with a compartment length recorded in centimeters. Conversion rules allow comparison of their physical lengths rather than their unadjusted numbers.
- An inventory knowledge base stores material mass using quantity expressions. Combining measurements from suppliers requires compatible mass units and an explicit interpretation of each field.
- A maintenance system receives durations in seconds and minutes. A units-aware representation lets it compare a recorded delay with a service interval without confusing numerical size with elapsed time.
Think of it this way
A units function is like putting a number inside a clearly labeled measurement container. The label says what the number measures and how to compare it with another container. Changing the label correctly may change the number, but it should preserve the represented magnitude.
Worked example
A fictional workshop represents a panel's length as Meters(1.2) and a shelf opening as Centimeters(118). Assume these values are exact for the first calculation and that only length determines fit.
Using Meters(x)=Centimeters(100×x), the panel length is Centimeters(120). It exceeds the opening by 120−118=2 cm. Comparing the bare numbers 1.2 and 118 would incorrectly suggest that the panel is much shorter.
The workshop removes exactly 8 cm from the panel. Its new length is 120−8=112 cm, equivalent to Meters(1.12). The remaining length clearance is 118−112=6 cm.
For a separate area calculation, suppose the original rectangular panel is 0.4 m wide. Its original area is 1.2×0.4=0.48 m². Since 1 m²=10,000 cm², that is 4,800 cm². Using the length conversion factor of 100 for area would be wrong.
Now replace exact dimensions with stated bounds: the cut panel is 1.12±0.015 m and the opening is 1.18±0.005 m. Treat these as hard bounds for this illustration. The smallest clearance is 1.175−1.135=0.040 m, or 4 cm. This calculation still ignores width, alignment, and other fit requirements. Correct units make the arithmetic meaningful; they do not make an incomplete physical model complete.
Illustrative case study
A fictional furniture company combines supplier catalogs. One supplier sends dimensions in centimeters, while another sends them in millimeters. The integration system initially stores both as plain numbers under a field called length.
The team revises the model to preserve the original number, unit, item, and measurement context. It defines conversions to a common length representation and tests pairs of equivalent quantities. It also checks that area fields use squared conversions and that missing units cause a review request rather than an invented default.
A remaining discrepancy turns out to concern internal versus external dimensions, not conversion. The team adds that distinction to the quantity description. This fictional case shows why unit-aware functions help but cannot replace clear definitions of what was measured. No financial saving or deployment result is asserted.
Common misconceptions and mistakes
A unit label is not enough if the system has no semantics connecting it to conversion and arithmetic. A text string may be readable to a person while remaining unusable for reliable automated reasoning.
Different function expressions need not denote different quantities. The conversion equality between Meters(1) and Centimeters(100) is intentional, so indiscriminate unique-name assumptions for all compound terms would be inappropriate here.
Conversion does not increase measurement accuracy. Expressing a value with more decimal places does not create new information about the object.
Unit compatibility is necessary but insufficient for combining data. Two lengths can refer to different parts, times, or measurement conventions.
Business use
Units functions and equivalent typed-quantity representations help connect planning, catalogs, sensors, and analytical systems. Define the input and output types, supported conversions, quantity meanings, and behavior for missing units. Preserve original measurements for audit and handle uncertainty separately. Test representative comparisons and calculations, especially where squared or cubed units can magnify a conversion mistake.
People also ask
Must the function take a number as input?
No. The ontology can instead define functions returning numerical values from quantities, but the chosen direction must be clear.
Does every unit conversion use a scale factor only?
No. Some conversions, such as temperature scales, also involve an offset; the correct rule must be specified.
Does using SI units remove all ambiguity?
No. The quantity's meaning and measurement context still matter.
Check your understanding
Why does the original panel not fit the opening?
Answer: Its converted length is 120 cm, exceeding 118 cm.
Why is 0.48 m² equal to 4,800 cm²?
Answer: Both length dimensions contribute a factor of 100.
Why can two differently written quantity terms be equal?
Answer: Conversion axioms can make them denote the same magnitude.
Related terms
- Ontology
- Knowledge representation
- quantity value
- measurement unit
- dimensional analysis
- typed data
- conversion axiom
- numerical value
Learn next
Compare number-to-quantity and quantity-to-number representations. Then model one measurement with its unit, quantity kind, object, time, and uncertainty, and test conversions in both directions.
More in Graphs and symbolic AI
- Type signature - A type signature specifies the types of inputs and outputs associated with a function or operation.
- UCB1 - UCB1 is a multi-armed bandit algorithm that selects an action using its average observed reward plus an exploration bonus.
- UCT - UCT is a method for guiding Monte Carlo tree search by applying upper-confidence-bound ideas at decision nodes.
- Łukasiewicz logic - Łukasiewicz logic is a family of many-valued logics associated with Jan Łukasiewicz.
- Unary constraint - A unary constraint is a rule that restricts the allowed values of one variable in a constraint satisfaction problem.
- Unbounded cost search - Unbounded-cost search seeks a valid solution without requiring its cost to fall below a specified threshold or within a specified factor of the best...
Sources
AIMA Exercises, alternative representation of measures: https://aimacode.github.io/aima-exercises/question_bank/ NIST Guide to the SI, quantity values and quantity equations: https://www.nist.gov/pml/special-publication-811/nist-guide-si-chapter-7-rules-and-style-conventions-expressing-values JCGM International Vocabulary of Metrology, quantity value: https://jcgm.bipm.org/vim/en/1.19.html AIMA glossary, units function: https://github.com/aimacode/aima-glossary
Previous: Unitary matrix Next: Univariate analysis