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
1 answer

python sqlite string comparison

I have got an sqlite database with multiple rows in a table. One of the colums holds strings with an arbitrary amount of positive integers, so: 1: '### ## # # # ## # ##' 2: '# ## # ## # ##' 3: '# # # ## ## ### #' ... I have also gotten a comparison…
2
votes
2 answers

Applying np.where in a sliding window

I have an array of True/False values which I want to use as a repeating mask over another array of a different shape. import numpy as np mask = np.array([[ True, True], [False, True]]) array = np.random.randint(10, size=(64,…
Minn
  • 5,688
  • 2
  • 15
  • 42
2
votes
1 answer

A kind of sliding window

This function comes from some code to calculate convolutions of finite sequences. window n k = [ drop (i-k) $ take i $ [1..n] | i <- [1..(n+k)-1] ] *Main> window 4 6 [[1],[1,2],[1,2,3],[1,2,3,4],[1,2,3,4],[1,2,3,4],[2,3,4],[3,4],[4]] It's sliding…
Theo H
  • 131
  • 10
2
votes
1 answer

How to create multiple images from a single image using strides?

I have an image and I want to split it into multiple images using vertical and horizontal strides like a sliding window and the resultant images will all be of same resolution. How can I do that efficiently in Python? I have done this much: from PIL…
2
votes
1 answer

(R) How to exclude each current row's value from slide_index()'s window?

Hi I'm using slide_index() to capture values in a time window for every row in a dataframe. However, for every row I'll also be comparing the value of the current row against the captured values for that row's window. Part of the logic I'm using…
2
votes
3 answers

Generate adjacent elements from List

I want to generate contiguous sliding window from a list nums = [1,2,3,4,10] ####O/P [[1, 2], [2, 3], [3, 4], [4, 10]] My code so far - >>> num_list = [1,2,3,4,10] >>> >>> res = [] >>> n = len(num_list) >>> >>> for i in range(n): ... imm =…
user15115588
2
votes
1 answer

Assigning the numbers and summarising the number of counts in a sliding window in R

I have a df that looks like this: df <- (c( "P", "S", "E", "G", "R", "Q", "P", "S", "P", "S", "P", "S", "P", "T", "E", "R", "A", "P", "A", "S", "E", "E", "E", "F", "Q", "F", "L", "R", "C", "Q", "Q", "C", "Q", "A", "E", "A", "K", "C", "P", "K",…
student24
  • 252
  • 1
  • 9
2
votes
1 answer

T-SQL count number of events in a time window

I have a Login Table like this: Date,UserID 2020-08-01,1 2020-09-01,1 2020-09-07,2 2020-10-01,3 2020-10-12,4 2020-10-25,1 Basically, every time a user logins to my application, it register the date and the userID. I need to know the number of…
Wilmar
  • 558
  • 1
  • 5
  • 16
2
votes
2 answers

Clickhouse: Sliding / moving window

I'm looking for an efficient way on how to query the n past values as array in ClickHouse for each row ordered by one column (i.e. Time), where the values should be retrieved as array. Window functions are still not supported in ClickHouse (see…
1RB
  • 23
  • 1
  • 4
2
votes
1 answer

Pyspark count on any sliding window for any ID

I have a data frame of customer digital visit over time in the form: |cust_id|datetime| |1|2020-08-15 15:20| |1|2020-08-15 16:20| |1|2020-08-17 12:20| |1|2020-08-19 14:20| |1|2020-08-23 09:20| |2|2020-08-24 08:00| I'd like to pick out strong…
Kenny
  • 1,902
  • 6
  • 32
  • 61
2
votes
2 answers

View on Julia array using sliding window

What is the most efficient way to create a view on array using, for example, sliding window=2 Let's say we have: x = collect(1:1:6) # 1 2 3 4 5 6 And I want to create a view like this: # 1 2 # 2 3 # 3 4 # 4 5 # 5 6 So far I found only this option,…
2
votes
2 answers

Given two integers m and n, where m >= n, how can you create a generator to return all the sliding windows?

To clarify consider two strings, one of length m and the other of length n. As an example m = 3 and n = 2, with s1 = abc and s2 = de. First we compare: abc de and generate tuple (0, 1) (as a and e are being compared, so give their indices) then…
2
votes
2 answers

Number of substrings of a string with given count of each character

Given a string (s) and an integer k, we need to find number of sub strings in which all the different characters occurs exactly k times. Example: s = "aabbcc", k = 2 Output : 6 The substrings [aa, bb, cc, aabb, bbcc and aabbcc] contains distinct…
2
votes
2 answers

Python RuntimeError: input sequence

I try to run NER in Indonesian Language I've read some resources, they said that the BERT model has positional embeddings only for first 512 subtokens. So, the model can't work with longer sequences. I can't truncate text to 512 as there will be…
2
votes
1 answer

pytorch sliding window with unfold & fold

I'm trying to use a simple ssd that was trained on 300x300 data with annotated bounding boxes. If I crop the images manually, it works correctly but with full size images it fails (obviously) due to resizing large images to 300x300 removes many…
user3002166
  • 689
  • 9
  • 24