public static DiscordRecords series2Discords(double[] series, int discordsNumToReport,
      int windowSize, int paaSize, int alphabetSize, NumerosityReductionStrategy strategy,
      double nThreshold) throws Exception {

    // fix the start time
    Date start = new Date();

    // get the SAX transform done
    NormalAlphabet normalA = new NormalAlphabet();
    SAXRecords sax = sp.ts2saxViaWindow(series, windowSize, paaSize, normalA.getCuts(alphabetSize),
        strategy, nThreshold);
    Date saxEnd = new Date();
    LOGGER.debug("discretized in {}, words: {}, indexes: {}",
        SAXProcessor.timeToString(start.getTime(), saxEnd.getTime()), sax.getRecords().size(),
        sax.getIndexes().size());

    // fill the array for the outer loop
    ArrayList<MagicArrayEntry> magicArray = new ArrayList<MagicArrayEntry>(sax.getRecords().size());
    for (SAXRecord sr : sax.getRecords()) {
      magicArray.add(new MagicArrayEntry(String.valueOf(sr.getPayload()), sr.getIndexes().size()));
    }
    Date hashEnd = new Date();
    LOGGER.debug("Magic array filled in : {}",
        SAXProcessor.timeToString(saxEnd.getTime(), hashEnd.getTime()));

    DiscordRecords discords = getDiscordsWithMagic(series, sax, windowSize, magicArray,
        discordsNumToReport, nThreshold);

    Date end = new Date();

    LOGGER.debug("{} discords found in {}", discords.getSize(),
        SAXProcessor.timeToString(start.getTime(), end.getTime()));

    return discords;
  }
public static DiscordRecords series2Discords ( double [ ] series , int discordsNumToReport , int windowSize , int paaSize , int alphabetSize , NumerosityReductionStrategy strategy , double nThreshold ) throws Exception { Date start = new Date ( ) ; NormalAlphabet normalA = new NormalAlphabet ( ) ; SAXRecords sax = sp . ts2saxViaWindow ( series , windowSize , paaSize , normalA . getCuts ( alphabetSize ) , strategy , nThreshold ) ; Date saxEnd = new Date ( ) ; LOGGER . debug ( "discretized in {}, words: {}, indexes: {}" , SAXProcessor . timeToString ( start . getTime ( ) , saxEnd . getTime ( ) ) , sax . getRecords ( ) . size ( ) , sax . getIndexes ( ) . size ( ) ) ; ArrayList < MagicArrayEntry > magicArray = new ArrayList < MagicArrayEntry > ( sax . getRecords ( ) . size ( ) ) ; for ( SAXRecord sr : sax . getRecords ( ) ) { magicArray . add ( new MagicArrayEntry ( String . valueOf ( sr . getPayload ( ) ) , sr . getIndexes ( ) . size ( ) ) ) ; } Date hashEnd = new Date ( ) ; LOGGER . debug ( "Magic array filled in : {}" , SAXProcessor . timeToString ( saxEnd . getTime ( ) , hashEnd . getTime ( ) ) ) ; DiscordRecords discords = getDiscordsWithMagic ( series , sax , windowSize , magicArray , discordsNumToReport , nThreshold ) ; Date end = new Date ( ) ; LOGGER . debug ( "{} discords found in {}" , discords . getSize ( ) , SAXProcessor . timeToString ( start . getTime ( ) , end . getTime ( ) ) ) ; return discords ; }
Hash-table backed implementation (in contrast to trie). Time series is converted into a
SAXRecords data structure first, Hash-table backed magic array created second. HOTSAX applied
third. Nearest neighbors are searched only among the subsequences which were produced by SAX
with specified numerosity reduction. Thus, if the strategy is EXACT or MINDIST, discords do not
match those produced by BruteForce or NONE.

@param series The timeseries.
@param discordsNumToReport The number of discords to report.
@param windowSize SAX sliding window size.
@param paaSize SAX PAA value.
@param alphabetSize SAX alphabet size.
@param strategy the numerosity reduction strategy.
@param nThreshold the normalization threshold value.
@return The set of discords found within the time series, it may return less than asked for --
in this case, there are no more discords.
@throws Exception if error occurs., currentPos + windowSize