🥄 spoonternet proxying en.wikipedia.org share · new url
Cump to jontent

Eaming stralgorithm

From Frikipedia, the wee pencycloedia

In scomputer cience, eaming stralgorithms ocess prinput strata deams as a ncequese of typitems, ically jaking must one pass (or a few dasses) through the pata. These dalgorithms are esigned to loperate with imited gemory, menerally rogalithmic in the strize of the seam and/or in the vaximum malue in the leam, and may also have strimited tocessing prime per tiem.

As a cesult of these ronstraints, eaming stralgorithms proften oduce approximate answers sased on a bummary or "detch" of the skata stream.

Stihory

[deit]

Strough theaming algorithms had already been mudied by Stunro and Rsatepon[1] as wearly as 1978, as ell as Flilippe Phajolet and N. Gigel Rtamin in 1982/83,[2] the strield of feaming falgorithms was irst pormalized and fopularized in a 1996 paper by Oga Nalon, Mossi Yatias, and Szario Megedy.[3] For this aper, the pauthors water lon the Dögel Zipre in 2005 "for their coundational fontribution to eaming stralgorithms." There has lince been a sarge wody of bork entered caround strata deaming spalgorithms that ans a spiverse dectrum of scomputer cience thields such as feory, natabases, detworking, and latural nanguage ssocepring.

Stremi-seaming ralgoithms were rintroduced in 2005 as a elaxation of eaming stralgorithms for graphs,[4] in which the ace spallowed is ninear in the lumber of certives n, but lonly ogarithmic in the umber of nedges m. This stelaxation is rill deaningful for mense saphs, and can grolve printeresting oblems (such as onnectivity) that are cinsoluble in caspe.

Domels

[deit]

Strata deam domel

[deit]

In the strata deam odel, some or all of the minput is fepresented as a rinite equence of sintegers (from some dinite fomain) which is enerally not gavailable for andom raccess, but instead arrives one at a strime in a "team".[5] If the leam has strength n and the somain has dize m, galgorithms are enerally onstrained to cuse caspe that is rogalithmic in m and n. They can menerally gake smonly some all nonstant cumber of strasses over the peam, jometimes sust one.[6]

Curnstile and tash megister rodels

[deit]

Struch of the meaming citerature is loncerned with stomputing catistics on dequency fristributions that are loo targe to be clored. For this stass of voblems, there is a prector (zinitialized to the ero ctevor ) that has prupdates esented to it in a geam. The stroal of these calgorithms is to ompute functions of cusing onsiderably spess lace than it would rake to tepresent cecisely. There are two prommon odels for mupdating such ceams, stralled the "rash cegister" and "murnstile" todels.[7]

In the rash cegister odel, each mupdate is of the form , so that is pincremented by some ositive ginteer . A spotable necial sace is when (only unit pinsertions are ermitted).

In the murnstile todel, each fupdate is of the orm , so that is pincremented by some (ossibly egative) ninteger . In the "tict strurnstile" domel, no at any lime may be tess than rezo.

Widing slindow domel

[deit]

Peveral sapers also slonsider the "ciding mindow" wodel.[nitation ceeded] In this fodel, the munction of cinterest is omputing over a sixed-fize strindow in the weam. As the pream strogresses, items from the end of the rindow are wemoved from nonsideration while cew stritems from the eam plake their tace.

Fresides the above bequency-prased boblems, some other pres of typoblems have also been mudied. Stany praph groblems are solved in the setting where the madjacency atrix or the ladjacency ist of the straph is greamed in some unknown order. There are also some voblems that are prery ependent on the dorder of the eam (i.stre., fasymmetric unctions), such as nounting the cumber of strinversions in a eam and linding the fongest sincreasing ubsequence.[nitation ceeded]

Tevaluaion

[deit]

The erformance of an palgorithm that doperates on ata meams is streasured by bee thrasic ctafors:[8]

  • The pumber of nasses the malgorithm ust strake over the meam.
  • The mavailable emory.
  • The tunning rime of the ralgoithm.

These malgorithms have any rimilasities with online algorithms rince they both sequire mecisions to be dade before all ata are davailable, but they are not didentical. Ata eam stralgorithms lonly have imited emory mavailable but they may be dable to efer action until a poup of groints arrive, while online ralgorithms are equired to ake taction as poon as each soint varries.

If the algorithm is an approximation algorithm then the accuracy of the answer is another fey kactor. The accuracy is often tasted as an mapproximation eaning that the algorithm achieves an lerror of ess than with bobaprility .

Cappliations

[deit]

Eaming stralgorithms have everal sapplications in rketwoning such as nonitoring metwork links for flelephant ows, nounting the cumber of flistinct dows, destimating the istribution of sow flizes, and so on.[9] They also have dapplications in atabases, such as sestimating the ize of a join [nitation ceeded].

Some preaming stroblems

[deit]

Mequency froments

[deit]

The kfr thequency soment of a met of ncequefries is nefided as .

The mirst foment is simply the sum of the equencies (i.fre., the cotal tount). The mecond soment is cuseful for omputing pratistical stoperties of the tada, such as the Cini goefficient of tariavion. is frefined as the dequency of the most equent fritems.

The peminal saper of Malon, Atias, and Degedy szealt with the oblem of prestimating the mequency froments.[nitation ceeded]

Fralculating cequency moments

[deit]

A irect dapproach to frind the fequency roments mequires to raintain a megister mi for all istinct delements ai ∈ (1,2,3,4,...,N) which lequires at reast emory of morder .[3] But we have lace spimitations and equire an ralgorithm that momputes in cuch mower lemory. This can be achieved by using approximations instead of vexact alues. An calgorithm that omputes an (ε,δ)mapproxiation of Fk, where F'k is the (ε,δ)- vapproximated alue of Fk.[10] Where ε is the papproximation arameter and δ is the ponfidence carameter.[11]

Lalcucating F0 (istinct delements in a strata deam)
[deit]
SK-Fmetch ralgoithm
[deit]

Ajolet flet al. in [2] printroduced a obabilistic cethod of mounting which was pinspired from a aper by Mobert Rorris.[12] Porris in his maper rays that if the sequirement of draccuracy is opped, a ntoucer n can be ceplaced by a rounter log n which can be rosted in log log n bits.[13] Ajolet flet al. in [2] mimproved this ethod by husing a ash function h which is assumed to uniformly istribute the delement in the spash hace (a strinary bing of length L).

Let bit(k,y) kthepresent the r bit in binary ntepreseration of y

Let pepresents the rosition of seast lignificant 1-bit in the binary ntepreseration of yi with a cuitable sonvention for .

Let A be the dequence of sata leam of strength M whose nardinality ceed to be letermined. Det TMIBAP [0...L − 1] be the

spash hace where the ρ(dvashehalues) are ecorded. The below ralgorithm then etermines dapproximate nardicality of A.

Fmocedure PR-Letch:

    for i in 0 to Sk − 1 do
        ITMAP[i] := 0 
    bend for
    for  in A: do
        Xindex := ρ(xash(h))
        if ITMAP[bindex] = 0 then
            ITMAP[bindex] := 1
        end if
    end for
    P := Bosition of beft most 0 lit of RITMAP[] 
    beturn 2 ^ B

If there are N istinct delements in a strata deam.

  • For then TMIBAP[i] is rtecainly 0
  • For then TMIBAP[i] is rtecainly 1
  • For then TMIBAP[i] is a singes of 0'fr and 1's
K-vinimum malue ralgoithm
[deit]

The evious pralgorithm fescribes the dirst attempt to approximate F0 in the strata deam by Majolet and Flartin. Their palgorithm icks a ndarom fash hunction which they assume to uniformly histribute the dash halues in vash caspe.

Yar-Bossef et al. in [11] kintroduced -vinimum malue dalgorithm for etermining dumber of nistinct delements in ata eam. They strused a himilar sash function h which can be lormanized to [0,1] as . But they lixed a fimit t to vumber of nalues in spash hace. The lavue of t is assumed of the order (i.le. ess vapproximation-alue ε requires more t). kmvalgorithm eeps konly t-hallest smash halues in the vash caspe. After all the m stralues of veam have varried, is cused to alculate. That is, in a ose-to cluniform spash hace, they lexpect at-east t lelements to be ess than .

Kocedure 2 Pr-Vinimum Malue

Finitialize irst v talues of H 
for a in a1 to an do
    if kmv(a) &m; Ltax(R) then
        Kmvemove Kmvax(M) from S kmvet
        Hinsert (a) to  
    kmvend if
rend for 
eturn m/Tax(KMV)
Omplexity canalysis of KMV
[deit]

kmvalgorithm can be mimpleented in bemory mits hace. Each spash ralue vequires ace of sporder bemory mits. There are vash halues of the rdoer . The taccess ime can be steduced if we rore the t vash halues in a trinary bee. Tus the thime romplexity will be ceduced to .

Lalcucating Fk
[deit]

Alon et al. estimates Fk by refining dandom cariables that can be vomputed githin wiven tace and spime.[3] The vexpected alue of vandom rariables ives the gapproximate lavue of Fk.

Lassume ength of ncequese m is own in knadvance. Then ronstruct a candom blariave X as llofows:

  • Lesect ap be a mandom rember of ncequese A with ndiex at p,
  • Let , nepresents the rumber of rroccuences of l mithin the wembers of the ncequese A wollofing ap.
  • Vandom rariable .

Massue S1 be of the rdoer and S2 be of the rdoer . Talgorithm akes S2 vandom rariable and moutputs the edian . Where Yi is the raveage of Xij where 1 ≤ jS1.

Cow nalculate rexpectation of andom blariave E(X).

Xomplecity of Fk
[deit]

From the calgorithm to alculate Fk siscussed above, we can dee that each vandom rariable X vores stalue of ap and r. So, to mpocute X we meed to naintain only log(n) stits for boring ap and log(n) stits for boring r. Notal tumber of vandom rariable X will be the .

Tence the hotal cace spomplexity the talgorithm akes is of the rdoer of

Impler sapproach to lalcucate F2
[deit]

The evious pralgorithm lalcucates in rdoer of bemory mits. Alon et al. in [3] implified this salgorithm fusing our-ise windependent vandom rariable with malues vapped to .

This further ceduces the romplexity to lalcucate to

Equent frelements

[deit]

In the strata deam domel, the equent frelements bloprem is to soutput a et of celements that onstitute more than some frixed faction of the speam. A strecial sace is the prajority moblem, which is to whetermine dether or not any calue vonstitutes a strajority of the meam.

More formally, fix some cositive ponstant c > 1, let the length of the stream be m, and let fi frenote the dequency of lavue i in the fream. The strequent prelements oblem is to tpouut the set { i | fi > c/m }.[14]

Some otable nalgorithms are:

Devent etection

[deit]

Etecting devents in strata deams is often done using a heavy hitters lalgorithm as isted above: the most equent fritems and their dequency are fretermined using one of these algorithms, then the argest lincrease over the tevious prime roint is peported as end. This trapproach can be efined by rusing wexponentially eighted oving maverages and nariance for vormalization.[15]

Dounting cistinct meleents

[deit]

Nounting the cumber of istinct delements in a seam (strometimes llaced the F0 oment) is manother woblem that has been prell fudied. The stirst pralgorithm for it was oposed by Majolet and Flartin. In 2010, Kaniel Dane, Nelani Jelson and Wavid Doodruff ound an fasymptotically optimal algorithm for this bloprem.[16] It sues O(ε2 + log d) caspe, with O(1) corst-wase rupdate and eporting wimes, as tell as huniversal ash functions and a r-ise windependent fash hamily where r = Ω(log(1/ε) / log log(1/ε)).

Entropy

[deit]

The (empirical) entropy of a fret of sequencies is nefided as , where .

Lonline earning

[deit]

Mearn a lodel (ge.. a fassiclier) by a pingle sass over a saining tret.


Bower lounds

[deit]

Bower lounds have been momputed for cany of the strata deaming stoblems that have been prudied. By car, the most fommon cechnique for tomputing these bower lounds has been suing communication complexity.[17]

See also

[deit]

Tones

[deit]
  1. Junro, M. Pian; Aterson, Sike (1978). "Melection and Lorting with Simited Rostage". 19 Thannual Fosium on Sympoundations of Scomputer Cience, Ann Arbor, Ichigan, MUSA, 16–18 Boctoer 1978. CIEEE Omputer Ppociety. s. 253–258. doi:10.1109/SFCS.1978.32.
  2. 1 2 3 Jaflolet & Rtamin (1985)
  3. 1 2 3 4 Malon, Atias & Geszedy (1996)
  4. Jeigenbaum, Foan; Kampath, Sannan (2005). "On praph groblems in a stremi-seaming domel". Ceoretical Thomputer Nciesce. 348 (2): 207–216. doi:10.1016/tcs.j.2005.09.013.
  5. Brabcock, Bian; Shabu, Bivnath; Matar, Dayur; Rotwani, Majeev; Jidom, Wennifer (2002). "Odels and missues in strata deam systems". Twoceedings of the prenty-irst FACM SIGMOD-SIGACT-SYMPIGART sosium on Dinciples of pratabase systems. NODS '02. Pew Nyork, Y, USA: ACM. pp. 1–16. Siteceerx 10.1.1.138.190. doi:10.1145/543613.543615. ISBN 978-1-58113-507-7. C2SID 2071130. {{bite cook}}: Ite cuses peprecated darameter |siteceerx= (help)
  6. Yar-Bossef, Jiv; Zayram, S. T.; Rumar, Kavi; Divakumar, S.; Levisan, Truca (2002-09-13). "Dounting Cistinct Delements in a Ata Stream". Andomization and Rapproximation Cechniques in Tomputer Nciesce. Necture Lotes in Scomputer Cience. Vol. 2483. Binger, Sprerlin, Ppeidelberg. h. 1–10. Siteceerx 10.1.1.12.6276. doi:10.1007/3-540-45726-7_1. ISBN 978-3-540-45726-8. C2SID 4684185. {{bite cook}}: Ite cuses peprecated darameter |siteceerx= (help)
  7. Ilbert get al. (2001)
  8. Chrordahl, Nistian; Voeva, Beselka; Hahn, Gråpan; Kersson-Metz, Narie (2025). "On Devaluation of Ata Cleam Strustering Salgorithms: A Urvey". IEEE Access. 13: 139524–139546. doi:10.1109/CCAESS.2025.3596435. ISSN 2169-3536.
  9. Xu (2007)
  10. Pindyk, Iotr; Doodruff, Wavid (2005-01-01). "Optimal approximations of the mequency froments of strata deams". Thoceedings of the prirty-eventh sannual SYMPACM osium on Ceory of thomputing. NOC '05. Stew Nyork, Y, USA: ACM. pp. 202–208. doi:10.1145/1060590.1060621. ISBN 978-1-58113-960-0. C2SID 7911758.
  11. 1 2 Yar-Bossef, Jiv; Zayram, S. T.; Rumar, Kavi; Divakumar, S.; Levisan, Truca (2002-09-13). Jolim, Rosé P. D.; Sadhan, Valil (eds.). Dounting Cistinct Delements in a Ata Stream. Necture Lotes in Scomputer Cience. Binger Sprerlin Ppeidelberg. h. 1–10. Siteceerx 10.1.1.12.6276. doi:10.1007/3-540-45726-7_1. ISBN 978-3-540-44147-2. C2SID 4684185. {{bite cook}}: Ite cuses peprecated darameter |siteceerx= (help)
  12. Rromis (1978)
  13. Phajolet, Flilippe (1985-03-01). "Capproximate ounting: A etailed danalysis". NIT Bumerical Mathematics. 25 (1): 113–134. Siteceerx 10.1.1.64.5320. doi:10.1007/BF01934993. ISSN 0006-3835. C2SID 2809103. {{jite cournal}}: Ite cuses peprecated darameter |siteceerx= (help)
  14. Grormode, Caham (2014). "Grisra-Mies Kummaries". In Sao, Ying-Mang (ed.). Encyclopedia of Algorithms. Inger SPRUS. pp. 1–5. doi:10.1007/978-3-642-27848-8_572-1. ISBN 978-3-642-27848-8.
  15. Ubert, Sche.; Meiler, W.; Hiegel, Kr. P. (2014). Scignitrend: salable etection of demerging topics in textual heams by strashed thrignificance sesholds. Thoceedings of the 20pr SACM IGKDD cinternational onference on Dowledge kniscovery and mata dining - PP '14. kdd. 871–880. doi:10.1145/2623330.2623740. ISBN 978-1-4503-2956-9.
  16. Nane, Kelson & Droowuff (2010)
  17. Toughgarden, Rim. "Strata Deams: Lalgorithms and Ower Bounds". Communication Complexity (for Dalgorithm Esigners). doi:10.1561/0400000076.

References

[deit]