@Override public HashMap<Integer, char[]> call() throws Exception { NormalAlphabet na = new NormalAlphabet(); TSProcessor tsp = new TSProcessor(); char[] currentString = tsp.ts2String(paa, na.getCuts(this.saxAlphabetSize));
/** * Constructor. */ public SAXProcessor() { super(); this.tsProcessor = new TSProcessor(); this.na = new NormalAlphabet(); this.ed = new EuclideanDistance(); }
int windowCounter = 0; double[] centralLines = na.getCentralCuts(alphabetSize); double[] cuts = na.getCuts(alphabetSize);
String sax = String.valueOf(tp.ts2String( tp.paa(tp.znorm(tp.subseriesByCopy(series, i, i + motifSize), znormThreshold), paaSize), normalA.getCuts(alphabetSize))); if (null == buckets.get(sax)) { buckets.put(sax, new ArrayList<Integer>()); double[][] dm = normalA.getDistanceMatrix(alphabetSize); int currBucketIdx = 0;
private static SAXRecords discretize(double[] series) throws SAXException { consoleLogger.info("Performing SAX conversion ..."); if (TS2GrammarParameters.NUM_WORKERS <= 1) { return sp.ts2saxViaWindow(series, TS2GrammarParameters.SAX_WINDOW_SIZE, TS2GrammarParameters.SAX_PAA_SIZE, na.getCuts(TS2GrammarParameters.SAX_ALPHABET_SIZE), TS2GrammarParameters.SAX_NR_STRATEGY, TS2GrammarParameters.SAX_NORM_THRESHOLD); } else { return psax.process(series, TS2GrammarParameters.NUM_WORKERS, TS2GrammarParameters.SAX_WINDOW_SIZE, TS2GrammarParameters.SAX_PAA_SIZE, TS2GrammarParameters.SAX_ALPHABET_SIZE, TS2GrammarParameters.SAX_NR_STRATEGY, TS2GrammarParameters.SAX_NORM_THRESHOLD); } }
/** * Constructor. */ public SAXProcessor() { super(); this.tsProcessor = new TSProcessor(); this.na = new NormalAlphabet(); this.ed = new EuclideanDistance(); }
int windowCounter = 0; double[] centralLines = na.getCentralCuts(alphabetSize); double[] cuts = na.getCuts(alphabetSize);
String sax = String.valueOf(tp.ts2String( tp.paa(tp.znorm(tp.subseriesByCopy(series, i, i + motifSize), znormThreshold), paaSize), normalA.getCuts(alphabetSize))); if (null == buckets.get(sax)) { buckets.put(sax, new ArrayList<Integer>()); double[][] dm = normalA.getDistanceMatrix(alphabetSize); int currBucketIdx = 0;
SAXRecords saxData = ts2saxViaWindow(series, windowSize, paaSize, na.getCuts(alphabetSize), strategy, nrThreshold);
@Override public HashMap<Integer, char[]> call() throws Exception { NormalAlphabet na = new NormalAlphabet(); TSProcessor tsp = new TSProcessor(); char[] currentString = tsp.ts2String(paa, na.getCuts(this.saxAlphabetSize));
private static double[] seriesValuesAsHeat(double[] series, String className, HashMap<String, HashMap<String, Double>> tfidf, Params params) throws Exception { Alphabet a = new NormalAlphabet(); double[] weights = new double[series.length]; HashMap<String, Integer> words = new HashMap<String, Integer>(); for (int i = 0; i <= series.length - params.getWindowSize(); i++) { double[] subseries = tsp.subseriesByCopy(series, i, i + params.getWindowSize()); double[] paa = tsp.paa(tsp.znorm(subseries, params.getnThreshold()), params.getPaaSize()); char[] sax = tsp.ts2String(paa, a.getCuts(params.getAlphabetSize())); words.put(String.valueOf(sax), i); } for (Entry<String, HashMap<String, Double>> e : tfidf.entrySet()) { for (Entry<String, Double> e1 : e.getValue().entrySet()) { if (words.containsKey(e1.getKey())) { int idx = words.get(e1.getKey()); double increment = 0.0; if (className.equalsIgnoreCase(e.getKey())) { increment = e1.getValue(); } else { // increment = -e1.getValue(); } for (int i = 0; i < params.getWindowSize(); i++) { weights[idx + i] = weights[idx + i] + increment; } } } } return weights; }
SAXRecords saxData = ts2saxViaWindow(series, windowSize, paaSize, na.getCuts(alphabetSize), strategy, nrThreshold);
NormalAlphabet na = new NormalAlphabet(); SAXProcessor sp = new SAXProcessor(); res = sp.ts2saxViaWindow(ts, slidingWindowSize, paaSize, na.getCuts(alphabetSize), nrStrategy, nThreshold);
private static Map<Integer, Integer[]> getPatternLocationsForTheClass(String className, Map<String, List<double[]>> trainData, String pattern, Params params) throws IndexOutOfBoundsException, Exception { Alphabet a = new NormalAlphabet(); Map<Integer, Integer[]> res = new HashMap<Integer, Integer[]>(); int seriesCounter = 0; for (double[] series : trainData.get(className)) { List<Integer> arr = new ArrayList<Integer>(); for (int i = 0; i <= series.length - params.getWindowSize(); i++) { double[] paa = tsp.paa(tsp.znorm(tsp.subseriesByCopy(series, i, i + params.getWindowSize()), params.getnThreshold()), params.getPaaSize()); char[] sax = tsp.ts2String(paa, a.getCuts(params.getAlphabetSize())); if (pattern.equalsIgnoreCase(String.valueOf(sax))) { arr.add(i); } } res.put(seriesCounter, arr.toArray(new Integer[0])); seriesCounter++; } return res; } }
char[] currentString = tp.ts2String(paa, normalA.getCuts(A_SIZE));
NormalAlphabet na = new NormalAlphabet(); SAXProcessor sp = new SAXProcessor(); res = sp.ts2saxViaWindow(ts, slidingWindowSize, paaSize, na.getCuts(alphabetSize), nrStrategy, nThreshold);
NormalAlphabet normalA = new NormalAlphabet(); SAXRecords sax = sp.ts2saxViaWindow(series, windowSize, alphabetSize, normalA.getCuts(alphabetSize), strategy, nThreshold); Date saxEnd = new Date(); LOGGER.debug("discretized in {}, words: {}, indexes: {}",
NormalAlphabet normalA = new NormalAlphabet(); SAXRecords sax = sp.ts2saxViaWindow(series, windowSize, paaSize, normalA.getCuts(alphabetSize), strategy, nThreshold); Date saxEnd = new Date();
NormalAlphabet normalA = new NormalAlphabet(); SAXRecords sax = sp.ts2saxViaWindow(series, windowSize, alphabetSize, normalA.getCuts(alphabetSize), strategy, nThreshold); Date saxEnd = new Date(); LOGGER.debug("discretized in {}, words: {}, indexes: {}",
NormalAlphabet na = new NormalAlphabet(); SAXProcessor sp = new SAXProcessor(); @SuppressWarnings("unused") SAXRecords sequentialRes = sp.ts2saxViaWindow(ts, slidingWindowSize, paaSize, na.getCuts(alphabetSize), NumerosityReductionStrategy.fromString(nrStrategy), N_THRESHOLD);