question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Non Negative Values in Y

See original GitHub issue

Is there a reason why if Y has no negative an error is returned.

>>> x = range(2,20)
>>> y=[]
>>> for i in x:
...     y.append(i*100)
>>> x
[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
>>> y
[200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900]
>>> 
>>> kneed.KneeLocator(x,y)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/kneed/knee_locator.py", line 61, in __init__
    self.knee, self.norm_knee, self.knee_x = self.find_knee()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/kneed/knee_locator.py", line 74, in find_knee
    mxmx_iter = np.arange(self.xmx_idx[0], len(self.xsn))
IndexError: index 0 is out of bounds for axis 0 with size 0

>>> y[0]=-1
>>> kneed.KneeLocator(x,y)
<kneed.knee_locator.KneeLocator object at 0x106a56d10>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
raviollicommented, Feb 27, 2018

Solution Solved. Update from github rather then pip default repo

0reactions
arvkevicommented, Feb 28, 2018

@raviolli the example you provided didn’t have a local maximum, which caused the error. See the image below, b383b0b includes a print statement informing the user that no maxima was found and returns None for the knee so the user can inspect the function.

screen shot 2018-02-27 at 8 57 34 pm
Read more comments on GitHub >

github_iconTop Results From Across the Web

Non Negative Function - Statistics How To
A non negative function has function values equal to or greater than zero (i.e., f(x) ≥ 0). The domain (inputs) of the function...
Read more >
Why does the graph of y=√x not have a negative value of y ...
y =√x does not have a negative value because it denotes the principal square root of x which is not negative. The negative...
Read more >
Better name for "non-negative" value? - Stack Overflow
@Kirk Woll: My best answer to that is "because there's something better". If, in fact, all of these smart people cannot provide something...
Read more >
If x and y are nonnegative integers, what is the value of y?
x and y are non-negative integers - This means x & Y can be ZERO and Any POSITIVE integers. y = ? As...
Read more >
Nonnegative Value - an overview | ScienceDirect Topics
5.5 Determining Probabilities from a Joint CDF. Suppose that X and Y are given random variables and we are required to determine the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found