public function discretizeTimeSeries( array $pTimeSeries, $pFeatureWindowLength = 1 ) {
        $nrOfBreakpoints = $this->alphabetSize - 1;
        $breakpoints     = $this->breakpoints[$nrOfBreakpoints];

        $saxWord         = "";

        // discretize reference time series
        for ( $i=0; $i < count( $pTimeSeries ); $i+=$pFeatureWindowLength ) { 
            $datapoint = $pTimeSeries[$i]['count'];

            // dimensionality reduction using mean
            for ( $j=$i+1; $j < $pFeatureWindowLength; $j++ ) { 
                $datapoint += $pTimeSeries[$j]['count'];
            }
            $datapoint /= $pFeatureWindowLength;

            // discretize to sax word using breakpoints        
            for ( $z=0; $z < $nrOfBreakpoints + 1; $z++ ) {
                if ( isset( $breakpoints[$z] ) && $datapoint < $breakpoints[$z] ) {
                    // found first matching interval 
                    $saxWord .= $this->alphabet[$z];
                    break;
                } elseif ( $z === $nrOfBreakpoints ) {
                    // last datapoint, is greater than the last breakpoint
                    $saxWord .= $this->alphabet[$z];
                }
            }
        }

        return $saxWord;
    }
public function discretizeTimeSeries( array $pTimeSeries, $pFeatureWindowLength = 1 ) {
        $nrOfBreakpoints = $this->alphabetSize - 1;
        $breakpoints     = $this->breakpoints[$nrOfBreakpoints];

        $saxWord         = "";

        // discretize reference time series
        for ( $i=0; $i < count( $pTimeSeries ); $i+=$pFeatureWindowLength ) { 
            $datapoint = $pTimeSeries[$i]['count'];

            // dimensionality reduction using mean
            for ( $j=$i+1; $j < $pFeatureWindowLength; $j++ ) { 
                $datapoint += $pTimeSeries[$j]['count'];
            }
            $datapoint /= $pFeatureWindowLength;

            // discretize to sax word using breakpoints        
            for ( $z=0; $z < $nrOfBreakpoints + 1; $z++ ) {
                if ( isset( $breakpoints[$z] ) && $datapoint < $breakpoints[$z] ) {
                    // found first matching interval 
                    $saxWord .= $this->alphabet[$z];
                    break;
                } elseif ( $z === $nrOfBreakpoints ) {
                    // last datapoint, is greater than the last breakpoint
                    $saxWord .= $this->alphabet[$z];
                }
            }
        }

        return $saxWord;
    }
public function discretizeTimeSeries ( array $ pTimeSeries , $ pFeatureWindowLength = 1 ) { $ nrOfBreakpoints = $ this -> alphabetSize - 1 ; $ breakpoints = $ this -> breakpoints [ $ nrOfBreakpoints ] ; $ saxWord = "" ; // discretize reference time series for ( $ i = 0 ; $ i < count ( $ pTimeSeries ) ; $ i += $ pFeatureWindowLength ) { $ datapoint = $ pTimeSeries [ $ i ] [ 'count' ] ; // dimensionality reduction using mean for ( $ j = $ i + 1 ; $ j < $ pFeatureWindowLength ; $ j ++ ) { $ datapoint += $ pTimeSeries [ $ j ] [ 'count' ] ; } $ datapoint /= $ pFeatureWindowLength ; // discretize to sax word using breakpoints         for ( $ z = 0 ; $ z < $ nrOfBreakpoints + 1 ; $ z ++ ) { if ( isset ( $ breakpoints [ $ z ] ) && $ datapoint < $ breakpoints [ $ z ] ) { // found first matching interval  $ saxWord .= $ this -> alphabet [ $ z ] ; break ; } elseif ( $ z === $ nrOfBreakpoints ) { // last datapoint, is greater than the last breakpoint $ saxWord .= $ this -> alphabet [ $ z ] ; } } } return $ saxWord ; }
Discretizes a given time series to a "sax word", i.e. a sequence
of characters indicating the amplitude of the time series.
@param  array   $pTimeSeries         Time series to discretize
@param  integer $pFeatureWindowLength Amount of datapoints which will used as a single
datapoint (by computing the mean), default is one
@return string                       The sax word
Discretizes a given time series to a sax word i . e . a sequence of characters indicating the amplitude of the time series .