I am trying to find if two programs are gamma-isomorphic or not for which I am taking the help of Jgrapht library. Now, I have to generate program dependence graphs of the programs and capture it as a graph object. Using frama-c we can generate pdgs. I used frama-c -pdg -pdg-dot graph -pdg-print program.c to generate pdg of the program and the output is a dot format. I have to parse the dot format to get the graph. Instead of this, will I be able to get hold of graph data structure like a graph object instead of dot file.
Technically speaking, you should be able to extract the information you want with the functions exported in the Db.Pdg module of Frama-C. In particular,
Db.Pdg.iter_nodes allows you to iter over all nodes (for all functions) generated by the Pdg, and the Db.Pdg.direct_*dpds family of functions will get you the list of direct children of a given node, either all of them or only of a given kind. More information is available in the db.mli file inside Frama-C's sources.
That said, I have to ask you why you'd want to do that. As far as my search engine can tell me, JGraphT is a Java library, and last time I checked, OCaml/Java bindings weren't exactly painless to implement, if at all possible. Furthermore, it seems to me that the class DOTImporter of JGraphT should allow you to use more or less directly the output of pdg.
Related
I am trying to translate some code that we previously used in a software similar to PowerBI into some form that's compatible with PowerBI. One thing that I need to do for that is to generate a model fit to some data and use that to display some data on the fit (in some further visual elements).
From a sequential point of view, this is trivial. Generate an object, then work on that object and print some data. But from what I understand about PowerBI, this kind of interdependency between R scripts / visual elements (generate an object, then hand that object to other procedures to generate further output) is not intended and since I need to use several visual elements, and all of them depend on the output of the first, I have no idea how to work this out.
I need to use several visual elements, and all of them depend on the output of the first
Then the data needs to be created in Power Query and loaded into the data model. You can run R in Power Query to generate the data, and visualize it with regular Power BI Visuals and the R Visual.
In GBM model, following parameters are used -
col_sample_rate
col_sample_rate_per_tree
col_sample_rate_change_per_level
I understand how the sampling works and how many variables get considered for splitting at each level for every tree. I am trying to understand how many times each feature gets considered for making a decision. Is there a way to easily extract all sample of features used for making a splitting decision from the model object?
Referring to the explanation provided by H2O, http://docs.h2o.ai/h2o/latest-stable/h2o-docs/data-science/algo-params/col_sample_rate.html, is there a way to know 60 randomly chosen features for each split?
Thank you for your help!
If you want to see which features were used at a given split in a give tree you can navigate the H2OTree object.
For R see documentation here and here
For Python see documentation here
You can also take a look at this Blog (if this link ever dies just do a google search for H2OTree class)
I don’t know if I would call this easy, but the MOJO tree visualizer spits out a graphviz dot data file which is turned into a visualization. This has the information you are interested in.
http://docs.h2o.ai/h2o/latest-stable/h2o-genmodel/javadoc/overview-summary.html#viewing-a-mojo
I would like to find out what the "R way" would be to let users the following with R: I have a file that can contain the data of one or more analysis runs of some other software. My R package should provide additional ways to calculate statistics or produce plots for those analyses. So the first step a user would have to do, is read in the file (with one or more analyses), then select the analysis and work with it.
An analysis is uniquely identified by two names (an analysis name and an analysis type where the type should later correspond to an S3 class).
What I am not sure about is how to best represent the collection of analyses that is returned when reading in the file: should this be an object or simply a list of lists (since there are two ids for identifying an analysis, the first list could be indexed by name and the second by type). Using a list feels very low-level and clumsy though.
If the read function returns a special kind of container object what would be a good method to access one of the contained objects based on name and type?
There are probably many ways how to do this, but since I only started to work with R in a way where others should eventually use my code, I am not sure how to best follow existing R-conventions for how to design this.
I read that with frama-c, we can generate a PDG
which free tools can I use to generate the program dependence graph for c codes
My question is: there is a way for it to generate a SDG (It is a set of PDG, it aims to modelize interprocedural dependences)?.
Anybody could help me or could give me tips about which tools could generate the SDG.
Thank you
I'm not completely sure that it answers your question, but Frama-C's PDG plugin does have inter-procedural information, in the form of nodes for parameters and implicit inputs (globals that are read by the callee), as well as for the returned value and output locations (globals that are written). It uses results of the From plug-in to compute dependencies.
If I understand correctly PDG's API in Db.Pdg, you should be able to obtain all nodes corresponding to a given call with the Db.Pdg.find_simple_stmt_nodes function.
I frequently find myself doing some analysis in R and then wanting to make a quick map. The standard plot() function does a reasonable job of quick, but I quickly find that I need to go to ggplot2 when I want to make something that looks nice or has more complex symbology requirements. Ggplot2 is great, but is sometimes cumbersome to convert a SpatialPolygonsDataFrame into the format required by Ggplot2. Ggplot2 can also be a tad slow when dealing with large maps that require specific projections.
It seems like I should be able to use Mapnik to plot spatial objects directly from R, but after exhausting my Google-fu, I cannot find any evidence of bindings. Rather than assume that such a thing doesn't exist, I thought I'd check here to see if anyone knows of an R - Mapnik binding.
The Mapnik FAQ explicitly mentions Python bindings -- as does the wiki -- with no mention of R, so I think you are correct that no (Mapnik-sponsored, at least) R bindings currently exist for Mapnik.
You might get a more satisfying (or at least more detailed) answer by asking on the Mapnik users list. They will know for certain if any projects exist to make R bindings for Mapnik, and if not, your interest may incite someone to investigate the possibility of generating bindings for R.
I would write the SpatialWotsitDataFrames to Shapefiles and then launch a Python Mapnik script. You could even use R to generate the Python script (package 'brew' is handy for making files from templates and inserting values form R).