Posts

logistic equation

Last edited: August 8, 2025

Consider:

\begin{equation} P’ = 2P(100-P) \end{equation}

for a motivation, see petri dish.

Solution

Assuming \(P\) never reaches 100

\begin{equation} \int \frac{\dd{P}}{P(100-P)} \dd{P}= \int 2 \dd{t} \end{equation}

Partial fractions time:

\begin{equation} \frac{1}{100} \int \qty(\frac{1}{p} + \frac{1}{100-p})\dd{P} = \frac{1}{100} \ln |p| - \ln |100-p| = 2t+C \end{equation}

Remember now log laws:

\begin{equation} \frac{1}{100} \ln \left| \frac{p}{100-p} \right| = 2t+C \end{equation}

And finally, we obtain:

\begin{equation} \qty | \frac{p}{100-p} | = e^{200t + C} \end{equation}

logistic regression

Last edited: August 8, 2025

Naive Bayes acts to compute \(P(Y|X)\) via the Bayes rule and using the Naive Bayes assumption. What if we can model the value of \(P(Y|X)\) directly?

With \(\sigma\) as the sigmoid function:

\begin{equation} P(Y=1|X=x) = \sigma (\theta^{\top}x) \end{equation}

and we tune the parameters of \(\theta\) until this looks correct.

We always want to introduce a BIAS parameter, which acts as an offset; meaning the first \(x\) should always be \(1\), which makes the first value in \(\theta\) as a “bias”.

Logit Probe

Last edited: August 8, 2025

Goals

Motivation: it is very difficult to have an interpretable, causal trace of facts. Let’s fix that.

Facts

It is also further difficult to pull about what is a “fact” and what is a “syntactical relation”. For instance, the task of

The Apple iPhone is made by American company <mask>.

is different and arguably more of a syntactical relationship rather than factually eliciting prompt than

The iPhone is made by American company <mask>.

For our purposes, however, we obviate this problem by saying that both of these cases are a recall of the fact triplet <iPhone, made_by, Apple>. Even despite the syntactical relationship established by the first case, we define success as any intervention that edits this fact triplet without influencing other stuff of the form:

logspace

Last edited: August 8, 2025

\begin{equation} L = \text{SPACE}\qty(\log n) \end{equation}

For time, the gold standard for languages with \(\geq n\) to read input is \(\text{TIME}\qty(n)\) or at best \(\text{TIME}\qty(n^{k})\).

For space, the gold standard for languages with \(\geq n\) characters is \(\text{SPACE}\qty(\log n)\), because to have pointers, store things, etc., will take this much.

additional information

example

Here are some logspace algorithms.

0 and 1

\begin{equation} A = \qty {0^{m}1^{m}: m \in \mathbb{N}} \end{equation}

palendromes

We can solve it by keeping track of length of input, and then check \(x [i] = x[n-i+1]\)

loop invariant

Last edited: August 8, 2025