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

Given N people, some of which are enemies, find number of intervals with no enemies

A friend gave me this problem as a challenge, and I've tried to find a problem like this on LeetCode, but sadly could not. Question Given a line of people numbered from 1 to N, and a list of pairs of M enemies, find the total number of sublines…
JoeVictor
  • 1,806
  • 1
  • 17
  • 38
2
votes
3 answers

Find permutation of one string into other string program

Trying to make an program where it just check, if permutation of string s1 exists in string s2 or not. Created below program and it works for below test case. Input: s1 = "ab" s2 = "eidballl" Output: True Explanation: s2 contains one permutation…
Cod29
  • 265
  • 4
  • 14
2
votes
0 answers

Sliding window median in C++

I need some sliding window statistics and I am considering to use boost::accumulators for that, however, I couldn't find the sliding window median algorithm there. Does boost::accumulators provide an exact and deterministic sliding window median…
Vahagn
  • 4,670
  • 9
  • 43
  • 72
2
votes
0 answers

How to add sliding window mechanism to these programs?

I'd like to implement a sliding window mechanism into the following code, looking for any advice on where to start. Currently the sender keeps sending and collecting its own packets, and I'm not really sure why that is, could someone help me fix…
coderboy99
  • 103
  • 8
2
votes
1 answer

How to implement a sliding window model in TF/Keras for image segmentation?

I'm working on semantic image segmentation, with U-net based models. The input images are of different dimensions (between 300-600 pixels in each axis). My approach so far was to rescale the images to standard dims, and work from there. Now I want…
2
votes
2 answers

Count number requests per second/minute based on timestamps for the last N seconds

What's a memory-efficient way to compute 10 requests per second based on timestamps of the incoming data for the last 60 seconds? I have the following 10-digit, Unix…
AAA
  • 1,962
  • 4
  • 30
  • 55
2
votes
2 answers

Adapting a sliding-window Python generator function to shuffle the window

I have adapted the sliding window generator function here (https://scipher.wordpress.com/2010/12/02/simple-sliding-window-iterator-in-python/) for my needs. It is my first experience with generator functions so I did a lot of background reading.…
Jess
  • 186
  • 3
  • 13
2
votes
2 answers

How to maintain an ordered sliding window

This question is kind of irrelevant to a programming language. So here is the question: I have a sliding window of size n which contains real numbers. This sliding window removes old values (FIFO way) per new insert if it is full. Every now and then…
2
votes
0 answers

update instruction of the deprecated tensorflow dataset sliding window with tf.data.experimental.CsvDataset

I am trying without success to update my code with the instruction given in the tensorflow documentation (api r1.13). I am using the tf.data.experimental.CsvDataset and the deprecated tf.contrib.data.sliding_window_batch for a RNN and all works fine…
Urian
  • 75
  • 7
2
votes
5 answers

Find person and immediate neighbours in Seq[Person]

Given a Seq[Person], which contains 1-n Persons (and the minimum 1 Person beeing "Tom"), what is the easiest approach to find a Person with name "Tom" as well as the Person right before Tome and the Person right after Tom? More detailed…
user826955
  • 3,137
  • 2
  • 30
  • 71
2
votes
1 answer

sliding search window without using 'for' loop in python

I am trying to create a slide search algorithm in python. I am trying to index the image by iterating over the co-ordinates. Please check the code below. Here I am using 2 FOR LOOPS (which takes lot of time). I want to implement it which will…
2
votes
1 answer

How can I optimize my Lz77 Sliding Window Compressor?

I wrote a Java compressor for a super obscure compression format. (It was mainly used on Amiga Computers in the 1990s). There is a fair amount of documentation on how to decompress the file format, but none on actually how to compress it. So, I…
Petersnow2
  • 69
  • 5
2
votes
0 answers

Python sliding window for images to be used in CNN

This is something that I'm sure there must be a package out there for, but for the life of me I can not find it. I've trained a CNN with a given size image looking for heads and then wish to give it a larger image to look within for the heads. Now…
FraserOfSmeg
  • 1,128
  • 2
  • 23
  • 41
2
votes
2 answers

Most frequent values in sliding window dataframe in R

I have the following dataframe (df): A B T Required col (window = 3) 1 1 0 1 2 3 0 3 3 4 0 4 4 2 …
Avi
  • 2,247
  • 4
  • 30
  • 52
2
votes
1 answer

How to write result of each sliding window of a FLINK program in new file Instead of appending the result of all Windows in one file

Below is a flink program (Java) which reads tweets from a file, extract hash tags, count the number of repetition for each hash tag and finally write in a file. Now In this program there is a sliding Window of size 20 seconds that slides by 5…
Gaurav
  • 161
  • 1
  • 11