How can I access from next_purchase dataset used in "Predict Next Purchase" demo of Compose-ML? - dataset

In the Predict Next Purchase tutorial available here:
https://compose.alteryx.com/en/stable/examples/predict_next_purchase.html
the first line calls demo.next_purchase:
from demo.next_purchase import load_sample
How to install it? Or get the dataset?

The dataset is available in this repo:
https://github.com/alteryx/compose/blob/v0.5.0/docs/source/examples/demo/next_purchase/sample.csv

Related

Neo4j export whole database to JSON_LINES, ARRAY_JSON, JSON or JSON_ID_AS_KEYS

I tried to use an APOC procedure from here to export the DB using the following:
CALL apoc.export.json.all("all.json",{useTypes:true})
I can successfuly export to JSONL. However, I am not able to change the JSON format to other available formats such as JSON_LINES, ARRAY_JSON, JSON or JSON_ID_AS_KEYS. According to the documentation the following should work but it does not:
CALL apoc.export.json.all("all.json",{config:{jsonFormat:'ARRAY_JSON'}})
The result of above procedure is in JSONL but not ARRAY_JSON.
I have also tried the solution here but did not succeed.
Cheers,
A
This is working now in neo4j versions 4.2.x with APOC version 4.2.0.2: https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/4.2.0.2/apoc-4.2.0.2-all.jar
The syntax is simpler. Notice the config is a dictionary rather than a nested dictionary. See my sample below.
OLD: CALL apoc.export.json.all("all.json",{config:{jsonFormat:'ARRAY_JSON'}})
NEW: CALL apoc.export.json.all("all.json", {jsonFormat: 'ARRAY_JSON'})
Result:
(type is array of dictionaries)
The solution for my question was changing the APOC.jar file with the latest release from here. I have had to update the syntax as well.
CALL apoc.export.json.all("all.json", {jsonFormat: 'ARRAY_JSON'})
You can open the plugin folder using the tree dots by the blue open button and chose Open Folder -> Plugins. Copy and paste the path showed into your file manager if it doesn't open.
In the plugin folder, you can see your APOC version on the apoc file name.

jsonLD to graphical representationnot working

I am trying to draw a graph from my ontology which is in RDF format.I am following "https://github.com/scienceai/jsonld-vis" repositry to develop.I am getting error when trying to replicate the above github code.I am adding my code for the aobve implemetation HERE
I came across many comments saying above github repositry works.But i am not to figure it out. Please help
d3.jsonldVis(mockData, '#graph', {
w: 800,
h: 600,
maxLabelWidth: 250,
tipClassName: 'tip-class'
});
If there are any other libraries i can use to implement the above in angularjs,javascript environment please mention.
I'm not sure if this is to be answered but anyway with minor changes the example can be reproduced:
Minor Changes:
The MAIN code to initiate jsonld-vis index.js wasn't being included
CSS included as a script??? Probably a mistake. Added a link tag to include it.
The library is based on d3 version 3 and you were trying to include the latest (i.e. v5.6)
You don't need to use the import statements here. Read more about import here or here
Fork: https://plnkr.co/edit/KkNHWQa0xxiotB4tN7Ru?p=preview
Suggestions? d3 Collapsible Tree is a great viz that you can refer to and customize as per your requirements.

I need some help manipulating a string in Ruby

I have this string 'custom_controller'.
I need to get it to this 'CustomController'.
It's from the required file name and the class name inside is needed.
To cut to the chase, the code is here.
It is a project that comes from the Rack tutorials on Github. rack/rack/wiki/Tutorials
But rather than just name them custom.rb and class Custom, I want it more like a Rails app without requiring Rails or any of the gems that come with Rails except maybe Rack.
This is not a Rails app. This is not even a Sinatra or Padrino app. It's just a home brew web framework using Rack.
You can use plain ruby to build your own camelize method.
def camelize(string)
string.split('_').map(&:capitalize).join
end
This would also work:
"custom_controller".gsub(/_*([a-z]+)/i) {$1.capitalize}
And is closer to the way Rails handles this issue. I'd suggest you look at the Rails code as it also handles some variations on the simple case you quote. For example, how would you handle name spaced controllers 'foo/custom_controller'?
The desired result is just the camel case representation of the source string. You can try to use 'custom_controller'.camelize.
You could get it as 'CustomController' by doing following :
'custom_controller'.split('_').collect{|x| x.camelize}.join
If you want to use this as class you could do following :
'custom_controller'.split('_').collect{|x| x.camelize}.join.constantize
constantize is basically used to convert any string to class.
But I am not sure whether that works for controller. You can read more about it here
Read more about camelize here.

How to make drill down tables in Zeppelin?

I am trying to make each value in one of the column of table as clickable so that I can develop drill down functionality using Zeppelin Table. But following sample code is not working at all.
print(s"""%table
a\tb\n%html <button>x</button>1\t2\n%html <button>y</button>3\t4
""")
It will take quite some effort to make this work.
The basic idea is converting a data source (e.g. Spark DataFrame) to a complete and self contained HTML section and which is interpreted by Zeppelin. Hide and show need to be handled by javascript library.
Zeppelin using Bootstrap, so we shall use bootstrap library directly. This SO might help Bootstrap cllapse. Perhaps need more styling.
If you are just wanna drilldown function while not strictly with table. And if you are using Spark, it might be a bit easy with spark-highcharts to implement the feature like Highcharts column drill down
Finally my code worked. The issue seems to be if you have html tag in the first column, it will not work. However, it works in all the other columns. Just add one more cols in the front and it worked.
print(s"""%table
dummy\ta\tb\np1\t%html <button>x</button>1\t2\np1\t%html <button>y</button>3\t4
""")

gmaps geometa.js not found?

I'm using a plugin which calls http://gmaps-samples-v3.googlecode.com/svn/trunk/geolocate/geometa.js for displaying map with pins on the homepage. However, this link is not found (404). I've searched for the solution too see what to do, but with no luck.
Is there a new version of this javascript available that I could replace this link with the new one? Not sure how else to put it and hope it makes sense.
Not Certain but I think this is the file.
http://pastebin.com/D22BSvb8
EDIT: Think this is the most upto date version: http://pastebin.com/GHpyPTQE

Resources