Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Count sketch

From Wikipedia, the free encyclopedia
Method of a dimension reduction
Part of a series on
Machine learning
anddata mining
Journals and conferences

Count sketch is a type ofdimensionality reduction that is particularly efficient instatistics,machine learning andalgorithms.[1][2]It was invented by Moses Charikar, Kevin Chen and Martin Farach-Colton[3] in an effort to speed up theAMS Sketch by Alon, Matias and Szegedy for approximating thefrequency moments of streams[4] (these calculations require counting of the number of occurrences for the distinct elements of the stream).

The sketch is nearly identical[citation needed] to theFeature hashing algorithm by John Moody,[5] but differs in its use of hash functions with low dependence, which makes it more practical.In order to still have a high probability of success, themedian trick is used to aggregate multiple count sketches, rather than the mean.

These properties allow use for explicitkernel methods, bilinearpooling inneural networks and is a cornerstone in many numerical linear algebra algorithms.[6]

Intuitive explanation

[edit]

The inventors of this data structure offer the following iterative explanation of its operation:[3]

Mathematical definition

[edit]

1. For constantsw{\displaystyle w} andt{\displaystyle t} (to be defined later) independently choosed=2t+1{\displaystyle d=2t+1} random hash functionsh1,,hd{\displaystyle h_{1},\dots ,h_{d}} ands1,,sd{\displaystyle s_{1},\dots ,s_{d}} such thathi:[n][w]{\displaystyle h_{i}:[n]\to [w]} andsi:[n]{±1}{\displaystyle s_{i}:[n]\to \{\pm 1\}}.It is necessary that the hash families from whichhi{\displaystyle h_{i}} andsi{\displaystyle s_{i}} are chosen be pairwise independent.

2. For each itemqi{\displaystyle q_{i}} in the stream, addsj(qi){\displaystyle s_{j}(q_{i})} to thehj(qi){\displaystyle h_{j}(q_{i})}th bucket of thej{\displaystyle j}th hash.

At the end of this process, one haswd{\displaystyle wd} sums(Cij){\displaystyle (C_{ij})} where

Ci,j=hi(k)=jsi(k).{\displaystyle C_{i,j}=\sum _{h_{i}(k)=j}s_{i}(k).}

To estimate the count ofq{\displaystyle q}s one computes the following value:

rq=mediani=1dsi(q)Ci,hi(q).{\displaystyle r_{q}={\text{median}}_{i=1}^{d}\,s_{i}(q)\cdot C_{i,h_{i}(q)}.}

The valuessi(q)Ci,hi(q){\displaystyle s_{i}(q)\cdot C_{i,h_{i}(q)}} are unbiased estimates of how many timesq{\displaystyle q} has appeared in the stream.

The estimaterq{\displaystyle r_{q}} has varianceO(min{m12/w2,m22/w}){\displaystyle O(\mathrm {min} \{m_{1}^{2}/w^{2},m_{2}^{2}/w\})}, wherem1{\displaystyle m_{1}} is the length of the stream andm22{\displaystyle m_{2}^{2}} isq(i[qi=q])2{\displaystyle \sum _{q}(\sum _{i}[q_{i}=q])^{2}}.[7]

Furthermore,rq{\displaystyle r_{q}} is guaranteed to never be more than2m2/w{\displaystyle 2m_{2}/{\sqrt {w}}} off from the true value, with probability1eO(t){\displaystyle 1-e^{-O(t)}}.

Vector formulation

[edit]

Alternatively Count-Sketch can be seen as a linear mapping with a non-linear reconstruction function.LetM(i[d]){1,0,1}w×n{\displaystyle M^{(i\in [d])}\in \{-1,0,1\}^{w\times n}}, be a collection ofd=2t+1{\displaystyle d=2t+1} matrices, defined by

Mhi(j),j(i)=si(j){\displaystyle M_{h_{i}(j),j}^{(i)}=s_{i}(j)}

forj[w]{\displaystyle j\in [w]} and 0 everywhere else.

Then a vectorvRn{\displaystyle v\in \mathbb {R} ^{n}} is sketched byC(i)=M(i)vRw{\displaystyle C^{(i)}=M^{(i)}v\in \mathbb {R} ^{w}}.To reconstructv{\displaystyle v} we takevj=medianiCj(i)si(j){\displaystyle v_{j}^{*}={\text{median}}_{i}C_{j}^{(i)}s_{i}(j)}.This gives the same guarantees as stated above, if we takem1=v1{\displaystyle m_{1}=\|v\|_{1}} andm2=v2{\displaystyle m_{2}=\|v\|_{2}}.

Relation to Tensor sketch

[edit]

The count sketch projection of theouter product of two vectors is equivalent to theconvolution of two component count sketches.

The count sketch computes a vectorconvolution

C(1)xC(2)xT{\displaystyle C^{(1)}x\ast C^{(2)}x^{T}}, whereC(1){\displaystyle C^{(1)}} andC(2){\displaystyle C^{(2)}} are independent count sketch matrices.

Pham and Pagh[8] show that this equalsC(xxT){\displaystyle C(x\otimes x^{T})} – a count sketchC{\displaystyle C} of theouter product of vectors, where{\displaystyle \otimes } denotesKronecker product.

Thefast Fourier transform can be used to do fast convolution of count sketches.By using theface-splitting product[9][10][11] such structures can be computed much faster than normal matrices.

See also

[edit]

References

[edit]
  1. ^Faisal M. Algashaam; Kien Nguyen; Mohamed Alkanhal; Vinod Chandran; Wageeh Boles. "Multispectral Periocular Classification WithMultimodal Compact Multi-Linear Pooling" [1].IEEE Access, Vol. 5. 2017.
  2. ^Ahle, Thomas; Knudsen, Jakob (2019-09-03)."Almost Optimal Tensor Sketch".ResearchGate. Retrieved2020-07-11.
  3. ^abCharikar, Chen & Farach-Colton 2004.
  4. ^Alon, Noga, Yossi Matias, and Mario Szegedy. "The space complexity of approximating the frequency moments." Journal of Computer and system sciences 58.1 (1999): 137-147.
  5. ^Moody, John. "Fast learning in multi-resolution hierarchies." Advances in neural information processing systems. 1989.
  6. ^Woodruff, David P. "Sketching as a Tool for Numerical Linear Algebra." Theoretical Computer Science 10.1-2 (2014): 1–157.
  7. ^Larsen, Kasper Green, Rasmus Pagh, and Jakub Tětek. "CountSketches, Feature Hashing and the Median of Three." International Conference on Machine Learning. PMLR, 2021.
  8. ^Ninh, Pham;Pagh, Rasmus (2013).Fast and scalable polynomial kernels via explicit feature maps. SIGKDD international conference on Knowledge discovery and data mining. Association for Computing Machinery.doi:10.1145/2487575.2487591.
  9. ^Slyusar, V. I. (1998)."End products in matrices in radar applications"(PDF).Radioelectronics and Communications Systems.41 (3):50–53.
  10. ^Slyusar, V. I. (1997-05-20)."Analytical model of the digital antenna array on a basis of face-splitting matrix products"(PDF).Proc. ICATT-97, Kyiv:108–109.
  11. ^Slyusar, V. I. (March 13, 1998)."A Family of Face Products of Matrices and its Properties"(PDF).Cybernetics and Systems Analysis C/C of Kibernetika I Sistemnyi Analiz.- 1999.35 (3):379–384.doi:10.1007/BF02733426.S2CID 119661450.

Further reading

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Count_sketch&oldid=1273872249"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp