Questions tagged [triplet]

63 questions
0
votes
1 answer

Triplet loss tensorflow where anchor-positive pairs are defined upfront

I am trying to implement triplet loss in Tensorflow where the triplets are obtained in an online mining way. In my particular problem, I already have the anchor(image) - positive(text) pairs. What I want to achieve is have the triplets anchor(image)…
gorjan
  • 5,405
  • 2
  • 20
  • 40
0
votes
2 answers

special pythagorean triplets

def pythagorean(n): aAndB = [] for a in range(150, n-1): for b in range(150, n): for c in range(150,n+1): if (c * c) == a *a + b*b and a + b + c == 1000: aAndB.append(a) return…
0
votes
1 answer

Reordering character triplets in Python

I've been trying to solve this homework problem for days, but can't seem to fix it. I started my study halfway through the first semester, so I can't ask the teacher yet and I hope you guys can help me. It's not for grades, I just want to know…
0
votes
1 answer

Why is my list comprehension not showing same result as the for loops?

Below is my code to triplets that sums to a give value (using for loop) def triplet(array,num): for a in range(len(array)): for b in range(a): for c in range(b): if array[a]+array[b]+array[c]==num: …
Sel_Python
  • 191
  • 2
  • 7
  • 16
0
votes
1 answer

How does keras pass y_pred to loss object/function via model.compile

If I have a function that defines the triple loss (which expects a y_true & y_pred as input parameters), and I "reference or call it" via the following: model.compile(optimizer="rmsprop", loss=triplet_loss, metrics=[accuracy]) Hows does the y_pred…
Jon
  • 343
  • 3
  • 9
0
votes
1 answer

C program on Pythagorean triplets-incorrect output

I want to take every combination of numbers from 1 to 30 ,a and b and want to find out their pythagorean triplets.The limit is 30 for ALL numbers.The output starts from 14.I dont understand why.I am really sorry for any gross mistakes or format…
whitebull13
  • 31
  • 1
  • 1
  • 3
0
votes
1 answer

Array triplet show only once

I have this function: int triplet(int *array, int size, int K) { int i, j, k; for(i = 0; i < size-2; i++) { for (j = i+1; j < size-1; j++) { for (k = j+1; k < size; k++) { /* Check if the sum of current triplets is equal…
blackroad
  • 29
  • 1
  • 5
0
votes
1 answer

Only one apk from splited is uploaded to Google Play

Plugin uploads only apk with version 760XXX (where XXX - current version) but I have 5 different abis. All configs same as for default sample similar to this https://developer.android.com/studio/build/configure-apk-splits.html Maybe you can provide…
MastAvalons
  • 1,150
  • 1
  • 14
  • 23
0
votes
1 answer

Error Eigen library on linux

I have implemented this code with Eigen library to have Triplet structure. This code works very well in my project on my Mac OS X. However the same code don't work on Linux platform. Eigen::SparseMatrix spdiags(const MatrixXd& B, const …
ananass
  • 75
  • 2
  • 10
-1
votes
1 answer

is there a way to optimise an algorithm that finds the pythagorean triplet for which a+b+c=1000?

i'm trying to solve project euler's 9th problem , and this code does the job but it takes too long to do so (note : i just realized that the a
-1
votes
2 answers

Program will not stop when the conditions are passed

I'm writing a sum up game where two players will take turns picking a random number in the range (1,9), no repeated number allowed. If the first player picks [7, 2, 3, 5], he will win because 7+3+5 = 15 So my question is why doesn't the program stop…
-1
votes
2 answers

How to write a function "triplets" that takes in a number and returns a list of triplets?

Write a function triplets that takes a number n as argument and returns a list of triplets such that sum of first two elements of the triplet equals the third element using numbers below n. Please note that (a, b, c) and (b, a, c) represent same…
-1
votes
1 answer

Finding all pythagorean triplets between 100 to 1000

I wrote a program to find pythagorean triplets between 100 to 1000. Here goes the code for the same. #include #include using namespace std; bool checkWhetherInteger(int x, int y); int getInteger(int x, int y); int main() { …
Vaibhav
  • 131
  • 1
  • 9
-2
votes
0 answers

Different Result on same simple Code of java

I have a java code of question **count unique triplet in an array whose sum is equal to the target sum in the provided function **, the problem in my code is just after the function call I sort the array by in built sort function in java , the…
-2
votes
3 answers

Errors in Hackerrank compare the triplets code

I was doing the hackerrank triplet sum question and I found these errors but I dont know why these errors are coming. Can someone please give a little more insight about it and if possible link a video about the topics I should read in order to…
ARYAN SHARMA
  • 23
  • 1
  • 1
  • 7