Questions tagged [sliding-window]

In data analysis, sliding windows are advancing sub-lists inside lists which allow, e.g., computation of a record's change from the previous record or next record. In networking, a sliding window may refer to a flow control technique that maintains windows of sequential frames sent or received without a corresponding acknowledgement.

In data analysis, sliding windows are advancing sub-lists inside lists which allow, e.g., computation of a record's change from the previous record or next record. In SQL in particular, the analytic functions LEAD(), LAG(), and computations OVER() a changing subset of query results involve sliding windows.

In networking, a sliding window may refer to a flow control technique that maintains windows of sequential frames sent or received without a corresponding acknowledgement.

583 questions
2
votes
2 answers

SVM with rolling window

I have a code which predict the change in the sign of future returns. library(quantmod) library(PerformanceAnalytics) library(forecast) library(e1071) library(caret) library(kernlab) library(dplyr) library(roll) # get data yahoo…
Tony
  • 41
  • 4
2
votes
2 answers

What is the most efficient way to match templates in a Numpy array?

I have a numpy array of size 2000*4000 with binary values in it. I have a template that I would like to match with my source array. Currently I'm running a sliding window over the source array. Although this method works fine, it's very time…
Akas Antony
  • 739
  • 1
  • 8
  • 19
2
votes
2 answers

Speed up distance calculations, sliding window

I have two time series A and B. A with length m and B with length n. m << n. Both have the dimension d. I calculate the distance between A and all subsequencies in B by sliding A over B. In python the code looks like this. def sliding_dist(A,B) …
Carl Rynegardh
  • 538
  • 1
  • 5
  • 22
2
votes
2 answers

Cant acess the values from my sliding window?

I am currently implementing a sliding window functionality for a vector. Problem is I cant seem to cout the values? When I output it i seem to get memeory location, rather than the actual values.. I need to process the data which the window…
Lamda
  • 914
  • 3
  • 13
  • 39
2
votes
1 answer

padding numpy rolling window operations using strides

I have a function f that I would like to efficiently compute in a sliding window. def efficient_f(x): # do stuff wSize=50 return another_f(rolling_window_using_strides(x, wSize), -1) I have seen on SO that is particularly efficient to do…
00__00__00
  • 4,834
  • 9
  • 41
  • 89
2
votes
1 answer

Sliding window functions in SQL Server, advanced calculation

I have a problem that it's very easy to be solved in C# code for example, but I have no idea how to write in a SQL query. Here is the situation: let's say I have a table with 3 columns (ID, Date, Amount), and here is some data: ID Date …
Stefan Taseski
  • 242
  • 2
  • 24
2
votes
1 answer

Trying to calculate the mean of a sliding window of an image Python

I'm trying to pixelate (\mosaic) an image by calculate the mean of a (non overlap) sliding window over the image. For this I try to implement a "window size" and a "step" parameters. Assuming my step won't exceed the image border. Means that if my…
2
votes
1 answer

Sliding window of 50% overlap with a Pandas DataFrame

Say I have a data frame like this: x y z timestamp some_date_1 5 2 4 some_date_2 1 2 6 some_date_3 7 3 5 ... some_date_50 4 3 6 and I want to apply a sliding window of size 10 (call this a variable…
user2398046
2
votes
2 answers

Error using sub2ind (line 52) Out of range subscript Matlab

I used the same code for two different input matrices, In both cases i will call it "the input matrix A" The first case is a 7000X4 The second case is a 29500X12 I need to split a selected column in windows and then for each window i need to…
Andrea Ciufo
  • 359
  • 1
  • 3
  • 19
2
votes
1 answer

Skipping the sliding window

Given [1,2,3,4,5,6,7,8,9,10], to get a sliding window of 3 items at a time to get: [(1, 2, 3), (2, 3, 4), (3, 4, 5), (4, 5, 6), (5, 6, 7), (6, 7, 8), (7, 8, 9), (8, 9, 10)] From https://stackoverflow.com/q/42220614/610569, a sliding window of a…
alvas
  • 115,346
  • 109
  • 446
  • 738
2
votes
1 answer

Sliding window for splitting a ndarray into smaller overlapping ndarrays

I am currently working out a method in which I can split a numpy.ndarray into a given number of sub-arrays, as long the number is less than the the axis which the window moves along. Example: Given an numpy.ndarray with shape (15, 40, 3) I want to…
ülé
  • 41
  • 5
2
votes
3 answers

Python Sliding Window on sentence string

I'm looking for a sliding window splitter of string composed with words with window size N. Input: "I love food and I like drink" , window size 3 Output: [ "I love food", "love food and", "food and I", "and I like" .....] All the suggestions of…
user1025852
  • 2,684
  • 11
  • 36
  • 58
2
votes
1 answer

Rolling subset of data frame within for loop in R

Big picture explanation is I am trying to do a sliding window analysis on environmental data in R. I have PAR (photosynthetically active radiation) data for a select number of sequential dates (pre-determined based off other biological factors) for…
Tayler.M
  • 23
  • 3
2
votes
1 answer

Create overlapping and non-overlapping sliding windows in MATLAB

I am trying to create overlapping and non-overlapping blocks of data from an array Data containingN elements. How can I correctly form sub-arrays of Data for any N and any blksze? The following code is for non-overlapping blocks throws error because…
SKM
  • 959
  • 2
  • 19
  • 45
2
votes
1 answer

How to call a function on the slices of a vectorized sliding window?

I'm trying to vectorize a sliding window search for object detection. So far I have been able to use numpy broadcasting to slice my main image into window sized slices that I have stored in the variable all_windows seen below. I have verified that…