How do you suppress output in JupyterLab, generated through libraries (EconML)? - output

How do you hide output in a Jupyter Notebook VM (specifically pink boxes that aren't warnings)?
I am running code using the EconML library, specifically the CausalAnalysis() method, and one output is hundreds of lines of lbfgs failed to converge (status=1):. I'm not trying to fix this issue as it's due to the method, and fixed later on in my script. I'm just trying to block the output!
I've tried
import warnings
warnings.filterwarnings("ignore")
but as it's not a warning, nothing is being suppressed.
I've also tried %%capture and other advice from Jupyter Notebook: command for hide the output of a cell? but no luck.

Related

How can I get Octave GUI to load/read .m files correctly in editor and console?

I am taking a class on using Octave for machine learning algorithms, and as part of the assignments, they provide a series of .m files to build upon with our own code as well as to run for submission credit through the auto-grader. My problem is that the .m files load perfectly fine in a regular text editor program like Atom or Notepad, but in Octave, the files are best described as nonsense, and thus will not run in the console. If I open the files in a regular editor and copy/paste over the crazy into Octave, it seems to save it and reopen fine. But, I have close to 20 files for the first project alone, and this solution is untenable in the long run. I have a screenshot of how it's loading. Is there some setting I need to change? Uninstall/reinstall Octave? I'm new to Octave and the Octave GUI, and I'm striking out with Google for a solution. I am using version 6.2.0. Thank you for any help/advice!
screenshot of how octave is loading my .m files
Update: I responded to this in a comment below, but I tried loading it another way into Octave GUI and received the following error: ">> error: load: unable to determine file format of 'C:/Users/sophi/documents/octave/assignment_1/computeCost.m" This tracks for me because it makes sense why it would open the files in such a weird way. It's simply not sure what they are. However, I created my own simple functions from scratch to test, saved them as .m files, and was able to run them perfectly fine. I'm including one of the files below. Maybe there's a key in the formatting of the files offered by the class which is impacting Octave's ability to process it correctly?
function plotData(x, y)
%PLOTDATA Plots the data points x and y into a new figure
% PLOTDATA(x,y) plots the data points and gives the figure axes labels of
% population and profit.
figure; % open a new figure window
% ====================== YOUR CODE HERE ======================
% Instructions: .... goes on about assignment
% ============================================================
end
MOST RECENT UPDATE: The plot thickens. Yesterday, I was able to open the files I created and run them in the Octave environment, and I (wrongly) assumed they would still work today. They are doing the same stupid thing as the files included by the course. I checked inside preferences for the editor, and it says it is loading and saving them as IBM273 if that helps. Thank you for everyone has pitched in ideas. I really appreciate it!
It was 100% the encoding. I thought it was strange it was saving/loading in IBM273, so I switched it to UTF-8. Almost all the files are working now. The only ones that aren't are the ones I was trying to copy/paste yesterday to see what was going on with the load problems and the basic new problems I wrote. So I deleted everything, redownloaded, and set the default UTF-8 going forward and voila! Solved! Thanks again!
If you want to open a .m file in octave, Try this solution
It is necessary to declare a current directory before saving a file, loading a file, or running an M-file. By default, unless you edit the Octave shortcut, the current directory will be .../Octave/work. After you start Octave, change the current directory by either using the toolbar at the left-hand side of the screen, or entering the path in the bar at the top.
To open an .m file, you can use file -> open, or type
open filename

Octave syntax highlighting in Jupyter notebook

I'm running the octave kernel in Jupyter, but I'm not getting syntax highlighting in the code cells. I've installed Jupyter et. al. through Anaconda. I can't remember how I got the octave kernel installed, but probably from here:
https://github.com/calysto/octave_kernel
Do I need to do something in the kernel spec to flip on CodeMirror support?
Edit: turns out the syntax highlighting appeared after refreshing the notebook page, even without the config entry.
Leaving the answer in case it helps with other issues that people might be facing.
I managed to get syntax highlighting working for Octave by following the instructions here:
Configuring the notebook frontend
configuring the CodeMirror mode to Octave: "mode": "octave"
TL;DR
Put the following code snippet in ~/.jupyter/nbconfig/notebook.json. (If the file/directory structure is not present then create as required).
{
"CodeCell": {
"cm_config": {
"mode": "octave"
}
}
}
Caveats
I haven't tested this fully, but it seems the syntax highlighting will persist even for other languages, e.g. Python. This means that the config file might need to be disabled/deleted when using Jupyter for non-Octave notebooks.
Also, I noticed the syntax highlighting doesn't immediately show up on first load of the notebook. I had to refresh the page before it appeared.

HTML Generation using neo4jrestclient

So I was using the neo4jrestclient, and I noticed that in the class of QuerySequece, there's a .to_html()function (https://github.com/versae/neo4j-rest-client/blob/master/neo4jrestclient/query.py)
However, when I try using it I get the 'Unable to display the graph or the table' error.
I haven't found a working example of it. I was wondering if anyone has gotten this working.
Much thanks appreciated.
The function .to_html() is a function that IPython uses in order to render rich content inside Notebooks. When running inside a Notebook, neo4jrestclient asks for extra information to the Neo4j server, so it can draw the actual graph returned. Therefore, if you try to run a query inside an IPython Notebook, a D3 graph should be rendered automatically.
from neo4jrestclient.client import GraphDatabase, Node, Relationship
gdb = GraphDatabase(url="http://localhost:7474")
gdb.query("MATCH (me)-[r]-() RETURN me, r LIMIT 10")
A running example can be seen in this gist. Although it's still a work in progress. I think that I could add an option to populate the needed fields in case you wanted to use the .to_html() outside the IPython Notebook. All you need to do is to make neo4jrestclient believe that it's running inside of one by modifying the function neo4jrestclient.utils.in_ipnb() making it to always return True. Let me know if you would use that feature and I will add it.
On the other hand, I am developing ipython-cypher, to have a better integration of IPython, Pandas, NetworkX, and matplotlib with Neo4j, but it's still in alpha.
Update: Now you can add data_contents=True to return the extra data.
results = gdb.query(query, data_contents=True)
Data will be in results.rows and results.graph.

How to configure SublimeLinter to enforce pep8 errors?

I am trying to get SublimeLinter to enforce pep8 errors as a plugin to sublime text 2. When I install it, it seems to immediately show a small list of errors, but not nearly the full list that I get by running
pep8 file.py
If I look in my sublime text 2 console, then i see the full list of pep8 errors. However, I want these to be shown in the sublime text 2 gui, when you go to "Show Error List."
If I go to "Show Error List," it says I have no lint errors, but I see hundreds of lint errors in the console.
In the package configuration file it has pep8 set to true by default, but doesnt seem to be enforcing all of the errors.
For someone who has used this plugin, how can I get it to list all of the pep8 errors from the main "Show Error List" window instead of the console?
===
Update: After a while of poking around, I have narrowed down. In the SublimeLinter plugin (file python.py) there is a line:
pep8.Checker(filename, good_lines).check_all()
This is what actually runs pep8 on the file. When it encounters an error it is supposed to call the pep8.Checker.report_error function, and there is a custom callback defined in the plugin. However, I have traced it, and I see that it is not being called. The checker is running correctly and producing out. I have examined the pep8 code here https://github.com/jcrocholl/pep8/blob/master/pep8.py, but no luck.
I imagine there is a very simple fix... probably a configuration somewhere. If anyone has insights, that would be appreciated.

BiarEnginer.jar/Command Line Import Documentation/Usage

Anyone know where the documentation is for the properites file?
I am trying the following exportQuery:
select * form ci_infoobjects where si_kind like 'FavoritesFolder' and si_name like 't%'
It is correctly grabbing the users but, is not biaring any of the folders/reports that said user has.
Suggestions?
Ok here is what I have found out.
documentation: on the command line importe is in the bi_vip pdf provided by SAP (which I will provide a link to later).
usage: My query isn't exactly correct but, removing the si_name portion should get you th right result.
issues: It seems that the command line importer does not gracefully handler export errors. Any export error it receives the command line will kill itself.
work around: I am pretty much duplicating the ImportWizard in java at this using API BIAROutput and IException.
I will hopefully post back my source code for the command line import tool in java.