Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
act65 committed Nov 24, 2024
1 parent 9234adc commit 500bc57
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 58 deletions.
87 changes: 61 additions & 26 deletions _drafts/inbetween-posts/2018-03-25-approximate-reasoning.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---
layout: post
title: Approximate reasoning with incomplete models
title: Approximate reasoning
subtitle: with incomplete models
---

When reasoning, in some cases we might want to trade-off accuracy for other resources; latency, memory, time, ... What does this trade cost in (approximate) reasoning systems?
When we reason, we make mistakes. But maybe these mistakes are not so bad? Maybe they are a necessary part of reasoning with incomplete models and limited resources.

<side>These questions were inspired by how people tend to reason inconsistently, and I wondered what advantages our inconsistency might give</side>
<!-- inconsistency is a necessary result of reasoning with incomplete models -->

> First let's get our heads around what I mean by reasoning.
<!-- When reasoning, in some cases we might want to trade-off accuracy for other resources; latency, memory, time, ... What does this trade cost in (approximate) reasoning systems? -->

# Reasoning

In the most abstract sense, I define reasoning as finding a path through a graph, from priors to posteriors, from ...?
In the most abstract sense, I define reasoning as finding a path through a graph. This can represent;

- _Algebraically manipulating previously acquired knowledge in order to answer a new question_ [Bottou 2011](?)
- _Using a formal system to derive consequents from antecedents (ways of doing this are; deduction, induction, abduction)_
- ?

- Using a relational database to answer a query

##### Knowledge bases

Expand All @@ -36,6 +36,8 @@ Let $M$ be a <u>model of state transitions</u> that takes a state, $s_t$ to the

<!-- For example AlphaGo. -->

Any reasoning system must be consistent, complete, and sound. But what does this mean?

## [Completeness](https://en.wikipedia.org/wiki/Completeness_(logic))

> The most simple example of a proof system that is {consistent} but not complete would be the one that has no inference rules at all! It proves nothing except whichever non-logical axioms your theory has, so in particular it doesn't prove anything that risks being false -- so it is {consistent}. But it is very much not complete. [Makholm on SE](https://math.stackexchange.com/questions/2256054/what-would-be-an-example-of-a-proof-system-being-sound-but-not-complete)
Expand All @@ -52,8 +54,6 @@ Katsumoto = true
# true/false = is_mother(Mary, Katsumoto) # meaning: is Mary Katsumoto's mother?
```



## [Consistency](https://en.wikipedia.org/wiki/Consistency)

<side>When computer scientists say consistent, they really mean coherence, but I will continue ...</side>
Expand Down Expand Up @@ -97,24 +97,45 @@ That example. If two people are rational and agree on the prior assumptions/axoi

What I am curious about is; _can we trade consistency for other measures of efficiency?_

## [Soundness](https://en.wikipedia.org/wiki/Soundness)

> A deductive system is sound if and only if all provable statements are true in the model. [Wikipedia](https://en.wikipedia.org/wiki/Soundness)
This is a property of the model, not the reasoning system. It is a measure of how well the model represents the real world.

For example, if we have a model that says "all swans are white", and we find a black swan, then the model is not sound.

## Approximate reasoning

> __Q:__ What happens when the database is incomplete, our model is approximate, our argument is i natural language, ... We are required to trade-off accuracy for reduced latency, lower computation, ...?
<!-- what do we mean by approximate
what cases would we need to be approximate?
-->

> __Q:__ What happens when the database is incomplete, our model is approximate, our argument is in natural language, ... We are required to trade-off accuracy for reduced latency, lower computation, ...?
<!-- what do we mean by accuracy here? -->

<side>TODO Are these really the same? Need to show more rigorously.</side>
Incomplete database aka approximate reasoning aka reasoning with an imperfect model.

Consider some strategies for reducing the complexity (memory, latency, time, ...) of a reasoning system.
Some examples of instances where we might encounter/want incomplete models.

##### Online learning
##### Bounded resources: memory

The graph is too large to fit in memory. We need to find a way to reason about the database without storing all of it.

Not all the nodes can be stored.
Not all the edges can be stored.

Solutions?

- Online learning: Need to make predictions before a model has been learned. Maybe the model is too large to every be learned, ...
- Streaming data: The data is too large to store, so we need to make predictions on the fly.

Need to make predictions before a model has been learned. Maybe the model is too large to every be learned, ...

##### Factoring links into a model

Instead of storing all the links, we could generate them as required. This could cut down the memory requirements of large databases. The problem being that the number of possible links/edges scales with $\mathcal O (\mid V \mid^2)$. So if we have a thousand nodes, the maximum number of edges is a million (if we are talking about an undirected graph with a single edge type).
Instead of storing all the links, we could generate them as required.
<!-- This could cut down the memory requirements of large databases. The problem being that the number of possible links/edges scales with $\mathcal O (\mid V \mid^2)$. So if we have a thousand nodes, the maximum number of edges is a million (if we are talking about an undirected graph with a single edge type). -->

So instead of representing links as an array that we index $L[i, j]$, we could represent the links as a function $f(i, j)$ that generalises any patterns found in the links.

Expand Down Expand Up @@ -157,11 +178,33 @@ Now, the real question; (How) did each of these strategies sacrifice consistency

__Conjecture__: Inconsistency is a necessary result of attempting to reason with incomplete models.

Define incomplete models.
## Setting

We start with a ground truth model (an adjacency matrix), $A \in [-1, 0, 1]^{N \times N}$, with node and edge features, $X \in \mathbb R^{N \times D}$ and $E \in \mathbb R^{N \times N \times D}$.

An incomplete model is a model, plus uncertainty.
We have a distribution over possible adjacency matrices, node and edge features, $P(A, X, E)$.

### A measure of consistency
From some fixed number of observations, K, we can build a posterior distribution, $P(A, X, E | O_k)$, where $O_k$ is the set of observed nodes and edges.

## Problem

<!-- of all the decuctions its possible to make with the model
how many are correct? -->

<!-- for now ignore the possiblity that we can we wrong about a nodes 'meaning'. that a word can mean different things to different people. -->

To reason about the

Given an incomplete model and bounded resources, we want to maximise the accuracy of our reasoning system.

Definitions;

- an incomplete model is a
- bounded resources could be; number of nodes searched,
- accuracy is measured by taking the

### A measure of (in)consistency

<side>Ok, there must be some existing work on this? Non trivial in the cts domain...</side>
__Definition__: The coherence of a database is defined as the total number of contradictions it makes.
Expand All @@ -182,18 +225,10 @@ c_i = \mathbb E_{z \sim \mathcal N} \parallel D(h_{i=1}+z)- D(h_{i=-1}+z) \paral
C = ... \\
$$

Aka, $h_i$'s effect on doesnt


So, we would want to maximise this?

$$
\mathop{argmax}_{\theta} \mathcal C(D_{\theta})
$$



***

When working with approximates.
Multiple reasons leading to the same conclusion should increase the plasubility?
Multiple reasons leading to the same conclusion should increase the plasubility? Yeah, this works with uncertainty. Multiple paths, each with some uncertainty, should increase the certainty of the conclusion.
81 changes: 81 additions & 0 deletions _drafts/inbetween-posts/2024-10-10-math-origins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
title: Ikram and his tricks
subtitle: A story about the origins of math
permalink: math-origins
---

<!-- A short story that follows a trader. The story starts before the development of any math / arithmetic and we would get to see the issues that come with no math (spending lots of time counting, getting counts wrong, ...?). The accountant would invent some of their own tricks, and learn some from other accountants (in different cities). -->

about ikram's character (possibilities):

He's a rather sly businessman. He understand that his image is important for trading. He needs people to trust him (learned through experience).
In the end he uses these mathematical tricks to help make himself seem more intelligent (and to make him money).

Simplicity and order. How can I show these are things that Ikram values?
(and how can I show that these are things that are important for math?)

potential scenes:

1. Ikran has a child assistant, who's job is mostly 'counting'. Where counting means drawing the icon for wheat on a tablet for each wheat bale in storage. He also has another child assistant for 'counting' the number of sheep in the pen, and another for counting the number of coins in the chest, and another for counting the number of jars of oil in the storage room, and another for counting the sacks of barley in storage, and another ...
Ikran trades in large volumes, e.g. 100s of hay bales. So he often he has to wait for things to be counted.
One day he's sitting at his desk, with 3 different count tablets. And he has the insight, that he could simplify this system. Instead of writing the icon for wheat, or sheep, or ..., he could just draw a single icon at the top of the tablet, and then draw a line for each item counted. He teaches his assistants how to use it and it saves time.

2. Ikram needs to purchase a field for grain storage. The seller describes it as "8 lengths by 15 lengths." (but how much wheat can it hold?)
Rather than the usual approach to determine the area (using small clay tokens to lay out a rectangle representing the field, and counting them one by one to determine the area) Ikram has an insight. He realizes he has seen these numbers before and he knows the answer. Last week he had 8 seperate orders of 15 bottles of wine, this totalled 120 bottles.
Later that week, while travelling (with idle time to think) he realisees he could list all the possible areas of a field with a length of 1 to 10, and a width of 1 to 10. This would give him a table of 100 areas. He could then use this table to quickly determine the area of any field by looking up the length and width in the table.




***


A few of the discoveries I'd like to include;

- when traders develop a short-hand / symbols to represent their wheat bales (instead of writing ticks). And then realise they can use these same symbols to count beers, or other goods.
- The realisation that the units of area can be written in terms of units of length.
- The standardisation of the sexagesimal system.
- the discovery of multiplication, and its uses (If I know I need -say- 3 bags of barley to make 10L of beer. Then how many bags to I need to make 85 L of beer? AND. Instead of counting all the ceramic vases stacked in this room, I can simply count the number of vases in the horizontal, depth and height directions and multiply - since the vases are stacked regularly).
- the cut-and-paste method for finding the reciprocal of a sexagesimal number. (pg 109)
- The discovery of place value notation
- The realization that debts can be recorded as negative quantities
- The invention of fractions for trading partial quantities
- Early banking concepts - lending with interest


***

Over arching is Ikram starts in a small town doing trade with neighboring towns. Moves to bigger city and discovers more cools tricks.
The bigger city is chaotic and ???. But math helps organise his life.

Possibilities.

- meets a friend and starts doing recreational math.
- discovers

***


The Partial Payment

Ikran faces a dilemma when a merchant wants to buy 7 bales of wheat but can only pay for 5 and a half bales worth. Initially stumped by how to record this "half" quantity, he experiments with marking a line halfway through his counting symbol, essentially inventing a fraction notation. This leads to him developing a whole system for handling partial quantities.
The Debt Record

> After being burned by a few bad deals, Ikran develops a system of recording who owes him what. He creates a special mark to indicate "owed goods" versus "goods in hand," essentially creating negative numbers. This evolves into a rudimentary lending system, where he begins charging extra (interest) for the convenience of paying later.

> (from LLM) Ikram attends a gathering of merchants from different cities, where they're all frustrated by their different counting systems. Through discussion and negotiation, they begin to see the benefits of adopting a common system - the sexagesimal system. This could be shown through a series of meetings and the gradual adoption of the new standard.
This could happen in the background of Ikram's life. He doesn't directly attend, but he hears about it from other traders and sees the impact it has on trade. It could be a way to show the interconnectedness of different cities and the importance of shared systems for trade.


***

Ikram is frustrated because his large trading operation requires keeping track of many different sized quantities. He uses different symbols for 1s, 10s, 60s, and 600s, but it's becoming unwieldy. One day, while watching his assistants arrange storage jars (which are stacked in neat rows and columns), he notices how the position of each jar tells him something about its contents. This gives him an idea: what if the position of a number symbol could tell you its value? He experiments with a system where a symbol's position indicates whether it represents ones, sixties, or three-thousand-six-hundreds.

Ikram is negotiating with another merchant who owes him grain but wants to continue trading. Currently, they use separate tablets for "owes me" and "I owe them" records, which is confusing when dealing with multiple traders. After a particularly complex trading session involving multiple debts in both directions, Ikram develops a new notation: marking debt quantities with a special symbol to distinguish them from positive quantities. This allows him to combine all transactions with a single trader onto one tablet.

Ikram needs to build new storage rooms along the city wall. The wall runs at an angle to his existing storehouse. He needs to know how much roofing material to purchase to span between the two structures. A young architect shows him how to measure the shortest distance between the buildings using a rope and the "3-4-5" rule, explaining that this always works for right angles. Ikram is fascinated and begins collecting other number combinations that work this way.

Ikram is teaching his daughter to use the balance scales. She's frustrated that adding small weights one by one takes so long. Together, they discover that if they know a large weight equals twenty small weights, they can use the large weight to speed up their measuring.
This leads to the development of a short-hand system for recording weights, where a single symbol represents twenty of the smaller weight.
32 changes: 0 additions & 32 deletions on_hold/2021-08-04-stupid-learning.md

This file was deleted.

0 comments on commit 500bc57

Please sign in to comment.