Questions tagged [pairwise]

273 questions
1
vote
0 answers

Pairwise correlation and dropping variable with the lowest correlation to the dependent in Python

I am currently trying to clean my dataset, and would like to remove variables that are correlated between one another. I have seen some code that has been previously shared doing this, but there doesn't seem to be any criteria for what variable is…
Sam
  • 11
  • 3
1
vote
0 answers

Easier way to do element- wise matrix multiplication for pairs in a given matrix in R?

I have a matrix of dimension n*k and I am trying to calculate another matrix which has all the pairs which will have n(n-1)/2 rows and k columns New columns are element-wise multiplication of two different individual rows. Below is the code,how i am…
1
vote
3 answers

R Loop all vectors in a list between each other

I'm still a little green to R. So bear with me. I have a list of vectors and I would like to compare each vector in the list and then tack on the matching list to the end of the match one. I am looking for robust repeatable solution, regardless of…
1
vote
3 answers

How to remove rows that have the same value in two columns and rows that are duplicates of previous observations, regardless of order

Consider the data frame Data created here: Data <- data.frame(Location = rep(letters[1:20], each = 10)) I want to do pairwise comparisons manually. First, I want to find all possible pairwise combinations between the levels of Location in Data, so…
Ryan
  • 1,048
  • 7
  • 14
1
vote
1 answer

Replacing value depending on paired column

I have a dataframe with two columns per sample (n > 1000 samples): df <- data.frame( "sample1.a" = 1:5, "sample1.b" = 2, "sample2.a" = 2:6, "sample2.b" = c(1, 3, 3, 3, 3), "sample3.a" = 3:7, "sample3.b" = 2) If there is a zero in column…
BHN
  • 37
  • 5
1
vote
1 answer

Pairwise intersection counts of multiple columns in SQL

Say I have a SQL db with multiple tables, and each of these tables has a column code. What I want to produce is a table showing the number of codes shared between each pair of code columns. I.e. a pairwise intersection count plot: table1…
iacob
  • 20,084
  • 6
  • 92
  • 119
1
vote
2 answers

Quickly apply & operation to pairs of columns in R

Let’s say I have two large data.tables and need to combine their columns pairwise using the & operation. The combinations are dictated by grid (combine dt1 column1 with dt2 column2, etc.) Right now I'm using a mclapply loop and the script takes…
Jeff Bezos
  • 1,929
  • 13
  • 23
1
vote
0 answers

Understanding pairwise independent hashing implementation

I want to use a pairwise independent hashing to implement an algorithm. According to this answer on Obtaining a k-wise independent hash function, it seems that it is enough to compute (a*x + b) % p % m for mapping an integer x (which is smaller…
M A
  • 209
  • 2
  • 7
1
vote
1 answer

How to generate a matrix of pairwise sharing between groups and visualise it

I have a table with a list of observations associated with different groups. Animal Sector Time Group Cat 1 Night A Cat 1 Night B Cat 2 Night B Bat 2 Night A Bat 3 Night C Bat 3 Night A Bat 3 Night B Mouse 1 Day…
user964689
  • 812
  • 7
  • 20
  • 40
1
vote
1 answer

How do I perform a loop for kruskal wallis test comparing 3 groups over multiple columns without changing the pvalue?

I am fairly new to R and I am trying to run a kruskal wallis test to see if there is a difference between three groups when looking at different genes. I have 3 groups and 127 proteins. I have been able to create a code that will do…
RRookie
  • 11
  • 4
1
vote
1 answer

How to plot distribution of 30 features in one plot and differentiating by label in python

I am beginner in python trying to plot the distribution of the Breast Cancer Wisconsin (Diagnostic) Dataset from UCI machine learning respiratory. My dataset looks like this (Mean_Radius) (Mean_Texture) Mean_Perimeter) (Mean_Area) …
Steminist
  • 51
  • 5
1
vote
0 answers

What is best algorithm to sort documents for ranking using pairwise comparison

I am working on an information retrieval problem statement. I have trained a deep learning model using the pairwise approach. And NDCG and MAP are very good compared to the pointwise approach, but it is bringing extra computation. While inference I…
1
vote
2 answers

Pandas pairwise arithmetic similar to rolling().corr()

I have a dataframe as follows: fsym EOS BTC BNB time 2018-11-30 00:00:00+00:00 -0.051903 -0.069088 -0.058162 2018-12-01 00:00:00+00:00 0.026936 0.044739 …
1
vote
1 answer

R: Converting Large Dataframe to Pairwise Correlation Matrix

I have data of the form: df <- data.frame(group = c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5)), thing = c(rep(c('a','b','c','d','e'),5)), score = c(1,1,0,0,1,1,1,0,1,0,1,1,1,0,0,0,1,1,0,1,0,1,0,1,0)) which…
km5041
  • 351
  • 1
  • 4
  • 13
1
vote
2 answers

Generate unique dyad identifiers for unorder pairs

The dataframe I am working on is coded in dyadic format where each observation (i.e., row) contains a source node (from) and a target node (to) along with other some dyadic covariates (such as dyadic correlation, corr). For simplicity sake, I want…
Chris T.
  • 1,699
  • 7
  • 23
  • 45