Label outcome as 1 if the trajectory is a failure and 0 otherwise
Direct Estimation
1
Perform a rollout of the system
2
Label outcome as 1 if the trajectory is a failure and 0 otherwise
This process is equivalent to producing samples from a Bernoulli distribution defined by parameter pfail.
We can use the parameter estimation techniques from chapter 2 to estimate it!
(maximum likelihood estimation or Bayesian estimation)
Direct Estimation
maximum likelihood estimator
p^fail=m1i=1∑m1{τi∈/ψ}=mn
number of failure trajectories
total number of trajectories
Quick Aside: How do we assess how good an estimator is?
Quick Aside: How do we assess how good an estimator is?
Bias
Consistency
Variance
Quick Aside: How do we assess how good an estimator is?
Bias
Consistency
Variance
An estimator is unbiased if it predicts the true value in expectation:
E[p^fail]=pfail
An estimator is consistent if it converges to the true value in the limit of infinite samples:
m→∞limp^fail=pfail
The variance of an estimator quantifies the spread of the estimates around the true value.
Direct Estimation
maximum likelihood estimator
p^fail=m1i=1∑m1{τi∈/ψ}=mn
number of failure trajectories
total number of trajectories
Direct Estimation
maximum likelihood estimator
p^fail=m1i=1∑m1{τi∈/ψ}=mn
Unbiased
Var[p^fail]=mpfail(1−pfail)
What happens to the variance as m→∞?
Consistent
Direct Estimation
maximum likelihood estimator
p^fail=m1i=1∑m1{τi∈/ψ}=mn
Unbiased
Consistent
Var[p^fail]=mpfail(1−pfail)
1
As the number of samples increases, the variance in the estimate decreases.
Direct Estimation
maximum likelihood estimator
p^fail=m1i=1∑m1{τi∈/ψ}=mn
Unbiased
Consistent
Var[p^fail]=mpfail(1−pfail)
1
As the number of samples increases, the variance in the estimate decreases.
2
As the probability of failure decreases, the variance in the estimate increases.
Again, bad news for systems with rare failure events.
We will discuss importance sampling techniques throughout the rest of this lecture that aim to address this issue!
Direct Estimation
But first: one more issue with maximum likelihood estimation.
Imagine that we want to estimate the probability of failure for an aircraft collision avoidance system from an aviation safety database that contains flight records from the month of December. What would the maximum likelihood estimate of the probability of failure be if there were no recorded midair collisions in December?
Zero!
We could use Bayesian estimation in this case to produce a distribution over the probability of failure.
Direct Estimation
We could use Bayesian estimation in this case to produce a distribution over the probability of failure.
Remember these fun times?
Direct Estimation
We could use Bayesian estimation in this case to produce a distribution over the probability of failure.
Remember these fun times?
p(θ∣D)=∫θp(D∣θ)p(θ)dθp(D∣θ)p(θ)
p(θ)=Beta(θ∣α,β)
p(θ∣D)=Beta(θ∣α+n,β+m−n)
θ
: probability of both frisbees landing in the same direction
n
: number of times same
m
: total number of flips
Direct Estimation
We could use Bayesian estimation in this case to produce a distribution over the probability of failure.
Remember these fun times?
p(θ∣D)=∫θp(D∣θ)p(θ)dθp(D∣θ)p(θ)
p(θ)=Beta(θ∣α,β)
p(θ∣D)=Beta(θ∣α+n,β+m−n)
θ
: probability of both frisbees landing in the same direction
n
: number of times same
m
: total number of flips
Direct Estimation
We could use Bayesian estimation in this case to produce a distribution over the probability of failure.
Remember these fun times?
p(θ∣D)=∫θp(D∣θ)p(θ)dθp(D∣θ)p(θ)
p(θ)=Beta(θ∣α,β)
p(θ∣D)=Beta(θ∣α+n,β+m−n)
θ
: probability of both frisbees landing in the same direction
: pfail
n
: number of times same
m
: total number of flips
Direct Estimation
We could use Bayesian estimation in this case to produce a distribution over the probability of failure.
Remember these fun times?
p(θ∣D)=∫θp(D∣θ)p(θ)dθp(D∣θ)p(θ)
p(θ)=Beta(θ∣α,β)
p(θ∣D)=Beta(θ∣α+n,β+m−n)
θ
: probability of both frisbees landing in the same direction
: pfail
n
: number of times same
: number of failure trajectories
m
: total number of flips
Direct Estimation
We could use Bayesian estimation in this case to produce a distribution over the probability of failure.
Remember these fun times?
p(θ∣D)=∫θp(D∣θ)p(θ)dθp(D∣θ)p(θ)
p(θ)=Beta(θ∣α,β)
p(θ∣D)=Beta(θ∣α+n,β+m−n)
θ
: probability of both frisbees landing in the same direction
: pfail
n
: number of times same
: number of failure trajectories
m
: total number of flips
: total number of trajectories
Direct Estimation
Perception noise σ
0.25
Number of rollouts m
50
Zoom θmax
1.00
Zoom ymax
15
Direct Estimation
A cool thing about Bayesian estimation is that is allows us to quantify the confidence we have in our estimate.
What if we could stillfit a good proposal using samples from a different distribution that is easier to sample from?
1
Draw samples from an initial proposal distribution that is easy sample from.
2
Use the samples to fit a new proposal distribution from a model class that we also know how to sample from by selecting the parameters that minimize the cross entropy between the proposal distribution and the failure distribution.
Cross Entropy Method
What if we could stillfit a good proposal using samples from a different distribution that is easier to sample from?
1
Draw samples from an initial proposal distribution that is easy sample from.
τ∼q(⋅)
What proposal distribution should we try?
How about the nominal trajectory distribution?
2
Use the samples to fit a new proposal distribution from a model class that we also know how to sample from by selecting the parameters that minimize the cross entropy between the proposal distribution and the failure distribution.
For many common model classes (e.g. Gaussian), minimizing the cross entropy is equivalent to computing the weighted maximum likelihood estimate for the parameters with weights
w=q(τ)p(τ)1{τ∈/ψ}
Cross Entropy Method
If we sample from the nominal distribution and failures are rare, we may not get any failures and all the weights will be zero!
Samples
500
Threshold γ
-2.00
Cross Entropy Method
If we sample from the nominal distribution and failures are rare, we may not get any failures and all the weights will be zero!
Samples
500
Threshold γ
-2.00
Start with the nominal distribution and iteratively adapt it to move closer to the failure distribution.
The adaptive part of adaptive importance sampling!
Cross Entropy Method
Before we start:
1
Pick an initial proposal to adapt (e.g. nominal trajectory distribution)
2
Pick a notion of closeness to failure f(τ) (e.g. robustness)
We will require that f(τ)≤0 for failure trajectories such that p(τ∣τ∈/ψ)=p(τ∣f(τ)≤0)
Cross Entropy Method
Before we start:
1
Pick an initial proposal to adapt (e.g. nominal trajectory distribution)
2
Pick a notion of closeness to failure f(τ) (e.g. robustness)
We will require that f(τ)≤0 for failure trajectories such that p(τ∣τ∈/ψ)=p(τ∣f(τ)≤0)
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
Cross Entropy Method
Before we start:
1
Pick an initial proposal to adapt (e.g. nominal trajectory distribution)
2
Pick a notion of closeness to failure f(τ) (e.g. robustness)
We will require that f(τ)≤0 for failure trajectories such that p(τ∣τ∈/ψ)=p(τ∣f(τ)≤0)
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
Cross Entropy Method
At each iteration
1
Draw samples from the current proposal.
2
Compute f(τ) for each sample and pick the top melite samples.
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
Cross Entropy Method
At each iteration
1
Draw samples from the current proposal.
2
Compute f(τ) for each sample and pick the top melite samples.
3
Select the threshold γ to be the highest f(τ) of the elite samples.
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
Cross Entropy Method
At each iteration
1
Draw samples from the current proposal.
2
Compute f(τ) for each sample and pick the top melite samples.
3
Select the threshold γ to be the highest f(τ) of the elite samples.
4
Compute the next proposal by minimizing the cross entropy with p(τ∣f(τ)≤γ).
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
Cross Entropy Method
At each iteration
1
Draw samples from the current proposal.
2
Compute f(τ) for each sample and pick the top melite samples.
3
Select the threshold γ to be the highest f(τ) of the elite samples.
4
Compute the next proposal by minimizing the cross entropy with p(τ∣f(τ)≤γ).
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
REPEAT!
Cross Entropy Method
At each iteration
1
Draw samples from the current proposal.
2
Compute f(τ) for each sample and pick the top melite samples.
3
Select the threshold γ to be the highest f(τ) of the elite samples.
4
Compute the next proposal by minimizing the cross entropy with p(τ∣f(τ)≤γ).
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
REPEAT!
Cross Entropy Method
At each iteration
1
Draw samples from the current proposal.
2
Compute f(τ) for each sample and pick the top melite samples.
3
Select the threshold γ to be the highest f(τ) of the elite samples.
4
Compute the next proposal by minimizing the cross entropy with p(τ∣f(τ)≤γ).
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
REPEAT!
Cross Entropy Method
At each iteration
1
Draw samples from the current proposal.
2
Compute f(τ) for each sample and pick the top melite samples.
3
Select the threshold γ to be the highest f(τ) of the elite samples.
4
Compute the next proposal by minimizing the cross entropy with p(τ∣f(τ)≤γ).
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
REPEAT!
Cross Entropy Method
At each iteration
1
Draw samples from the current proposal.
2
Compute f(τ) for each sample and pick the top melite samples.
3
Select the threshold γ to be the highest f(τ) of the elite samples.
4
Compute the next proposal by minimizing the cross entropy with p(τ∣f(τ)≤γ).
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
REPEAT!
Cross Entropy Method
At each iteration
1
Draw samples from the current proposal.
2
Compute f(τ) for each sample and pick the top melite samples.
3
Select the threshold γ to be the highest f(τ) of the elite samples.
4
Compute the next proposal by minimizing the cross entropy with p(τ∣f(τ)≤γ).
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
REPEAT!
Cross Entropy Method
At each iteration
1
Draw samples from the current proposal.
2
Compute f(τ) for each sample and pick the top melite samples.
3
Select the threshold γ to be the highest f(τ) of the elite samples.
4
Compute the next proposal by minimizing the cross entropy with p(τ∣f(τ)≤γ).
f(τ)≤0
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
REPEAT!
Perform importance sampling with the final proposal.
Cross Entropy Method
At each iteration
1
Draw samples from the current proposal.
2
Compute f(τ) for each sample and pick the top melite samples.
3
Select the threshold γ to be the highest f(τ) of the elite samples.
4
Compute the next proposal by minimizing the cross entropy with p(τ∣f(τ)≤γ).
Ideally, we minimize the cross entropy between the new proposal distribution and p(τ∣f(τ)≤0).
…but the weights might all be zero!
REPEAT!
Perform importance sampling with the final proposal.
It turns out that importance sampling is a special case of a more general problem of determining the ratio of the normalizing constants of two distributions.
Ratio of Normalizing Constants
It turns out that importance sampling is a special case of a more general problem of determining the ratio of the normalizing constants of two distributions.
g1(τ)=∫gˉ1(τ)dτgˉ1(τ)=z1gˉ1(τ)
g2(τ)=∫gˉ2(τ)dτgˉ2(τ)=z2gˉ2(τ)
g1(τ)=∫gˉ1(τ)dτgˉ1(τ)=z1gˉ1(τ)
g2(τ)=∫gˉ2(τ)dτgˉ2(τ)=z2gˉ2(τ)
Imagine someone just came up to you and was like…
I will give you a million dollars 💰 if you can get me an accurate estimate ofz1/z2using only samples fromg2.
g1(τ)=∫gˉ1(τ)dτgˉ1(τ)=z1gˉ1(τ)
g2(τ)=∫gˉ2(τ)dτgˉ2(τ)=z2gˉ2(τ)
I will give you a million dollars 💰 if you can get me an accurate estimate ofz1/z2using only samples fromg2.
g1(τ)=∫gˉ1(τ)dτgˉ1(τ)=z1gˉ1(τ)
g2(τ)=∫gˉ2(τ)dτgˉ2(τ)=z2gˉ2(τ)
I will give you a million dollars 💰 if you can get me an accurate estimate ofz1/z2using only samples fromg2.