2020/04/29

LaTex - Citation for web site in IEEEtran format 使用IEEE格式引用網址

1. Edit the bib file as:

@misc{studyswift_key,
Author = {E Huang},
Note = {[Online]. Available: \url{https://studyswift.blogspot.com/}, Accessed on: Apr. 29, 2020},
Title = {Study {Swift}}}

2. Add this to the tex file:

\usepackage{url}

3. Cite the website:

\cite{studyswift_key}

3. Typeset: LaTex -> BibTex -> LaTex -> LaTex

Result:

Reference:

LaTeX的BibTeX引用网页的办法

2020/04/23

LaTex - *.bib file - Preserve Capital Letters 保留大寫字母

LaTex 的bib檔中的英文大寫預設上是會自動轉換為小寫英文字母

若要保留大寫,在bib檔中的字母前後加上 { } 即可

原始參考文獻 (Before)

修改bib檔 (Modify *.bib file)


重新編譯後的參考文獻 (After)

參考資料

BibTeX loses capitals when creating .bbl file

2020/04/06

How to draw figures with mathematical font for LaTeX

How to create figures for LaTeX documents

1. Create figure with PowerPoint
2. Save as PDF file
3. Open the PDF file with Inkscape and save as EPS file.
4. Use LaTex to include the EPS file

How to include math labels with consistent font with LaTeX

1. Install Latin Modern Math font
2. Reboot the computer and select the font in PowerPoint.

3. Proceed the above steps and save the file as EPS.

Reference:
https://tex.stackexchange.com/questions/22454/what-is-the-name-of-the-default-font-in-math-mode

2019/11/06

Matlab: Parseval's theorem

Parseval's theorem states that for N discrete points of signal,

Total Energy ∑ |x[n]|2 = 1/N × ∑ |X[k]|2

where X[k] is the kth point of the discrete Fourier transform of x[n].

Let's check this with Matlab:


load mtlb; %Load "Matlab" sound example

N = 128;
y = mtlb(1:N); %Read the 1st 128 points only

%Check Parseval's theorem

%y^2
y_2 = y.^2;

%Energy
energy = sum(y_2)

%Frequency domain
y_fft = fft(y); %Complex double

%|y_fft|^2

y_fft_2 = abs(y_fft).^2;

y_fft_2_check = y_fft.*conj(y_fft); %Should be identical to y_fft_2

energy_fft = sum(y_fft_2)/N

energy_fft_check = sum(y_fft_2_check)/N

Result:

Reference:

energy =

    2.5595


energy_fft =

    2.5595


energy_fft_check =

    2.5595

>> 

Parseval's theorem (Wikipedia)

2019/08/11

Matlab: Paste figure into Microsoft Word or PowerPoint files

If Matlab figures are pasted into Microsoft Office applications such as Word and PowerPoint, the file becomes slow and the mouse icon is turning/loading.

I have figured out the following solution:

1. Select copy figure
2. Paste into an empty Word file.

3. Select the figure just pasted in the Word file and copy it.

4. Past into Gimp. You should NOT see this warning:


(If you see this error message, you probably directly pasted Matlab figure into Gimp. You cannot directly do this, so steps 2 and 3 are essential. The transparency can be preserved in this way.)

5. Select all in the image layer of Gimp and copy it.

6. Paste into the target Word/PowerPoint file.

2019/07/28

Machine Learning - Batch Size and Epoch

Batch Size 批大小

The number of training examples present in a single batch.
一批次訓練中的樣本數,因無法將完整dataset送入整個神經網路訓練,故將dataset分割為數個批次(divide the dataset into batches),例如batch_size = 100,即一個批次中有100個樣本。

Epoch

Passing an entire dataset forward and backward through the neural network once.
一個資料集(dataset)完整forwardbackward通過神經網络的過程

Iteration 迭代

One iteration is the number of batches needed to complete one epoch.
做完一個epoch的訓練需要數個batch的樣本,稱為一個iteration。

Example

對於一個3000個訓練樣本的資料集(Dataset)。
若將這3000個樣本以batch_size=500分割,則完成一個epoch需要6個iterations。
做一個iteration,需以一批500個樣本進行訓練。

References 參考資料:
神經網路中Epoch、Iteration、Batchsize相關理解和說明
深度學習中的 epoch iteration batch-size
Epoch vs Batch Size vs Iterations

2019/04/11

Jacobian Matrix 雅可比矩陣

Jacobian Matrix 雅可比矩陣

The matrix that arranges the first-order partial derivatives of a function of a vector.

vector y is a function f of vector x:

vector y = f(vector x)
vector x = [x1, x2, ..., xn]
vector y = [y1, y2, ..., ym]

Jacobian matrix:

J = [∂f/x1, ∂f/x2, ..., ∂f/xn]
  = [∂y1/x1, ∂y1/x2, ..., ∂y1/xn
      ∂y2/x1, ∂y2/x2, ..., ∂y2/xn
      .....
     ∂ym/x1, ∂ym/x2, ..., ∂ym/xn]
(The above figure of formula is from Wikipedia: Jacobian matrix and determinant)

References:

Jacobian Matrix (Wikipedia) 雅可比矩陣 (維基百科)
Autograd: Automatic Differentiation (PyTorch Official Tutorial)