Closed dfrankow closed 5 years ago
I think I answered my question.
Looks like ebm_global.visualize()
returns a Plotly figure.
But, when I try to plot it, there is an error saying I need a Plotly account:
import plotly.plotly as plotly_py
plotly_py.iplot(ebm_global.visualize())
Aw, snap! We didn't get a username with your request.
Don't have an account? https://plot.ly/api_signup
I made an account, and started reading the docs. The getting-started section said to init with
import plotly
plotly.tools.set_credentials_file(username='username', api_key='api_key')
where the API key is at https://plot.ly/settings/api.
Then I could display the plot.
So I think I'm good.
However, for my regression example that just shows a feature-importance graph, which is different from the learned score function in your graph. So, it would be useful to list out which graphs can be generated this way, and how. I'll keep digging.
Looks like I can get at features with the 'key' parameter of visualize
, e.g.,
plotly_py.iplot(ebm_global.visualize(0))
Hi @dfrankow, thanks for the issue! We're just about to introduce a few new API changes that should make this easier in our next release. One, we'll let you specify a port in the show method, so that you can pick your own port that you know is open. Second, we'll introduce a new function that doesn't spin up the local web-server, and directly uses plotly to visualize it. For now, here are a few notes:
visualize() does return a plotly object, and you can use plotly.offline so that you don't need an api key. And yes, if you pass in a key to visualize() , you can get a specific graph back out!
If you run this code at the top of your notebook:
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
you can then use "iplot(plotly_figure)" in your notebook to get a direct plotly graph. We'll have a nicer API around this soon!
Magic, thank you!
@interpret-ml Thanks for this update. I had a similar error with 127.0.0.1 refused to connect
where show(ebm_global)
gives me a blank page. I'm assuming this is related to the ports open or not issue.
Hi Everyone,
Our latest fix (in master and on PyPi -- v0.1.0) should now address this problem. To set a specific ip/port pair, you can use the following new functions before you call show():
from interpret import set_show_addr, get_show_addr
set_show_addr(('127.0.0.1', 7001))
show(explanation) # Will run on 127.0.0.1 at port 7001
set_show_addr takes in a tuple of (ip address, port number), and will have future visualizations run off of the specified port. get_show_addr returns the current ip/port pair being used by the package.
Re-opening this issue to enable discussion around this. If anyone else is having problems with the new method, please reply here or react to this comment. Thanks!
I tried to run without Jupyter.
when `
ebm_global = ebm.explain_global() .. set_show_addr(( '{PUBLIC_IP}', 7001)) .. show(ebm_global) `
cannot visit my public IP by browser (error by ERR_CONNECTION_TIMED_OUT ). And I tried 127.0.0.1 and visit by wget , only get html with "loading..."
got following error while setting ipaddress and host on aws Sagemaker.
@huangwei2013 Thanks for reporting this! We tried on both Ubuntu and Windows machines, and public IP addresses seemed to bind fine for us. Is there a chance it's a port forwarding/firewall issue?
Regarding wget: wget will only return a static html page, and won't execute the Javascript which is required for our visualizations.
One note of caution for anyone reading this: accessing the ip address/port directly at root (ex: http://127.0.0.1:7777) currently does not work. All visualizations are hosted at a designated URL path (ex: http://127.0.0.1:7777/123456). Console prints should have the full URL, and we're looking into making this more accessible.
@p9anand This issue might be a bit more difficult to reproduce since it's on a specific environment, which we don't have immediate access to. It might take a bit longer to debug, but we're looking into it and we'll keep you in the loop.
iptables is clean
sysinfo:(vm from Aliyun)
Linux version 3.10.0-957.12.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Mon Apr 29 14:59:59 UTC 2019
output for ‘show(ebm_global)’:
{'text/html': '\n <iframe src="http://127.0.0.1:7001/139629491858848/" width=100% height=800 frameBorder="0"></iframe>\n '}
Just to confirm, when you load this url in a browser (src of the iframe in the show method): http://127.0.0.1:7001/139629491858848/
You get a page that says "Loading..." which doesn't update further?
I run on a server without GUI,so just visit by wget . No sure of what will happen later ...
Thx @BrainMiner , I get the pic
@huangwei2013 can you try the following to verify that there are no firewalls between the machine with InterpretML and the machine with the browser.
On the server:
mkdir testweb
cd testweb
echo '<html><body>Hello World!</body></html>' > index.html
python -m http.server 7009
On the client, go to: http://{server_ip_address}:7009/
If you don't see "Hello World", then most likely there is a firewall somewhere along the chain between the machines.
@interpret-ml
the code you suggest works fine, confirmed its not about firewall.
I may do some test later and will report here if anything found.
let's close the issue and go forward now. :)
I have used above methods but issue still persists. It shows blank running after below commands
import plotly
plotly.tools.set_credentials_file(username='veduc', api_key='uKWNikrzEpZvJv8H45Q6')
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
from interpret import set_show_addr, get_show_addr
set_show_addr(('172.32.30.160', 8000))
get_show_addr()
marginal = Marginal().explain_data(X_train, y_train, name = 'Train Data')
show(marginal)
Am I doing anything wrong?
Thanks for this library.
I'm following along with the README.md and got to:
When I run that in my Jupyter notebook I get:
RuntimeError: Could not find open port
.Maybe it's trying to run a web server from a notebook?
Can I just make the individual graphs in the notebook? How?
I see functions in
interpret.visual.plot
, but I'm having a bit of trouble finding the right objects to pass to it.