Questions tagged [triplet]
63 questions
2
votes
1 answer
Optimize triplet summation in C++
Problem
I need to compute a function of an array of integers. For every three-element subset (or triplet) of the array, I need to compute the term floor((sum of triplet)/(product of triplet)). Then I need to return the sum of all such…

SM Ataul Karim Riad
- 373
- 5
- 12
2
votes
2 answers
Convert triplets to matrix in R
I have triplets and want to convert them to the matrix.
This is my code:
data = data.frame(row = c(1,2,3), column = c(2,3,1), value = c(0.1, 0.2, 0.5));
m <- matrix(0, nrow = max(data$row), ncol = max(data$column));
m[ data$row, data$col ] =…

Fedorenko Kristina
- 2,607
- 2
- 19
- 18
1
vote
0 answers
Triplet Loss with Cross Entropy Loss?
I'm trying to learn how to use a TripletLoss in a Siamese Network.
My goal is to build a classification siamese model, so I suppose I need both a Triplet Loss to minimize distances and a Cross Entropy Loss for classification.
I managed to build a…

ChiG
- 19
- 1
- 3
1
vote
0 answers
What does the semi hard triplet loss function from tensorflow_addons actually do?
In my humble opinion, the simple answer to this question, it implements the semi hard triplet loss function as described in the paper "FaceNet: A Unified Embedding for Face Recognition and Clustering" is not true. Contrary to the paper, it does not…

Wonderer
- 11
- 2
1
vote
1 answer
Triplet loss can't learn as the theory in text embedding
I am working on a triplet loss based model for text embedding.
Short description:
I have a database about online shop, I need to find the suitble product when users enter a text on search bar. I want a model work better than matching string and…

Liem Truong
- 11
- 2
1
vote
0 answers
How to improve similarity learning neural network with low precision but high recall?
I am currently training a similarity learning neural network using triplet loss.
I have employed semi-hard negative mining to train the network to learn the features.
The trained model has high accuracy(or recall= 88%) but it has low average…

Aparajuli
- 344
- 1
- 2
- 15
1
vote
2 answers
How to find all possible consecutive triplets in a string?
My question is that if you have a string of DNA, how could you create a list of all possible consecutive triplets? For instance, if you have the following string:
ACCTAA
I need to create a list of all possible consecutive triplets, such that:
ACC,…

Maskurate
- 21
- 4
1
vote
0 answers
Select random non-zero element from each row of 3d matrix in non-eager tensorflow
I am trying to implement the triplet loss with random negative triplet selection.
Right now I have a tensor of shape (batch_size, batch_size, batch_size) where element (i,j,k) is equal to
dist(i,j) - dist(i,k) + margin (i is an anchor, j is a…

roman-vygon
- 23
- 4
1
vote
1 answer
Why 256 outputs are needed in SemiHard Online Learning predicting MNIST?
TensorFlow Addons Losses
I study Triplet Loss using the above article. The labels's numbers are from 0 to 9 trying below code.
for images_batch, labels_batch in train_dataset:
print('images batch shape:', images_batch.shape)
print('labels batch',…

Satoru
- 11
- 1
1
vote
1 answer
Find the number of triplets i,j,k in an array such that the xor of elements indexed i to j-1 is equal to the xor of elements indexed j to k
For a given sequence of positive integers A1,A2,…,AN, you are supposed to find the number of triplets (i,j,k) such that Ai^Ai+1^..^Aj-1=Aj^Aj+1^..Ak
where ^ denotes bitwise XOR.
The link to the question is here:…

Golovkin
- 33
- 7
1
vote
1 answer
How to print all increasing-index triplets in an array?
Given an array ar of length n, how can I print all triplets (ar[i], ar[j], ar[k]) in better than O(n^3) time where 0<=i

Arnab Banerjee
- 165
- 1
- 15
1
vote
0 answers
AttributeError: 'generator' object has no attribute 'ndim'
I'm working on Triplets networks on Keras to find the image similarity. However, I'm getting an error when feeding triplets to the model. Request you to kindly help on this.
Basically I'm trying to feel the model with 3 inputs(anchor, positive,…

sara
- 45
- 2
- 13
1
vote
2 answers
R: Count triplets with sum smaller than a given value
I've been able to find multiple solutions to this problem on other languages but can not seem to get it right in R. Here's what I have so far:
Given an array (-2, 0, 1, 3) find the count of triplets less than the sum variable given.
sum =…

Luis Losada
- 13
- 2
1
vote
1 answer
is it possible to find all the triplets in the given array for the O (n) time?
Given an array of numbers find all such triplets that satisfy the given condition.
Condition: a[i] < a[j] < a[k] where I < j < k.
it is possible to solve this problem in O (n) time?
This is not home work !!!
user1886376
0
votes
0 answers
Challenges in Fine-Tuning a Causal Language Model using Triplet Dataset and Cosine Similarity
I'm trying to fine-tune causal language model. I made triplet dataset and calculated cosine similarity(normalized and dot product) score for query/pos and query/neg. Then I got loss with cross entropy loss. But training loss and validation loss are…