📄 lloyd.3
字号:
.\" Copyright (c) 1987-1990 Entropic Speech, Inc..\" Copyright (c) 1997 Entropic Research Laboratory, Inc. All rights reserved..\" @(#)lloyd.3 1.4 18 Apr 1997 ESI/ERL.ds ]W (c) 1997 Entropic Research Laboratory, Inc..TH LLOYD 3\-ESPSsp 18 Apr 1997.SH NAMElloyd \- generate scalar quantizer using Lloyd's algorithm.SH SYNOPSIS.ft Blloyd (data, n, cbk, ncwds, converg, hstrm, final_dist, cbk_dist, pop).brdouble data[], cbk[], converg, final_dist, cbk_dist[];.brlong n, pop[];unsigned ncwds;.brFILE *hstrm;.SH DESCRIPTIONThis routine generates a locally optimal scalar quantizer codebook (.I cbk) by usingLloyd's algorithm.Itreturns the codebookalong with the final distortion (.I final_dist) that results from representing the training data(.I data)by the codebook, the number of .I dataelements that were closest to each codebook element(.I pop), and the average distortion ( mean squared error) associated with each codebook element(.I cbk_dist). The user inputs an array of training data (.I data) and the number of elements in it(.I n),specifies how many codewords (.I ncwds) are to be generated to represent thetraining data, and also a convergence threshold(.I converg)..PP.I lloydstarts by computing the mean of all the elements in.IR data to form the codebook of length one. Larger codebooks are thengenerated by splitting the previous codebook (replacing eachcodeword by two codewords, separated by a small number), andgoing through a process of improving the codebook until convergenceis reached. This process works as follows:.PPThe squared distance is computed between every element of.I dataand every codeword. Each codeword is then replaced by the meanof all the elements of.I datafor which that codeword is the nearest neighbor. The mean squareerror that results when each element of.I datais replaced by the nearest element in the codebook is computed.The improvement loop stops when the difference between the olddistortion and the new distortion, divided by the old distortion,becomes less than.IR converg ..PPIt is possible for an"empty cell"to appear. This happens when no element of.I datahas a particular codebook element as its nearest neighbor.Empty cells are handled by splitting the codeword correspondingto the largest cluster (the codeword with the most training elementsas nearest neighbors); this is a heuristic..PPIf the argument.I hstrmis non-null, it represents a file descriptor and history informationis written on it..PPThe output codebook is sorted in increasing order..SH DIAGNOSTICSIf more than 10 empty cells appear a message is written to.I stderrand the program exits. This should never occur unless.I ncwdsis too large compared to.IR n ..SH BUGSNone known..SH REFERENCESY. Linde, A. Buzo, R.M. Gray,An Algorithm for Vector Quantizer DesignIEEE Transactions on Communications,Vol. COM-28, No. 1, January, 1980.SH AUTHORJoseph T. Buck, modifications by David K. Burton
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -