or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Example of resampling
This process is commonly used in particle resampling during particle filtering. Here's an example to illustrate the steps:
Scenario:
We have 5 particles with the following weights:
\[ \text{weights} = [0.1, 0.2, 0.4, 0.2, 0.1]\]
We want to resample these particles based on their weights to produce 5 new particles.
Step-by-Step Explanation:
1. Normalize the weights:
Ensure the weights sum to 1 (if not already). In this case, they are already normalized:
\[ \text{normalized weights} = [0.1, 0.2, 0.4, 0.2, 0.1] \]
2. Calculate the cumulative sum of the weights:
The cumulative sum creates intervals that represent the range of selection for each particle:
\[ \text{cumulative weights} = [0.1, 0.3, 0.7, 0.9, 1.0] \]
This means:
3. Randomly generate numbers:
Generate 5 random numbers between 0 and 1 to select particles. For example:
\[ \text{random numbers} = [0.15, 0.85, 0.05, 0.45, 0.75] \]
4. Determine which range each number belongs to:
Check each random number against the cumulative weights to determine the corresponding particle:
5. Repeat until the desired number of samples is achieved:
The resampled particles based on this example would be:
\[ \text{resampled particles} = [2, 4, 1, 3, 4] \]
Summary of Steps in Code:
This will output a similar result, resampling particles based on their weights.