-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: remove output messages, restricted result range #3
Comments
you can use something like
to fit to four line segments while turning off the optimization output... What is sometimes printed often are numpy warnings, i.e. divide by zero. You can look at https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings to disable warnings in Python. Does this help? The only print() in the code is
which displays the optimization results? Would you like a keyword to turn this off?
The fit doesn't solve for the slopes, it actually solves for the y locations provided x break points. From this solution the slopes can be calculated. I'm working on implementing fixing the x,y locations at the boundaries (beginning and end). There has been a few people who have requested this, but it's not ready (or working) at the moment. |
No, I still get messages like
I observe some messages, indeed, they look like this:
and
Is that what you mean?
Yes, that would be great. Since I can't be sure that results in such cases are correct, I need to know what datasets lead to this (and I have a few thousands =/).
Well, that means that I have to do more things manually. P.S. It seems that your fitfast doesn't work as planned, however, I need to check, what data breaks it, and open a new issue. |
Thanks for the PR!
to turn prints on. This doesn't get rid of numpy warnings.
|
Edit*: Can you send me that msd shifted dataset to troubleshoot? Or reproduce on a simple data set? Are you using version 0.2.3? In the meantime you can revert to the old release by running [sudo] pip uninstall pwlf
[sudo] pip install pwlf==0.1.7 |
Fixed the weird prediction issues in 0.2.4. Sorry about that, not sure how that escaped my test function! I need to think about that more...
Okay. I need to think about this more, but I think it can be done by setting up inequality constraints. They would look something like this might be useful for future https://math.stackexchange.com/questions/69613/linear-least-squares-with-inequality-constraints |
Thank you.
|
import numpy as np
import matplotlib.pyplot as plt
import pwlf
import pandas as pd
data = pd.read_csv('ref_msd.16.bin', sep='\s+', engine='python', usecols=(0, 3), skiprows=1, names=('lag', 'msd_shift'))
lag = np.log10(data['lag'].as_matrix())
msd_shift = np.log10(data['msd_shift'].as_matrix())
myPWLF = pwlf.PiecewiseLinFit(lag, msd_shift)
myPWLF.fit(3)
yhat = myPWLF.predict(lag)
plt.figure()
plt.plot(lag, msd_shift, 'o')
plt.plot(lag, yhat)
plt.show() |
Great! Upd. I'm pretty sure, that the plot itself is correct. I have found the old one based on the initial algorithm. It seems that the first slope is identical in both cases, however, it's not clear what gives such behaviour. Upd2. I feel that this is related to this question. |
I ended up creating a new function to evaluate the slopes by predicting at the break points. The results should be similar to the previous verision. See d59e0be for the function. I will push 0.2.5 to pypi shortly . Edit: My previous interpretation of the beta parameters as slopes was incorrect. New 0.2.5 release should give you similar slope values as you had before. |
I've updated it but no result so far. I still get the same values: Edit. Sorry, everything works fine, I'm simply used to python3 (and pip3) and your instructions for the upgrade are for p2. |
Hi again!
Sorry for disturbing, but I would like to ask you a few more things.
First, is it possible to add a key parameter which turns off all the output messages (except errors)?
I have to deal with massive numbers of files and I need to see my own print messages.
Second, can your algorithm in general use boundaries for resulting parameters? Say, I know in general, that the values of slopes a priori lie in range [0:2], thus, the result has to be in the range.
Sincerely,
V.
The text was updated successfully, but these errors were encountered: