annotate docs/spec/spec.tex @ 547:5a248cedd3e9

Add the latex sources to the AudioDB spec document
author mas02md
date Wed, 11 Feb 2009 10:42:23 +0000
parents
children dfeb5ef768da
rev   line source
mas02md@547 1 \documentclass[11pt]{article}
mas02md@547 2 \usepackage{oz,times}
mas02md@547 3
mas02md@547 4 \usepackage{tikz}
mas02md@547 5 \usetikzlibrary{arrows}
mas02md@547 6 \usetikzlibrary{calc}
mas02md@547 7
mas02md@547 8 \title{A Formal Framework for Content-based Retrieval}
mas02md@547 9 \author{Mark d'Inverno and Christophe Rhodes}
mas02md@547 10
mas02md@547 11
mas02md@547 12 \begin{document}
mas02md@547 13 \maketitle
mas02md@547 14
mas02md@547 15
mas02md@547 16 %%\begin{gendef}[X]
mas02md@547 17 %% concat : (\seq (\seq X)) \fun (\seq X)
mas02md@547 18 %%\where
mas02md@547 19 %% \forall xs : \seq X; xss : \seq (\seq X) @ \\
mas02md@547 20 %%\t2 concat~ ((\langle xs \rangle) \cat xss) = xs \cat
mas02md@547 21 %%(concat~xss)
mas02md@547 22 %%\end{gendef}
mas02md@547 23
mas02md@547 24 %% \begin{gendef}[X]
mas02md@547 25 %% nfront : \nat \fun (\seq X) \fun \seq (\seq X) \\
mas02md@547 26 %% \where
mas02md@547 27 %% \forall n : \nat ; xs : \seq X @ \\
mas02md@547 28 %% n > \# xs \implies nfront ~n~xs = \langle \rangle \land \\
mas02md@547 29 %% n \leq \# xs \implies nfront~n~xs = \\
mas02md@547 30 %% \t2 (\langle (0 \upto n-1) \dres xs \rangle) \cat (nfront~n~(tail~xs))
mas02md@547 31 %% \end{gendef}
mas02md@547 32
mas02md@547 33 \section{The System Instance}
mas02md@547 34
mas02md@547 35 \newcommand{\mylet}{\methrel{\sf Let}}
mas02md@547 36 \newcommand{\FV}{\mathrel{~FV}}
mas02md@547 37 \newcommand{\V}{\mathrel{~FV^{d}}}
mas02md@547 38 \newcommand{\U}{\mathrel{~FV^{1}}}
mas02md@547 39 \newcommand{\R}{\mathrel{~R}}
mas02md@547 40
mas02md@547 41 \newcommand{\mylog}{\mathrel{ln}}
mas02md@547 42
mas02md@547 43 \begin{enumerate}
mas02md@547 44
mas02md@547 45 \item \textsf{Track} - original media.
mas02md@547 46
mas02md@547 47 We define the set of all such tracks.
mas02md@547 48
mas02md@547 49 \begin{flushright}
mas02md@547 50 \begin{tikzpicture}
mas02md@547 51 \input track.tikz
mas02md@547 52 \end{tikzpicture}
mas02md@547 53 \end{flushright}
mas02md@547 54
mas02md@547 55 \begin{zed}
mas02md@547 56 [Track]
mas02md@547 57 \end{zed}
mas02md@547 58
mas02md@547 59 %% \begin{zed}
mas02md@547 60 %%\R == \nat
mas02md@547 61 %% \end{zed}
mas02md@547 62
mas02md@547 63 %% \begin{axdef}
mas02md@547 64 %% \mylog : \R \fun \R
mas02md@547 65 %% \end{axdef}
mas02md@547 66
mas02md@547 67
mas02md@547 68
mas02md@547 69
mas02md@547 70 % For every track it is possible to determine the lenth.
mas02md@547 71
mas02md@547 72 % \begin{axdef}
mas02md@547 73 % lenth : Track \fun Time
mas02md@547 74 % \end{axdef}
mas02md@547 75
mas02md@547 76 % For every track it is possible to determine the lenth.
mas02md@547 77
mas02md@547 78 % \begin{axdef}
mas02md@547 79 % lenth : Track \fun Time
mas02md@547 80 % \end{axdef}
mas02md@547 81
mas02md@547 82 \item \textsf{Catalogue} - a non-empty list of tracks.
mas02md@547 83
mas02md@547 84 % A catalogue is typically generated for a specific \emph{use case}.
mas02md@547 85
mas02md@547 86 \begin{flushright}
mas02md@547 87 \begin{tikzpicture}
mas02md@547 88 \draw (-3,-3) rectangle (3,3);
mas02md@547 89 \foreach \y/\xscale in {2/1,1/1.02,0/0.87,-1/0.95} {
mas02md@547 90 \begin{scope}[yshift=\y cm]
mas02md@547 91 \begin{scope}[xscale=\xscale]
mas02md@547 92 \input track.tikz
mas02md@547 93 \end{scope}
mas02md@547 94 \end{scope}
mas02md@547 95 }
mas02md@547 96 \draw node at (0,-2) {\vdots};
mas02md@547 97 \end{tikzpicture}
mas02md@547 98 \end{flushright}
mas02md@547 99
mas02md@547 100 \begin{zed}
mas02md@547 101 Catalogue == \seq_1 Track
mas02md@547 102 \end{zed}
mas02md@547 103
mas02md@547 104 \item \textsf{Collection} - a set of catalogues where each track in each catalogue is associated with a unique name.
mas02md@547 105
mas02md@547 106 In a collection, each track has a unique \textsf{TrackName}. We define the injective function $name$ to do this.
mas02md@547 107
mas02md@547 108 \begin{zed}
mas02md@547 109 [TrackName]
mas02md@547 110 \end{zed}
mas02md@547 111
mas02md@547 112 \begin{schema}{Collection}
mas02md@547 113 collection : \power Catalogue \\
mas02md@547 114 tracks : \power Track \\
mas02md@547 115 name : Track \inj TrackName
mas02md@547 116 \where
mas02md@547 117 tracks = \{ cat : collection; t : Track | t \in (\ran cat) @ t \} \\
mas02md@547 118 \dom name = tracks
mas02md@547 119 \end{schema}
mas02md@547 120
mas02md@547 121
mas02md@547 122
mas02md@547 123
mas02md@547 124 \item \textsf{Time} - the set of non-negative reals.
mas02md@547 125
mas02md@547 126
mas02md@547 127 \begin{zed}
mas02md@547 128 Time == \R
mas02md@547 129 \end{zed}
mas02md@547 130
mas02md@547 131
mas02md@547 132
mas02md@547 133
mas02md@547 134
mas02md@547 135 \item \textsf{Interval} - defined as a continuous set of real numbers, represented as an ordered pair of reals with the second of the pair strictly greater.
mas02md@547 136
mas02md@547 137 \begin{flushright}
mas02md@547 138 \begin{tikzpicture}[>=stealth]
mas02md@547 139 \draw (0,0.8) rectangle (0.4,1);
mas02md@547 140 \fill (0.2,0.9) ellipse (0.05);
mas02md@547 141 \draw[->] (0.2,0.9) -- (0.1,0.2);
mas02md@547 142 \draw[->] (0.2,0.9) -- (0.55,0.2);
mas02md@547 143 \draw[very thick] (0.1,0.2) -- (0.55,0.2);
mas02md@547 144 \draw[o->] (-0.5,0.2) -- (1,0.2) node[anchor=north west] {\small $\mathbb{R}$};
mas02md@547 145 \end{tikzpicture}
mas02md@547 146 \end{flushright}
mas02md@547 147
mas02md@547 148 \begin{zed}
mas02md@547 149 Interval == \{ t_1, t_2 : Time | t_2 > t_1 @ (t_1, t_2) \}
mas02md@547 150 \end{zed}
mas02md@547 151
mas02md@547 152 \item \textsf{Interval Index} - list of intervals such that the start of each successive interval strictly increases. Intervals may be overlapping.
mas02md@547 153
mas02md@547 154 The predicate below states that for any consecutive intervals in an interval index $i_j$ and $i_{j+1}$, that $i_j$ starts before $i_{j+1}$.
mas02md@547 155
mas02md@547 156 \begin{flushright}
mas02md@547 157 \begin{tikzpicture}[>=stealth]
mas02md@547 158 \draw (0,0.8) rectangle (1.6,1);
mas02md@547 159 \draw (0.4,0.8) -- (0.4,1);
mas02md@547 160 \draw (0.8,0.8) -- (0.8,1);
mas02md@547 161 \draw (1.2,0.8) -- (1.2,1);
mas02md@547 162 \fill (0.2,0.9) ellipse (0.05);
mas02md@547 163 \fill (0.6,0.9) ellipse (0.05);
mas02md@547 164 \fill (1.0,0.9) ellipse (0.05);
mas02md@547 165 \fill (1.4,0.9) ellipse (0.05);
mas02md@547 166 \draw[->] (0.2,0.9) -- (0.1,0.2);
mas02md@547 167 \draw[->] (0.2,0.9) -- (0.55,0.2);
mas02md@547 168 \draw[->] (0.6,0.9) -- (0.55,0.2);
mas02md@547 169 \draw[->] (0.6,0.9) -- (0.7,0.2);
mas02md@547 170 \draw[->] (1.0,0.9) -- (0.9,0.2);
mas02md@547 171 \draw[->] (1.0,0.9) -- (1.3,0.2);
mas02md@547 172 \draw[->] (1.4,0.9) -- (1.2,0.2);
mas02md@547 173 \draw[->] (1.4,0.9) -- (1.5,0.2);
mas02md@547 174 \draw[o->] (-0.5,0.2) -- (2,0.2) node[anchor=north west] {\small $\mathbb{R}$};
mas02md@547 175 \end{tikzpicture}
mas02md@547 176 \end{flushright}
mas02md@547 177
mas02md@547 178 \begin{zed}
mas02md@547 179 IntervalIndex == \iseq Interval \\ \\ \\
mas02md@547 180 \end{zed}
mas02md@547 181
mas02md@547 182 \[ \forall i : IntervalIndex; i_j, i_{j+1} : Interval @ \\
mas02md@547 183 \t3 \langle i_j, i_{j+1} \rangle \inseq i \implies first~ i_j \leq first ~ i_{j+1}
mas02md@547 184 \]
mas02md@547 185
mas02md@547 186 \item \textsf{Continuous Interval Index - CII} - there are no consecutive intervals $i_j$ and $i_{j+1}$ in the index where the second element of $i_j$ is strictly less than the first element of $i_{j+1}$.
mas02md@547 187
mas02md@547 188 \begin{flushright}
mas02md@547 189 \begin{tikzpicture}[>=stealth]
mas02md@547 190 \draw (0,0.8) rectangle (1.6,1);
mas02md@547 191 \draw (0.4,0.8) -- (0.4,1);
mas02md@547 192 \draw (0.8,0.8) -- (0.8,1);
mas02md@547 193 \draw (1.2,0.8) -- (1.2,1);
mas02md@547 194 \fill (0.2,0.9) ellipse (0.05);
mas02md@547 195 \fill (0.6,0.9) ellipse (0.05);
mas02md@547 196 \fill (1.0,0.9) ellipse (0.05);
mas02md@547 197 \fill (1.4,0.9) ellipse (0.05);
mas02md@547 198 \draw[->] (0.2,0.9) -- (0.1,0.2);
mas02md@547 199 \draw[->] (0.2,0.9) -- (0.55,0.2);
mas02md@547 200 \draw[->] (0.6,0.9) -- (0.55,0.2);
mas02md@547 201 \draw[->] (0.6,0.9) -- (0.9,0.2);
mas02md@547 202 \draw[->] (1.0,0.9) -- (0.7,0.2);
mas02md@547 203 \draw[->] (1.0,0.9) -- (1.3,0.2);
mas02md@547 204 \draw[->] (1.4,0.9) -- (1.2,0.2);
mas02md@547 205 \draw[->] (1.4,0.9) -- (1.5,0.2);
mas02md@547 206 \draw[o->] (-0.5,0.2) -- (2,0.2) node[anchor=north west] {\small $\mathbb{R}$};
mas02md@547 207 \end{tikzpicture}
mas02md@547 208 \end{flushright}
mas02md@547 209
mas02md@547 210 %% \begin{zed}
mas02md@547 211 %% ContinuousIntervalIndex == IntervalIndex
mas02md@547 212 %% \end{zed}
mas02md@547 213
mas02md@547 214 %%unchecked
mas02md@547 215 \begin{zed}
mas02md@547 216 ContinuousIntervalIndex == \\
mas02md@547 217 \t1 \{ ii : IntervalIndex; i_j,
mas02md@547 218 i_{j+1}: Interval | \\
mas02md@547 219 \t3 \langle i_j, i_{j+1} \rangle \inseq ii \implies second ~ i_j \geq first ~ i_{j+1}@ ii \}
mas02md@547 220 \end{zed}
mas02md@547 221
mas02md@547 222
mas02md@547 223 \item A \textsf{Duration} is an amount of time.
mas02md@547 224
mas02md@547 225 \begin{zed}
mas02md@547 226 Duration == Time
mas02md@547 227 \end{zed}
mas02md@547 228
mas02md@547 229 \item The \textsf{Track Duration} is the duration of a track. It is the difference between the \emph{end} time and \emph{start} time of the track.
mas02md@547 230
mas02md@547 231 \begin{axdef}
mas02md@547 232 trackduration : Track \fun Duration
mas02md@547 233 \end{axdef}
mas02md@547 234
mas02md@547 235 \item \textsf{Interval Duration} is the duration of an interval. It is calculated by subtracting the first element of the interval from the second element.
mas02md@547 236
mas02md@547 237 \begin{axdef}
mas02md@547 238 intervalduration : Interval \fun Duration
mas02md@547 239 \where
mas02md@547 240 \forall i : Interval @ intervalduration ~ i = second ~ i - first ~ i
mas02md@547 241 \end{axdef}
mas02md@547 242
mas02md@547 243
mas02md@547 244 \item \textsf{Index Duration} is the duration of a Continuous Interval Index. It is calculated by subtracting the first element of the first interval from the second element of the last interval.
mas02md@547 245
mas02md@547 246
mas02md@547 247 \begin{axdef}
mas02md@547 248 indexduration : ContinuousIntervalIndex \fun Time
mas02md@547 249 \where
mas02md@547 250 \forall cii : ContinuousIntervalIndex @ \\
mas02md@547 251 \t1 indexduration~cii = second (last~cii) - first (head~cii)
mas02md@547 252 \end{axdef}
mas02md@547 253
mas02md@547 254 \item \textsf{Segmenter} - a process which computes an interval index for any track, represented as a function which maps any track to an interval index.
mas02md@547 255
mas02md@547 256 \begin{flushright}
mas02md@547 257 \begin{tikzpicture}
mas02md@547 258 \input interval-index.tikz
mas02md@547 259 \input segmented-track.tikz
mas02md@547 260 \end{tikzpicture}
mas02md@547 261 \end{flushright}
mas02md@547 262
mas02md@547 263 \begin{zed}
mas02md@547 264 Segmenter == Track \fun IntervalIndex \\
mas02md@547 265 \end{zed}
mas02md@547 266
mas02md@547 267 \item The \textsf{Length} of an interval index is the number of intervals contained within it.
mas02md@547 268
mas02md@547 269 \begin{axdef}
mas02md@547 270 length : IntervalIndex \fun \nat
mas02md@547 271 \where
mas02md@547 272 \forall ii : IntervalIndex @ length~ii = \# ii
mas02md@547 273 \end{axdef}
mas02md@547 274
mas02md@547 275 % \section{Features}
mas02md@547 276
mas02md@547 277 \item \textsf{Feature Name} - a name describing a feature.
mas02md@547 278
mas02md@547 279 \begin{zed}
mas02md@547 280 [FeatureName]
mas02md@547 281 \end{zed}
mas02md@547 282
mas02md@547 283 \item \textsf{Dimension} - a natural number.
mas02md@547 284
mas02md@547 285 \begin{zed}
mas02md@547 286 Dimension == \nat
mas02md@547 287 \end{zed}
mas02md@547 288
mas02md@547 289 \item \textsf{Feature Kind} - a feature name and associated set of parameters.
mas02md@547 290
mas02md@547 291 \begin{zed}
mas02md@547 292 [Const, Var]
mas02md@547 293 \end{zed}
mas02md@547 294
mas02md@547 295 We define the binding type as the set of functions between variables and constants.
mas02md@547 296
mas02md@547 297 \begin{zed}
mas02md@547 298 Binding == \power (Var \cross Const)
mas02md@547 299 \end{zed}
mas02md@547 300
mas02md@547 301 Every feature kind has a dimension (not necessarily fixed).
mas02md@547 302
mas02md@547 303 \begin{schema}{FeatureKind}
mas02md@547 304 name : FeatureName \\
mas02md@547 305 parameters : \power Var \\
mas02md@547 306 dparameters : \power Var \\
mas02md@547 307 binding : Binding \\
mas02md@547 308 ddimension : Binding \pfun \nat \\
mas02md@547 309 fdimension : Dimension \\
mas02md@547 310 \where
mas02md@547 311 dparameters \subseteq parameters \\
mas02md@547 312 \forall b : Binding | b \in (\dom ddimension) @ dparameters \subseteq (\dom b)
mas02md@547 313 \end{schema}
mas02md@547 314
mas02md@547 315 \item A \textsf{Feature} - sometimes referred to as a Fully Qualified Feature - is a feature kind with all parameters bound.
mas02md@547 316
mas02md@547 317 \item \textsf{Feature Dimension} - every feature has a fixed dimension.
mas02md@547 318
mas02md@547 319 \begin{schema}{Feature}
mas02md@547 320 FeatureKind \\
mas02md@547 321 \where
mas02md@547 322 \dom binding = parameters \\
mas02md@547 323 fdimension = ddimension~binding
mas02md@547 324 \end{schema}
mas02md@547 325
mas02md@547 326 \item \textsf{Unit Feature} - any feature with a dimension of 1.
mas02md@547 327
mas02md@547 328 \begin{schema}{UnitFeature}
mas02md@547 329 Feature \\
mas02md@547 330 \where
mas02md@547 331 fdimension = 1
mas02md@547 332 \end{schema}
mas02md@547 333
mas02md@547 334 \item \textsf{Feature Vector} - a non-empty sequence of real numbers.
mas02md@547 335
mas02md@547 336 \begin{zed}
mas02md@547 337 \FV == \seq_1 \R
mas02md@547 338 \end{zed}
mas02md@547 339
mas02md@547 340 % DEFINE ALL FEATURE VECTORS HERE
mas02md@547 341
mas02md@547 342 %% \begin{zed}
mas02md@547 343 %% \V == \FV \\
mas02md@547 344 %% \U == \FV
mas02md@547 345 %% \end{zed}
mas02md@547 346
mas02md@547 347 \newcommand{\Vdsl}{\mathrel{~FV^{d * sl}}}
mas02md@547 348
mas02md@547 349 %% \begin{zed}
mas02md@547 350 %% \Vdsl == \FV
mas02md@547 351 %% \end{zed}
mas02md@547 352
mas02md@547 353 \newcommand{\Vd}{\mathrel{~FV^{d}}}
mas02md@547 354
mas02md@547 355 %% \begin{zed}
mas02md@547 356 %% \Vd == \FV
mas02md@547 357 %% \end{zed}
mas02md@547 358
mas02md@547 359 \newcommand{\Z}{\mathrel{~FV^{1}}}
mas02md@547 360
mas02md@547 361 %% \begin{zed}
mas02md@547 362 %% \Z == \FV
mas02md@547 363 %% \end{zed}
mas02md@547 364
mas02md@547 365 \newcommand{\Vsl}{\mathrel{~FV^{sl}}}
mas02md@547 366
mas02md@547 367 %% \begin{zed}
mas02md@547 368 %% \Vsl == \FV
mas02md@547 369 %% \end{zed}
mas02md@547 370
mas02md@547 371
mas02md@547 372 \item \textsf{Feature Vector Dimension} - the length of a feature vector.
mas02md@547 373
mas02md@547 374 \begin{axdef}
mas02md@547 375 dimension : \FV \fun \nat
mas02md@547 376 \where
mas02md@547 377 \forall fv : \FV @ dimension~fv = \# fv
mas02md@547 378 \end{axdef}
mas02md@547 379
mas02md@547 380 \item \textsf{Unit Vector} - any feature vector with a dimension of 1.
mas02md@547 381
mas02md@547 382 \begin{zed}
mas02md@547 383 UnitVector == \{ fv : \FV | dimension~fv = 1 \}
mas02md@547 384 \end{zed}
mas02md@547 385
mas02md@547 386 \item \textsf{Extractor} - a process which computes a feature vector of fixed dimension for any interval of any track, represented formally as a function that takes a track and an interval and returns a feature vector.
mas02md@547 387
mas02md@547 388 \begin{zed}
mas02md@547 389 Extractor == Track \fun Interval \fun \FV
mas02md@547 390 \end{zed}
mas02md@547 391
mas02md@547 392 \item \textsf{Unit Extractor} - a subclass of Extractor where the feature vector dimension is equal to 1.
mas02md@547 393
mas02md@547 394 \begin{zed}
mas02md@547 395 UnitExtractor == \\
mas02md@547 396 \t1 \{ e : Extractor | \forall t : Track; i : Interval @ dimension (e~t~i) = 1 \}
mas02md@547 397 \end{zed}
mas02md@547 398
mas02md@547 399 \item \textsf{Bel Unit Extractor} - a subclass of Unit Extractor where the function outputs on the bel scale (between minus infinity and zero).
mas02md@547 400
mas02md@547 401 \begin{zed}
mas02md@547 402 BelUnitExtractor == UnitExtractor
mas02md@547 403 \end{zed}
mas02md@547 404
mas02md@547 405 \item \textsf{Feature Extractors} - the set of all extractors associated with a feature.
mas02md@547 406
mas02md@547 407 As this data structure can be updated over time - by adding and removing new features, and adding and removing extractors for a feature as new ones arise and old ones are not used - we use a schema. The predicate states that the feature vector dimension computed by an extractor must be equal to the associated feature dimension. Every feature has a unique associated unit feature and every extractor has a unique associated unit extractor. Once a user defines a feature, and one its associated extractors, the unit feature and extractor are generated automatically.
mas02md@547 408
mas02md@547 409 \begin{schema}{FeatureExtractors}
mas02md@547 410 featureextractors : Feature \pfun (\power Extractor) \\
mas02md@547 411 features : \power Feature \\
mas02md@547 412 extractors : \power Extractor \\
mas02md@547 413 \where
mas02md@547 414 \dom featureextractors = features \\
mas02md@547 415 \bigcup (\ran featureextractors) = extractors \\
mas02md@547 416 \forall f : Feature ; e : Extractor ; t : Track; i : Interval \\
mas02md@547 417 \t1 @ e \in featureextractors(f) \implies \\
mas02md@547 418 \t2 f.fdimension = dimension (e~ t ~ i) \\
mas02md@547 419 \end{schema}
mas02md@547 420
mas02md@547 421 The range of the real contained in the bel unit vector is less than 0.
mas02md@547 422
mas02md@547 423 \begin{zed}
mas02md@547 424 \forall t : Track; int : Interval; ux : BelUnitExtractor @ \\
mas02md@547 425 \t5 head (ux~t~int) \leq 0
mas02md@547 426 \end{zed}
mas02md@547 427
mas02md@547 428 \item \textsf{Track Feature Vectors} - given a segmenter and an extractor the sequence of feature vectors for each interval of the track
mas02md@547 429
mas02md@547 430 \begin{flushright}
mas02md@547 431 \begin{tikzpicture}
mas02md@547 432 \input track-feature-vectors.tikz
mas02md@547 433 \end{tikzpicture}
mas02md@547 434 \end{flushright}
mas02md@547 435
mas02md@547 436 The function $extract$ applies an extractor to each interval of a track to return a list of feature vectors. This requires the generic function map, which takes a function and applies it to every element of a list. A definition can be found in the appendix.
mas02md@547 437
mas02md@547 438 %%\begin{gendef}[X,Y]
mas02md@547 439 %% map : (X \fun Y) \fun (\seq X) \fun (\seq Y) \\
mas02md@547 440 %%\where
mas02md@547 441 %% \forall f : X \fun Y; x : X; xs,ys : \seq X @ \\
mas02md@547 442 %%\t1 map~f~\langle \rangle = \langle \rangle \land \\
mas02md@547 443 %%\t1 map~f~(xs \cat ys) = map~f~xs \cat map~f~ys
mas02md@547 444 %%\end{gendef}
mas02md@547 445
mas02md@547 446 \begin{axdef}
mas02md@547 447 extract : Segmenter \fun Extractor \fun Track \fun \seq \FV
mas02md@547 448 \where
mas02md@547 449 \forall seg : Segmenter; fx : Extractor; t : Track @ \\
mas02md@547 450 \t5 extract~seg~fx~t = map ~ (fx~t) (seg~t)
mas02md@547 451 \end{axdef}
mas02md@547 452
mas02md@547 453
mas02md@547 454 \item \textsf{Track Unit Vectors} - defined as above but specifically for unit extractors
mas02md@547 455
mas02md@547 456 \begin{flushright}
mas02md@547 457 \begin{tikzpicture}
mas02md@547 458 \input interval-index.tikz
mas02md@547 459 \input segmented-track.tikz
mas02md@547 460 % \foreach \x in {-2.5,-2,-1.4,-0.5,0,0.8,1.3,1.8} {
mas02md@547 461 % \begin{scope}[xshift=\x cm,yshift=-0.4 cm]
mas02md@547 462 \foreach \x in {-1.8,-1.4,...,1.1} {
mas02md@547 463 \begin{scope}[xshift=\x cm,yshift=1.1 cm]
mas02md@547 464 \draw (-0.1,0) rectangle (0.1,0.2);
mas02md@547 465 \end{scope}
mas02md@547 466 }
mas02md@547 467 \begin{scope}[yshift=1.1 cm]
mas02md@547 468 \draw[|-|,>=stealth] (-2.3,0) -- (-2.3,0.2);
mas02md@547 469 \draw node[anchor=south east] at (-2.4,0.1) {\small $d=1$};
mas02md@547 470 \end{scope}
mas02md@547 471 \end{tikzpicture}
mas02md@547 472 \end{flushright}
mas02md@547 473
mas02md@547 474 \item \textsf{Catalogue Feature Vectors} - a sequence of track feature vectors for each track in the target instance ($catfeatures$)
mas02md@547 475
mas02md@547 476 \item \textsf{Catalogue Unit Vectors} - a sequence of track unit vectors for each track in the target instance ($catunits$)
mas02md@547 477
mas02md@547 478 \item \textsf{Instance} - a catalogue, segmenter, feature, extractor, unit feature, unit extractor, dimension, catalogue feature vectors,
mas02md@547 479
mas02md@547 480 % \emph{In our usage (see \textsf{Absolute} \and \textsf{Relative} in section \ref{s:refining}), we require certain semantics of the \textsf{Unit Feature} (and so of the values returned by its \textit{Unit Extractors}. Specifically, the values returned must be interpretable on a logarithmic scale in Bels, with the maximum possible value being the reference threshold at 0B.}
mas02md@547 481
mas02md@547 482 \begin{schema}{Instance}
mas02md@547 483 cat : Catalogue \\
mas02md@547 484 % tracks : \power Track \\
mas02md@547 485 seg : Segmenter \\
mas02md@547 486 f : Feature \\
mas02md@547 487 x : Extractor \\
mas02md@547 488 uf : UnitFeature \\
mas02md@547 489 ux : UnitExtractor \\
mas02md@547 490 d : Dimension \\
mas02md@547 491 catfeatures : \seq ~ ( \seq \V) \\
mas02md@547 492 catunits : \seq ~ (\seq \U)
mas02md@547 493 \where
mas02md@547 494 d = f.fdimension \\
mas02md@547 495 catfeatures = map ~ (extract~seg~x) ~ cat \\
mas02md@547 496 catunits = map ~ (extract~seg~ux) ~ cat \\
mas02md@547 497 \end{schema}
mas02md@547 498
mas02md@547 499 \item \textsf{System Instances} - the set of System instances.
mas02md@547 500
mas02md@547 501 Note that every instance must contain a catalogue in the music collection but not all catalogues in the collection will be part of an instance.
mas02md@547 502
mas02md@547 503 \begin{schema}{SystemInstances}
mas02md@547 504 Collection \\
mas02md@547 505 instances : \power Instance
mas02md@547 506 \where
mas02md@547 507 \{ i : instances @ i.cat \} \subseteq collection
mas02md@547 508 \end{schema}
mas02md@547 509
mas02md@547 510 \section{Search}
mas02md@547 511
mas02md@547 512 \item \textsf{Search Vectors}
mas02md@547 513
mas02md@547 514 Searching takes place using concatenations of feature vectors to build \emph{search} vectors. For a particular query all search vectors will have a fixed length equal to some multiple (which we will refer to as $sl$) of the dimension of the orignal feature vectors ($d$).
mas02md@547 515
mas02md@547 516 In the schema below, the function $makesearchvs$ takes a natual number $sl$ and a sequence of feature vectors (associated with a track) to create a sequence of search vectors. The first element of the returned sequence is the concatenation of the first $sl$ feature vectors, the second element is also the concatenation the next $sl$ feature vectors but starting from the second element, and so on until all such sequences are formed. It should be clear that if the original sequence contains $n$ feature vectors then the output will contain $n-sl+1$ vectors.
mas02md@547 517
mas02md@547 518 \begin{flushright}
mas02md@547 519 \begin{tikzpicture}[>=stealth]
mas02md@547 520 \begin{scope}[xshift=-6 cm]
mas02md@547 521 \input track-feature-vectors.tikz
mas02md@547 522 \begin{scope}[yshift=1.1 cm]
mas02md@547 523 \begin{scope}[yshift=1.1 cm,xshift=-1.8cm]
mas02md@547 524 \input fv1.tikz
mas02md@547 525 \draw (-0.1,0) rectangle (0.1,1);
mas02md@547 526 \draw (-0.1,0.2) -- (0.1,0.2);
mas02md@547 527 \draw (-0.1,0.4) -- (0.1,0.4);
mas02md@547 528 \draw (-0.1,0.6) -- (0.1,0.6);
mas02md@547 529 \draw (-0.1,0.8) -- (0.1,0.8);
mas02md@547 530 \end{scope}
mas02md@547 531 \begin{scope}[yshift=2.2 cm,xshift=-1.8cm]
mas02md@547 532 \input fv2.tikz
mas02md@547 533 \draw (-0.1,0) rectangle (0.1,1);
mas02md@547 534 \draw (-0.1,0.2) -- (0.1,0.2);
mas02md@547 535 \draw (-0.1,0.4) -- (0.1,0.4);
mas02md@547 536 \draw (-0.1,0.6) -- (0.1,0.6);
mas02md@547 537 \draw (-0.1,0.8) -- (0.1,0.8);
mas02md@547 538 \end{scope}
mas02md@547 539 \draw[->] (-1.4,1) arc(0:90:0.4 and 0.6);
mas02md@547 540 \draw[->] (-1.0,1) arc(0:90:0.8 and 1.7);
mas02md@547 541 \draw[->] (-1.0,1) arc(0:90:0.4 and 0.6);
mas02md@547 542 \draw[->] (-0.6,1) arc(0:90:0.8 and 1.7);
mas02md@547 543 \end{scope}
mas02md@547 544 \end{scope}
mas02md@547 545 \input interval-index.tikz
mas02md@547 546 \input segmented-track.tikz
mas02md@547 547 % \foreach \x in {-2.5,-2,-1.4,-0.5,0,0.8,1.3,1.8} {
mas02md@547 548 % \begin{scope}[xshift=\x cm,yshift=-0.4 cm]
mas02md@547 549 \foreach \x/\f in {-1.8/fv0,-1.4/fv1,-1.0/fv2,-0.6/fv3,-0.2/fv4,0.2/fv5,0.6/fv6,1.0/fv7} {
mas02md@547 550 \begin{scope}[yshift=1.1 cm,xshift=\x cm]
mas02md@547 551 \input \f.tikz
mas02md@547 552 \end{scope}
mas02md@547 553 }
mas02md@547 554 \foreach \x/\f in {-1.8/fv1,-1.4/fv2,-1.0/fv3,-0.6/fv4,-0.2/fv5,0.2/fv6,0.6/fv7} {
mas02md@547 555 \begin{scope}[yshift=2.1 cm,xshift=\x cm]
mas02md@547 556 \input \f.tikz
mas02md@547 557 \end{scope}
mas02md@547 558 }
mas02md@547 559 \foreach \x/\f in {-1.8/fv2,-1.4/fv3,-1.0/fv4,-0.6/fv5,-0.2/fv6,0.2/fv7} {
mas02md@547 560 \begin{scope}[yshift=3.1 cm,xshift=\x cm]
mas02md@547 561 \input \f.tikz
mas02md@547 562 \end{scope}
mas02md@547 563 }
mas02md@547 564 \foreach \x in {-1.8,-1.4,...,0.3} {
mas02md@547 565 \begin{scope}[xshift=\x cm,yshift=1.1 cm]
mas02md@547 566 \draw (-0.1,0) rectangle (0.1,3);
mas02md@547 567 \foreach \y in {0.2,0.4,...,2.9} {
mas02md@547 568 \draw (-0.1,\y) -- (0.1,\y);
mas02md@547 569 }
mas02md@547 570 \end{scope}
mas02md@547 571 }
mas02md@547 572 \begin{scope}[yshift=1.1 cm]
mas02md@547 573 \draw[<->,>=stealth] (-2.1,0) -- (-2.1,3);
mas02md@547 574 \draw node[anchor=east] at (-2.3,1.5) {$d \times sl$};
mas02md@547 575 \end{scope}
mas02md@547 576 \begin{scope}[yshift=1.1 cm]
mas02md@547 577 \draw[<->,>=stealth] (-2,3.2) -- (0.4,3.2);
mas02md@547 578 \draw node at (-0.8,3.6) {$n - sl + 1$};
mas02md@547 579 \end{scope}
mas02md@547 580 \begin{scope}[xshift=0.6 cm,yshift=1.1 cm]
mas02md@547 581 \draw (-0.1,0) rectangle (0.1,2);
mas02md@547 582 \foreach \y in {0.2,0.4,...,1.9} {
mas02md@547 583 \draw (-0.1,\y) -- (0.1,\y);
mas02md@547 584 }
mas02md@547 585 \draw[dashed] (-0.1,0) -- (-0.3,1);
mas02md@547 586 \draw[dashed] (-0.1,1) -- (-0.3,2);
mas02md@547 587 \draw[dashed] (-0.1,2) -- (-0.3,3);
mas02md@547 588 \end{scope}
mas02md@547 589 \begin{scope}[xshift=1.0 cm,yshift=1.1 cm]
mas02md@547 590 \draw (-0.1,0) rectangle (0.1,1);
mas02md@547 591 \foreach \y in {0.2,0.4,...,0.9} {
mas02md@547 592 \draw (-0.1,\y) -- (0.1,\y);
mas02md@547 593 }
mas02md@547 594 \draw[dashed] (-0.1,0) -- (-0.3,1);
mas02md@547 595 \draw[dashed] (-0.1,1) -- (-0.3,2);
mas02md@547 596 \end{scope}
mas02md@547 597 \foreach \x in {-1.4,-1.0,...,0.3} {
mas02md@547 598 \begin{scope}[xshift=\x cm,yshift=1.1 cm]
mas02md@547 599 \draw[dashed] (-0.1,0) -- (-0.3,1);
mas02md@547 600 \draw[dashed] (-0.1,1) -- (-0.3,2);
mas02md@547 601 \draw[dashed] (-0.1,2) -- (-0.3,3);
mas02md@547 602 \end{scope}
mas02md@547 603 }
mas02md@547 604 \end{tikzpicture}
mas02md@547 605 \end{flushright}
mas02md@547 606
mas02md@547 607 \begin{axdef}
mas02md@547 608 makesearchvs : \nat \fun \seq \Vd \fun \seq \Vdsl
mas02md@547 609 \where
mas02md@547 610 \forall xs : \seq \FV ; sl : \nat @ \\
mas02md@547 611 \t1 sl > \# xs \implies makesearchvs~sl~xs = \langle \rangle \land \\
mas02md@547 612 \t1 sl \leq \# xs \implies makesearchvs~sl~xs = \\
mas02md@547 613 \t2 concat (\langle (0 \upto sl-1) \dres xs \rangle) \cat makesearchvs~sl (tail~xs)
mas02md@547 614 \end{axdef}
mas02md@547 615
mas02md@547 616 \subsection{Identifying Source and Target}
mas02md@547 617
mas02md@547 618 A search vector is made from a source (sequence) and used to match against a user-defined target (instance).
mas02md@547 619
mas02md@547 620 \item \textsf{Source} - a track identified by the user in order to define a search.
mas02md@547 621
mas02md@547 622 \item \textsf{Target} - the instance used to match the source against.
mas02md@547 623
mas02md@547 624 \begin{schema}{IdentifySourceTarget}
mas02md@547 625 source? : Track \\
mas02md@547 626 tgt? : Instance \\
mas02md@547 627 SystemInstances
mas02md@547 628 \where
mas02md@547 629 source? \in tracks \\
mas02md@547 630 tgt? \in instances
mas02md@547 631 \end{schema}
mas02md@547 632
mas02md@547 633 In addition the user can define the part of the source track to be used in the query. This is known as a sequence. A user defines the sequence by specifying the start and end points of the sequence index. (Note that there is an underlying assumption that the segmenter of the target returns a continuous interval index when applied to the source.)
mas02md@547 634
mas02md@547 635 \item \textsf{Track Part} - a continuous sub-section of a track.
mas02md@547 636
mas02md@547 637 \begin{zed}
mas02md@547 638 TrackPart == Track
mas02md@547 639 \end{zed}
mas02md@547 640
mas02md@547 641 \item \textsf{Sequence} - the track part required for the search.
mas02md@547 642
mas02md@547 643 \item \textsf{Sequence Index} - a continuous interval index that defines the sequence.
mas02md@547 644
mas02md@547 645 \item \textsf{Sequence Length} - the number of intervals in the sequence index.
mas02md@547 646
mas02md@547 647 \begin{schema}{IdentifySequence}
mas02md@547 648 IdentifySourceTarget \\
mas02md@547 649 start?, end? : \nat \\
mas02md@547 650 seqindex : ContinuousIntervalIndex \\
mas02md@547 651 sl : \nat \\
mas02md@547 652 sequence : TrackPart
mas02md@547 653 \where
mas02md@547 654 start? \in \dom (tgt?.seg (source?)) \\
mas02md@547 655 end? \in \dom (tgt?.seg (source?)) \\
mas02md@547 656 seqindex = (start? \upto end?) \dres (tgt?.seg~source?) \\
mas02md@547 657 sl = end? - start? \\
mas02md@547 658 \end{schema}
mas02md@547 659
mas02md@547 660 \subsection{Source Search and Feature Vectors}
mas02md@547 661
mas02md@547 662 \item The \textsf{Source Feature Vectors} are the set of feature vectors of the sequence.
mas02md@547 663
mas02md@547 664 \item The \textsf{Source Unit Vectors} are the set of unit vectors of the sequence.
mas02md@547 665
mas02md@547 666 \begin{schema}{SourceFeatureVectors}
mas02md@547 667 IdentifySequence \\
mas02md@547 668 sourcefeatures : \seq \V \\
mas02md@547 669 sourceunits : \seq \U \\
mas02md@547 670 \where
mas02md@547 671 sourcefeatures = extract ~tgt?.seg~tgt?.x~sequence \\
mas02md@547 672 sourceunits = extract ~ tgt?.seg~tgt?.ux~sequence \\
mas02md@547 673 \end{schema}
mas02md@547 674
mas02md@547 675 \item \textsf{Source Search Vector} - the concatenation of the feature vectors of the source sequence.
mas02md@547 676
mas02md@547 677 \item \textsf{Source Unit Search Vector} - the concatenation of the unit vectors of the source sequence.
mas02md@547 678
mas02md@547 679 \begin{schema}{SourceSearchVectors}
mas02md@547 680 SourceFeatureVectors \\
mas02md@547 681 sourcesearch : \Vdsl \\
mas02md@547 682 sourcesearchunits : \Vsl \\
mas02md@547 683 \where
mas02md@547 684 sourcesearch = (head~(makesearchvs~sl~sourcefeatures)) \\
mas02md@547 685 sourcesearchunits = (head~(makesearchvs~sl~sourcefeatures)) \\
mas02md@547 686 \end{schema}
mas02md@547 687
mas02md@547 688 \subsection{Target Search Vectors}
mas02md@547 689
mas02md@547 690 \item \textsf{Target Search Vectors}
mas02md@547 691
mas02md@547 692 We can define these in exactly the same way as for the source, but as we now have a sequence of sequences of search vectors we have to use the map function to apply the $makesearchveors$ to each list
mas02md@547 693
mas02md@547 694 \begin{schema}{TargetSearchVectors}
mas02md@547 695 IdentifySourceTarget \\
mas02md@547 696 IdentifySequence\\
mas02md@547 697 targetsearchvs : \seq (\seq \Vdsl) \\
mas02md@547 698 targetunitsearchvs : \seq (\seq \Vsl) \\
mas02md@547 699 \where
mas02md@547 700 targetsearchvs = \\
mas02md@547 701 \t1 map ~ (makesearchvs ~ sl) ~ tgt?.catfeatures \\
mas02md@547 702 targetunitsearchvs = \\
mas02md@547 703 \t1 map ~ (makesearchvs ~ sl) ~ tgt?.catfeatures \\
mas02md@547 704 \end{schema}
mas02md@547 705
mas02md@547 706 \item \textsf{Hopped Search Vectors}
mas02md@547 707
mas02md@547 708 Rather then generating all possible search vectors we may wish to general vectors starting at equally distanced intervals in the interval index of the tracks in an instance. Re refer to the size of this interval as $hop$.
mas02md@547 709
mas02md@547 710
mas02md@547 711 \begin{axdef}
mas02md@547 712 makehopsearchvs : \nat \fun \nat \fun \seq \Vd \fun \seq \Vdsl
mas02md@547 713 \where
mas02md@547 714 \forall xs : \seq \FV ; sl : \nat ; hop : \nat @ \\
mas02md@547 715 \t1 sl > \# xs \implies makehopsearchvs~sl~hop~xs = \langle \rangle \land \\
mas02md@547 716 \t1 sl \leq \# xs \implies makehopsearchvs~sl~hop~xs = \\
mas02md@547 717 \t2 concat (\langle (0 \upto sl-1) \dres xs \rangle) \cat \\
mas02md@547 718 \t2 makehopsearchvs~sl~hop~ ((0 \upto (hop -1)) \ndres xs)
mas02md@547 719 \end{axdef}
mas02md@547 720
mas02md@547 721 This enables us to define a hop size when generating target search vectors
mas02md@547 722
mas02md@547 723 \begin{schema}{TargetSearchHopVectors}
mas02md@547 724 hop? : \nat \\
mas02md@547 725 TargetSearchVectors \\
mas02md@547 726 targethopsearchvs : \seq (\seq \Vdsl) \\
mas02md@547 727 targethopunitsearchvs : \seq (\seq \Vsl) \\
mas02md@547 728 \where
mas02md@547 729 targethopsearchvs = \\
mas02md@547 730 \t1 map ~ (makehopsearchvs ~sl ~ hop?) ~ tgt?.catfeatures \\
mas02md@547 731 targethopunitsearchvs = \\
mas02md@547 732 \t1 map ~ (makehopsearchvs ~ sl ~ hop?) ~ tgt?.catfeatures \\
mas02md@547 733 \end{schema}
mas02md@547 734
mas02md@547 735 \end{enumerate}
mas02md@547 736
mas02md@547 737
mas02md@547 738 \section{Distance, Power and Duration}
mas02md@547 739
mas02md@547 740 \subsection{Distance of Source Search Vector from Target Search Vector}
mas02md@547 741
mas02md@547 742 We define the scalar product and distance between vectors of equal dimension.
mas02md@547 743
mas02md@547 744 \begin{axdef}
mas02md@547 745 scalarproduct : \V \fun \V \fun \R \\
mas02md@547 746 distance : \V \fun \V \fun \R \\
mas02md@547 747 \end{axdef}
mas02md@547 748
mas02md@547 749 \begin{zed}
mas02md@547 750 \forall v_1, v_2 : \V @ distance~v_1~v_2 = 2 - scalarproduct~v_1~v_2
mas02md@547 751 \end{zed}
mas02md@547 752
mas02md@547 753 Then we can define a variable which maintains a list of all distances between the source search vector and the target search vectors.
mas02md@547 754
mas02md@547 755 \begin{schema}{Distances}
mas02md@547 756 distances : \seq (\seq \R) \\
mas02md@547 757 SourceSearchVectors \\
mas02md@547 758 TargetSearchVectors \\
mas02md@547 759 \where
mas02md@547 760 distances = map (map (distance~sourcesearch)) targetsearchvs
mas02md@547 761 \end{schema}
mas02md@547 762
mas02md@547 763 \subsection{Average `power' of a search feature vector}
mas02md@547 764
mas02md@547 765 For each Search Feature Vector in the target, we take the associated unit values and take the arithmetic mean.
mas02md@547 766
mas02md@547 767 \begin{axdef}
mas02md@547 768 average : \V \fun \R
mas02md@547 769 \end{axdef}
mas02md@547 770
mas02md@547 771 \begin{schema}{Powers}
mas02md@547 772 targetpowers : \seq (\seq \R) \\
mas02md@547 773 sourcepower : \R \\
mas02md@547 774 SourceSearchVectors \\
mas02md@547 775 TargetSearchVectors \\
mas02md@547 776 \where
mas02md@547 777 targetpowers = map~(map ~ average) ~ targetsearchvs\\
mas02md@547 778 sourcepower = head (map~average ~ sourceunits)
mas02md@547 779 \end{schema}
mas02md@547 780
mas02md@547 781 \subsection{Duration of a search feature vector}
mas02md@547 782
mas02md@547 783 Calculate the duration of the sequence for each search vector. (Made from the concatenation of feature vectors each associated with an interval. Add the intervals together to get the duration of the search vector.)
mas02md@547 784
mas02md@547 785 \begin{schema}{Durations}
mas02md@547 786 targetdurations : \seq (\seq \R) \\
mas02md@547 787 sourceduration : \R \\
mas02md@547 788 TargetSearchVectors \\
mas02md@547 789 SourceSearchVectors \\
mas02md@547 790 \end{schema}
mas02md@547 791
mas02md@547 792 \subsection{Compiled Data}
mas02md@547 793
mas02md@547 794 The we have a set of compiled data as follows.
mas02md@547 795
mas02md@547 796 \begin{schema}{CompiledData}
mas02md@547 797 Distances \\
mas02md@547 798 Powers \\
mas02md@547 799 Durations \\
mas02md@547 800 \end{schema}
mas02md@547 801
mas02md@547 802 \section{Refining a Search}
mas02md@547 803 \label{s:refining}
mas02md@547 804
mas02md@547 805 System will first return the index of the track which gives the smallest distance from the source sequence search vector. Suppose this is at (3,4) in the list of lists. This signifies that the closest match is the 3rd track in the catalogue starting at the 4th interval. There are ways of refining the query.
mas02md@547 806
mas02md@547 807 \begin{enumerate}
mas02md@547 808
mas02md@547 809 \item \textsf{Key List} - specify specific tracks within a catalogue to search over.
mas02md@547 810
mas02md@547 811 \item \textsf{Radius} - reject distances which are greater than a given real number radius.
mas02md@547 812
mas02md@547 813 \item \textsf{Absolute} - reject any target search vectors where the `power' average is less than a specific absolute value.
mas02md@547 814
mas02md@547 815 \item \textsf{Relative} - reject any target search vectors where the `power' average is not within + or - a relative value.
mas02md@547 816
mas02md@547 817 \item \textsf{Duration Ratio} - remove any search vectors whose total interval (duration) is sufficiently different from the duration of the source.
mas02md@547 818
mas02md@547 819 \item \textsf{Hop Size} - Rather than making search vectors which start with the first feature vectors and then the second feature vector and so on, make sparser search vectors by starting with fv at 1, then fv at $1 + h$, then fv at $1 + 2h$ and so on where h is the hop size.
mas02md@547 820
mas02md@547 821 \end{enumerate}
mas02md@547 822
mas02md@547 823 We specify what happens when values are given for any of these parameters.
mas02md@547 824
mas02md@547 825 First, we specify a single output as signifiying a track, a starting interval, a distance, a power and a duration
mas02md@547 826
mas02md@547 827 \begin{schema}{Output}
mas02md@547 828 track : Track \\
mas02md@547 829 index : \nat \\
mas02md@547 830 distance : \R \\
mas02md@547 831 duration : \R \\
mas02md@547 832 power : \R \\
mas02md@547 833 \end{schema}
mas02md@547 834
mas02md@547 835 The System outputs are a sequence of such outputs ordered according to distance. We define a new variable which specifies the modified output that the user can make.
mas02md@547 836
mas02md@547 837 \begin{schema}{SystemOutput}
mas02md@547 838 CompiledData \\
mas02md@547 839 output! : \seq Output \\
mas02md@547 840 modifiedoutput! : \seq Output
mas02md@547 841 \where
mas02md@547 842 \forall o_1, o_2 : Output @ \langle o_1, o_2 \rangle \inseq output! \\
mas02md@547 843 \t3 \implies o_1.distance \leq o_2.distance
mas02md@547 844 \end{schema}
mas02md@547 845
mas02md@547 846 \begin{enumerate}
mas02md@547 847
mas02md@547 848 \item Keylist
mas02md@547 849
mas02md@547 850 \begin{schema}{KeyList}
mas02md@547 851 SystemOutput \\
mas02md@547 852 k? : \power Track
mas02md@547 853 \where
mas02md@547 854 modifiedoutput! = output! \filter \{ o : Output | o.track \in k? \}
mas02md@547 855 \end{schema}
mas02md@547 856
mas02md@547 857 \item Radius
mas02md@547 858
mas02md@547 859 The system removes any elements which have a distance greater than the radius.
mas02md@547 860
mas02md@547 861 \begin{schema}{Radius}
mas02md@547 862 SystemOutput \\
mas02md@547 863 r? : \R \\
mas02md@547 864 \where
mas02md@547 865 modifiedoutput! = \\
mas02md@547 866 \t1 output! \filter \{ o : Output | o.distance \leq r? \}
mas02md@547 867 \end{schema}
mas02md@547 868
mas02md@547 869 \item Absolute
mas02md@547 870
mas02md@547 871 \begin{schema}{Absolute}
mas02md@547 872 SystemOutput \\
mas02md@547 873 a? : \R \\
mas02md@547 874 \where
mas02md@547 875 modifiedoutput! = \\
mas02md@547 876 \t1 output! \filter \{ o : Output | o.power \geq a? \}
mas02md@547 877 \end{schema}
mas02md@547 878
mas02md@547 879 \item Relative
mas02md@547 880
mas02md@547 881 %% \begin{axdef}
mas02md@547 882 %% abs : \R \fun \R
mas02md@547 883 %% \end{axdef}
mas02md@547 884
mas02md@547 885
mas02md@547 886 \begin{schema}{Relative}
mas02md@547 887 SystemOutput \\
mas02md@547 888 rel? : \R \\
mas02md@547 889 \where
mas02md@547 890 modifiedoutput! = \\
mas02md@547 891 \t1 output! \filter \{ o : Output | abs (o.power - sourcepower) \leq rel? \}
mas02md@547 892 \end{schema}
mas02md@547 893
mas02md@547 894 \item Duration Ratio
mas02md@547 895
mas02md@547 896 %%unchecked
mas02md@547 897 \begin{schema}{DurationRatio}
mas02md@547 898 SystemOutput \\
mas02md@547 899 d? : \R \\
mas02md@547 900 \where
mas02md@547 901 modifiedoutput! = \\
mas02md@547 902 \t1 output! \filter \{ o : Output | \exp ^ {abs \ln (\frac{o.duration}{sourceduration})} \leq d? \}
mas02md@547 903 \end{schema}
mas02md@547 904
mas02md@547 905 \item Hop Size
mas02md@547 906
mas02md@547 907 \begin{schema}{Hop}
mas02md@547 908 hop? : \nat \\
mas02md@547 909 SystemOutput \\
mas02md@547 910 TargetSearchHopVectors \\
mas02md@547 911 \end{schema}
mas02md@547 912
mas02md@547 913 \end{enumerate}
mas02md@547 914
mas02md@547 915 \section{Setting Thresholds}
mas02md@547 916
mas02md@547 917 \subsection{For an Instance}
mas02md@547 918
mas02md@547 919 \begin{enumerate}
mas02md@547 920 \item Guess several lengths based on understanding of the instance (beat, bar, phrase, section). ($sl$)
mas02md@547 921 \item Generate all sequences of length ($sl$) from the tracks in the instance
mas02md@547 922 \item Select pairs of sequences of length ($sl$) which may or may not be from the same track randomly from the instance, compute distance between these pairs, and repeat a fixed number of times.
mas02md@547 923 \item Tabulate distances
mas02md@547 924 \item Scary maths
mas02md@547 925 \item Obtain a global threshold
mas02md@547 926 \item Set the radius threshold equal to this value
mas02md@547 927 \end{enumerate}
mas02md@547 928
mas02md@547 929 \subsection{For a Source Sequence and a Target Instance (I)}
mas02md@547 930
mas02md@547 931 \begin{enumerate}
mas02md@547 932 \item Take the length of the source sequence ($sl$)
mas02md@547 933 \item Generate all sequences of length ($sl$) from the tracks in the instance
mas02md@547 934 \item Select a sequence randomly, calculate the distance form the source sequence, and repeat a fixed number of times.
mas02md@547 935 \item Tabulate distances
mas02md@547 936 \item Scary maths
mas02md@547 937 \item Obtain a threshold for this sequence/instance pair
mas02md@547 938 \item Set the radius threshold equal to this value
mas02md@547 939 \end{enumerate}
mas02md@547 940
mas02md@547 941 \subsection{For a Source Track and a Target Instance (II)}
mas02md@547 942
mas02md@547 943 \begin{enumerate}
mas02md@547 944 \item Choose a length $sl$ which is less than the track length
mas02md@547 945 \item Generate all sequences of length ($sl$) from the tracks in the instance
mas02md@547 946 \item Generate all sequences of length ($sl$) from the source sequence
mas02md@547 947 \item Select one of these source sequences randomly and one of the sequences from one of the tracks in the instance randomly, calculate the distance form the source sequence, and repeat a fixed number of times.
mas02md@547 948 \item Tabulate distances
mas02md@547 949 \item Scary maths
mas02md@547 950 \item Obtain a threshold for this track/instance pair
mas02md@547 951 \item Set the radius threshold equal to this value
mas02md@547 952 \end{enumerate}
mas02md@547 953
mas02md@547 954 \appendix
mas02md@547 955 \section{Auxillary Definitions}
mas02md@547 956
mas02md@547 957 \subsection{The function $map$}
mas02md@547 958
mas02md@547 959 This requires need the generic function map, which takes a function and applies it to every element of a list.
mas02md@547 960
mas02md@547 961 %%unchecked
mas02md@547 962 \begin{gendef}[X,Y]
mas02md@547 963 map : (X \fun Y) \fun (\seq X) \fun (\seq Y) \\
mas02md@547 964 \where
mas02md@547 965 \forall f : X \fun Y; x : X; xs,ys : \seq X @ \\
mas02md@547 966 \t1 map~f~\langle \rangle = \langle \rangle \land \\
mas02md@547 967 \t1 map~f~(xs \cat ys) = map~f~xs \cat map~f~ys
mas02md@547 968 \end{gendef}
mas02md@547 969
mas02md@547 970
mas02md@547 971 \subsection{The function $concat$}
mas02md@547 972
mas02md@547 973 We can do this by making use of the following generic function that takes a list of lists of lists, and concatenates each of the lists together.
mas02md@547 974
mas02md@547 975 %%unchecked
mas02md@547 976 \begin{gendef}[X]
mas02md@547 977 concat : (\seq (\seq X)) \fun (\seq X)
mas02md@547 978 \where
mas02md@547 979 \forall xs : \seq X; xss : \seq (\seq X) @ \\
mas02md@547 980 \t2 concat~ ((\langle xs \rangle) \cat xss) = xs \cat
mas02md@547 981 (concat~xss)
mas02md@547 982 \end{gendef}
mas02md@547 983
mas02md@547 984 \section{Probabilty of chosing a track}
mas02md@547 985
mas02md@547 986 The longer the track in a target the more sequences it will contain with the same number of intervals with length ($sl$). Therefore the probability of selecting a track is weighted. Once a track has been selected then a sequence within the track is chosen uniformly.
mas02md@547 987
mas02md@547 988 %% \begin{axdef}
mas02md@547 989 %% sum : \power \R \fun \R
mas02md@547 990 %% \end{axdef}
mas02md@547 991
mas02md@547 992 %% \begin{axdef}
mas02md@547 993 %% pairmax : \R \cross \R \fun \R
mas02md@547 994 %% \end{axdef}
mas02md@547 995
mas02md@547 996 %%unchecked
mas02md@547 997 \begin{schema}{CalculateProbabilities}
mas02md@547 998 i : Instance \\
mas02md@547 999 sl : \nat \\
mas02md@547 1000 allslsequences : \nat \\
mas02md@547 1001 SystemInstances \\
mas02md@547 1002 prob : Track \fun \R \also
mas02md@547 1003 \where
mas02md@547 1004 allslsequences = \\
mas02md@547 1005 \t1 sum \{ t : Track @ pairmax ( (length (i.seg~t) - sl + 1), 0 ) \} \also
mas02md@547 1006 \forall t : Track @ prob~t = \frac{length (i.seg~t) - sl + 1}{ allslsequences}
mas02md@547 1007 \end{schema}
mas02md@547 1008
mas02md@547 1009 This uses a function $subsequences$ which takes a sequence of elements $s$ and a natural number $n$ and returns the number of contiguous sequences of length $n$ and a function $sumseq$ which sums the elements in a list.
mas02md@547 1010
mas02md@547 1011 \section{Examples illustrating functions}
mas02md@547 1012
mas02md@547 1013 \subsection{Track Extract}
mas02md@547 1014
mas02md@547 1015 Given a segmenter, an extractor, and a track, the function $extract$ returns a list of feature vectors for that track. Each feature vector has equal dimension, and each vector corresponds to the equivalent interval in the interval index. As an example, if the feature vectors have dimension $d$, and if there are $m$ intervals defined by the segmenter, and if we adopt the convention that $\V$ represents a vector of length d, this function would return something with the following form:
mas02md@547 1016
mas02md@547 1017 \[ \langle V_{1}^{d}, V_{2}^{d} \dots V_{m}^{d} \rangle \]
mas02md@547 1018
mas02md@547 1019 When we apply this function to every track in a catalogue (which is a list of tracks) we simply determine a list of such lists. If there are $n$ tracks in a catalogue then our data would look something like the following.
mas02md@547 1020
mas02md@547 1021 \[ catfeatures = \langle ~~ \langle V_{11}^{d}, V_{12}^{d} \dots V_{1m_{1}}^{d} \rangle \\
mas02md@547 1022 \t3 ~~~ \langle V_{21}^{d}, V_{22}^{d} \dots V_{2m_{2}}^{d} \rangle \\
mas02md@547 1023 \t3 \dots \\
mas02md@547 1024 \t3 \dots \\
mas02md@547 1025 \t3 ~~~ \langle V_{n1}^{d}, V_{n2}^{d} \dots V_{nm_{n}}^{d} \rangle
mas02md@547 1026 ~~ \rangle
mas02md@547 1027 ~~ \]
mas02md@547 1028
mas02md@547 1029 The unit vector data has exactly the same structure but with different vectors all of dimension 1.
mas02md@547 1030
mas02md@547 1031 \[ catunits = \langle ~~ \langle V_{11}^{1}, V_{12}^{1} \dots V_{1m_{1}}^{1} \rangle \\
mas02md@547 1032 \t4 ~~ \langle V_{21}^{1}, V_{22}^{1} \dots V_{2m_{2}}^{1} \rangle \\
mas02md@547 1033 \t4 \dots \\
mas02md@547 1034 \t4 \dots \\
mas02md@547 1035 \t4 ~~~ \langle V_{n1}^{1}, V_{n2}^{1} \dots V_{nm_{n}}^{1} \rangle
mas02md@547 1036 ~~ \rangle
mas02md@547 1037 ~~ \]
mas02md@547 1038
mas02md@547 1039 \subsection{Making Search Vectors}
mas02md@547 1040
mas02md@547 1041 Suppose we had the following feature vectors for a track.
mas02md@547 1042
mas02md@547 1043 \[ \langle V_{1}^{d}, V_{2}^{d} , V_{3}^{d} \rangle \]
mas02md@547 1044
mas02md@547 1045 Also suppose that our sequence length $sl$ had a value of 2 and we applied the function $makesearchvs$. We would then make search vectors as follows.
mas02md@547 1046
mas02md@547 1047 \[ \t3 \langle V_{1}^{d} \cat V_{2}^{d} , V_{2}^{d} \cat V_{3}^{d} \rangle \]
mas02md@547 1048
mas02md@547 1049 \end{document}
mas02md@547 1050