Skip to main content
added 3 characters in body
Source Link
greybeard
  • 6.6k
  • 3
  • 20
  • 52

assorted findings

  • your code does not document what predict() accomplishes
    • I don't even get how the name predict is telling/helpful
    • your code does documents neither the approach chosen nor alternatives disregarded
  • comparing a cheaper monotone function of Euclidean distance: nice
    • naming the variables without fussing that it's equivalent Euclidean at the end of the day rather than equal to or sum/Manhattan or max: nice, again
  • camelCase is not pythonic
  • initial value for minDistances should be height*height+width*width+1
  • the approach visits each and every element of mask
  • no mask[x].index(True) (careful with mask[x].reverse().index(True))
  • the squares get computed time and again
    looks especially off with x
  • code for the four pairs looks repetitive
    naming too, come to think of it
  • the mask example is useless for showing one value, only

context provided is lacking: what is get the corners of [not-exactly-]quadrilateral?

alternative approaches to find closest to the [image] corners

  • start from the middle
    when you find an element set, you still have to inspect all the element closer to the corner, up to the corner itself
    just complicates iteration
  • proceed in order of increasing distance from the corners
    +: you find elements set close to the corner early on
    you don't need to look any further for that corner
    -: even with at least one element set, there may be more than two visits on average (solitary True in one corner)

assorted findings

  • your code does not document what predict() accomplishes
    • I don't even get how the name predict is telling/helpful
    • your code does documents neither the approach chosen nor alternatives disregarded
  • comparing a cheaper monotone function of Euclidean distance: nice
    • naming the variables without fussing that it's equivalent Euclidean at the end of the day rather than equal to or sum/Manhattan or max: nice, again
  • camelCase is not pythonic
  • initial value for minDistances should be height*height+width*width+1
  • the approach visits each and every element of mask
  • no mask[x].index(True) (careful with mask[x].reverse().index(True))
  • the squares get computed time and again
    looks especially off with x
  • code for the four pairs looks repetitive
    naming too, come to think of it
  • the mask example is useless for showing one value, only

context provided is lacking: what is get the corners of [not-exactly-]quadrilateral?

alternative approaches to find closest to the corners

  • start from the middle
    when you find an element set, you still have to inspect all the element closer to the corner, up to the corner itself
    just complicates iteration
  • proceed in order of increasing distance from the corners
    +: you find elements set close to the corner early on
    you don't need to look any further for that corner
    -: even with at least one element set, there may be more than two visits on average (solitary True in one corner)

assorted findings

  • your code does not document what predict() accomplishes
    • I don't even get how the name predict is telling/helpful
    • your code documents neither the approach chosen nor alternatives disregarded
  • comparing a cheaper monotone function of Euclidean distance: nice
    • naming the variables without fussing that it's equivalent Euclidean at the end of the day rather than equal to or sum/Manhattan or max: nice, again
  • camelCase is not pythonic
  • initial value for minDistances should be height*height+width*width+1
  • the approach visits each and every element of mask
  • no mask[x].index(True) (careful with mask[x].reverse().index(True))
  • the squares get computed time and again
    looks especially off with x
  • code for the four pairs looks repetitive
    naming too, come to think of it
  • the mask example is useless for showing one value, only

context provided is lacking: what is get the corners of [not-exactly-]quadrilateral?

alternative approaches to find closest to the [image] corners

  • start from the middle
    when you find an element set, you still have to inspect all the element closer to the corner, up to the corner itself
    just complicates iteration
  • proceed in order of increasing distance from the corners
    +: you find elements set close to the corner early on
    you don't need to look any further for that corner
    -: even with at least one element set, there may be more than two visits on average (solitary True in one corner)
Source Link
greybeard
  • 6.6k
  • 3
  • 20
  • 52

assorted findings

  • your code does not document what predict() accomplishes
    • I don't even get how the name predict is telling/helpful
    • your code does documents neither the approach chosen nor alternatives disregarded
  • comparing a cheaper monotone function of Euclidean distance: nice
    • naming the variables without fussing that it's equivalent Euclidean at the end of the day rather than equal to or sum/Manhattan or max: nice, again
  • camelCase is not pythonic
  • initial value for minDistances should be height*height+width*width+1
  • the approach visits each and every element of mask
  • no mask[x].index(True) (careful with mask[x].reverse().index(True))
  • the squares get computed time and again
    looks especially off with x
  • code for the four pairs looks repetitive
    naming too, come to think of it
  • the mask example is useless for showing one value, only

context provided is lacking: what is get the corners of [not-exactly-]quadrilateral?

alternative approaches to find closest to the corners

  • start from the middle
    when you find an element set, you still have to inspect all the element closer to the corner, up to the corner itself
    just complicates iteration
  • proceed in order of increasing distance from the corners
    +: you find elements set close to the corner early on
    you don't need to look any further for that corner
    -: even with at least one element set, there may be more than two visits on average (solitary True in one corner)