Skip to content
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

PSL-Viz #278

Open
wants to merge 108 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
20dcd08
First push to psl_viz development, marked a bunch of places where we …
AaronRodden Apr 1, 2020
050f0b3
fixed merge conflicts, pom version stuff
AaronRodden Apr 1, 2020
6c91eae
Somewhat messy commit, but got a proof of concept for prediction vs t…
AaronRodden Apr 6, 2020
abc2823
Pushing some changes from meeting
AaronRodden Apr 10, 2020
d9252c3
Merge branch 'develop' into psl_viz
AaronRodden Apr 10, 2020
62ebe0f
Got rid of some comments and things from my various testing
AaronRodden Apr 10, 2020
c04d221
Fixed some styling, cleaned some comments, organized VizDataCollectio…
AaronRodden Apr 11, 2020
727322a
Found some new tests, got rid of a print out from past testing in Abs…
AaronRodden Apr 11, 2020
3fc459b
Beginning process of moving viz data collection calls to cli
AaronRodden Apr 11, 2020
ea9a16a
Started setting up launcher to handle vizualization
AaronRodden Apr 12, 2020
86e5e8e
Got rid of using evaluator object and instead use code from one of it…
AaronRodden Apr 12, 2020
f295d01
Finsished implementation of prediction vs truth data in cli
AaronRodden Apr 13, 2020
807b8c8
Added a viz command line argument option
AaronRodden Apr 14, 2020
983d21b
Changed the flag name and option name
AaronRodden Apr 14, 2020
8a0a093
Passing ground rules over to VizDataCollection now
AaronRodden Apr 14, 2020
5c53b06
Finished proof of concept for ground rule satisfaction histogram
AaronRodden Apr 14, 2020
0533607
Groundings per Rule implemented.
tsalh Apr 14, 2020
24a5ec7
Groundings per rule now implemented and modifed outputJSON() method t…
tsalh Apr 14, 2020
4ea7771
Fixed JSON labeling and setup file output for total rule satisfaction.
tsalh Apr 15, 2020
54a023f
Put all json data into one json, sectioned off via different keys
AaronRodden Apr 15, 2020
17a251f
Fixed the total sat module methods to add up totals instead of grabbi…
AaronRodden Apr 15, 2020
2168317
Added sat / dis split as well as percentages to json
AaronRodden Apr 15, 2020
245c238
Missed a debug print in last push
AaronRodden Apr 15, 2020
cbb29e6
Grabbing violated ground rules and their consensus values
AaronRodden Apr 15, 2020
070a11d
Changed the data collection for violated ground rules
AaronRodden Apr 17, 2020
32398aa
Added the visualization flag to command line handler, also added a Si…
AaronRodden Apr 17, 2020
c62c4fe
Removed unparented number of ground rules from statistics.
tsalh Apr 18, 2020
1bbcb42
got rid of weight flag in violation data collection
AaronRodden Apr 22, 2020
071f3ad
Did a sweep of the code for style, readability, variable names, etc.
AaronRodden Apr 27, 2020
caf2ae5
Got needed data for a overall rule map, need to organize it now
AaronRodden Apr 27, 2020
23e7fe0
All rule mapping data now being outputted to JSON
AaronRodden Apr 28, 2020
ffb7268
Got rid of comments in AbstractLogicalRule
AaronRodden Apr 28, 2020
55a438b
Got rid of a space in the new function
AaronRodden Apr 28, 2020
e63fc16
Implementing some of the feedback on current JSON output file
AaronRodden Apr 28, 2020
74e952e
Moved visualization data collection to the code covered by SimpleAcqu…
tsalh Apr 28, 2020
7b256d9
Removed unnecessary print statement.
tsalh Apr 28, 2020
12f98b5
Changed our JSON to have groundAtoms instead of queryAtoms
AaronRodden Apr 29, 2020
771743e
Moved rule count into rule json object along with weighted flag.
tsalh Apr 29, 2020
3c4fae3
Removed totRuleSatDis method from visualization now the ground rule i…
tsalh Apr 29, 2020
c2661fd
Removed unnecessary comments in VizDataCollection and null ground rul…
tsalh Apr 30, 2020
a85d196
Removed comments and fixed style.
tsalh Apr 30, 2020
25a8f43
Got rid of violation being its own function, working on adding predic…
AaronRodden Apr 30, 2020
abadd99
Pulled some changes in
AaronRodden Apr 30, 2020
3050e62
Completing moving prediction values into groundAtoms and making truth…
AaronRodden Apr 30, 2020
6cf482e
Got rid of violated rules data structures that are no longer needed
AaronRodden Apr 30, 2020
aa7d07a
Missed some violation stuff in last commit
AaronRodden Apr 30, 2020
8979d5e
Moved all visualization data collection to visualization method in La…
tsalh Apr 30, 2020
148e5fd
Switched truthMap from JSONArray to JSONObject
AaronRodden Apr 30, 2020
ed64b4b
Got rid of comments
AaronRodden Apr 30, 2020
a2cbc9f
For some reason my small launcher change didnt get caught, fixing that
AaronRodden Apr 30, 2020
08cd67a
Corrected JSON key name for rule.
tsalh May 1, 2020
b455f1c
Corrected JSON key name for ground atom.
tsalh May 1, 2020
9332d8b
Removed disatisfaction for an unweighted rule.
tsalh May 1, 2020
7970486
Change command line options to have proper naming
AaronRodden May 4, 2020
a950622
Atom map removed from ruleInsertElement
AaronRodden May 4, 2020
1a141f4
Updated git ignores
AaronRodden May 5, 2020
c0a885a
Change viz test name
AaronRodden May 5, 2020
c37a47e
Change name of viz function in launcher
AaronRodden May 5, 2020
6fade6e
Got rid of comments in inference application
AaronRodden May 5, 2020
ebe1b8d
Got rid of a test statement in continuous evaluator
AaronRodden May 5, 2020
36957a4
Fixed some spacing in AbstractLogicalRule
AaronRodden May 5, 2020
7fbe5f9
Got rid of comment in config, fixed testVisualization name and change…
AaronRodden May 5, 2020
07185f8
Changed the Viz command line flag in testVisualization function
AaronRodden May 5, 2020
d0d30a0
Put an import in the right order in InferenceApplication
AaronRodden May 5, 2020
e3ca202
Fixed spacing in InferenceApplication
AaronRodden May 5, 2020
e69af27
Switched from JSONObjects to Java data structures to hold data, imple…
AaronRodden May 6, 2020
9d38e9f
Got rid of some spacing and comments
AaronRodden May 6, 2020
b125d11
Got rid of fields that are no longer needed after last update
AaronRodden May 6, 2020
4504e1c
Updated how output is handled in VizDataCollection, now goes to stdou…
AaronRodden May 6, 2020
bb20c08
Added a string to our output file that turns the json into a js variable
AaronRodden May 8, 2020
06d76a1
Removed weights when adding rules to data file
AaronRodden May 8, 2020
f345153
Fixed spelling mistake disatisfaction -> dissatisfaction, effect how …
AaronRodden May 12, 2020
0da4aa1
Style changes: exceeding column limit and bad indentation.
tsalh May 15, 2020
ef738b1
Going back to outputting a JSON file instead of a JS file
AaronRodden May 22, 2020
9c1cb7f
Fixing a typo in a comment
AaronRodden May 22, 2020
39c15cb
Fixed missing ground atom bug.
tsalh May 23, 2020
5ccce63
Data collection now collects satisfaction of a ground rule after infe…
tsalh May 26, 2020
cd8330e
Got rid of unused imports, got rid of some comments
AaronRodden Jul 23, 2020
62ce256
Moved grabbing satisfaction values from ground rules from Launcher to…
tsalh Jul 30, 2020
2514087
Remove unused argument.
tsalh Jul 31, 2020
4796548
Moved grabbing satisfaction values from InferenceApplication to CLI, …
tsalh Aug 3, 2020
be230d6
Fixed up some comments.
tsalh Aug 3, 2020
9551535
Styling.
tsalh Aug 4, 2020
3d9247d
Removed collectModelRules function and now the output file can be spe…
tsalh Aug 15, 2020
60acb5a
Removed pretty print to data file.
tsalh Aug 16, 2020
1660ce7
Added functionallity to create a Non-DNF ground rule, which will then…
AaronRodden Aug 21, 2020
dca1584
Got rid of an un-needed function, and prints from last commit. Added …
AaronRodden Aug 21, 2020
a874434
Gathered all Arithmetic Rules. (temporary)
tsalh Aug 22, 2020
cfa8084
Merge branch 'psl_viz' of https://github.com/AaronRodden/psl into psl…
AaronRodden Aug 22, 2020
8e1ce89
Refactored write to output file while minimizing write buffer.
tsalh Aug 23, 2020
5c666b5
Removed collection of arithmetic ground rules and refactored writeMap…
tsalh Aug 27, 2020
6d7db0b
Completed final data file logic, and cleaned up / refactored
AaronRodden Aug 28, 2020
44760f3
Fixing merge conflict, waiting for Arithmetic rule collection to do f…
AaronRodden Aug 28, 2020
b4a6c5a
NOTE: This commit relys upon a arithmetic rules being collected, it w…
AaronRodden Sep 5, 2020
9cf42fe
Added back arithmetic data collection with bug fix. Edited some comme…
AaronRodden Sep 11, 2020
aeeff9f
Fixed an issue where characters in predicates were being replaced if …
AaronRodden Sep 11, 2020
a7a8210
Changed the decorated ground atoms to have their constants represetnt…
AaronRodden Sep 12, 2020
a19f5e5
Renamed VizDataCollection class to ModelDataCollector, removed whites…
tsalh Sep 15, 2020
3d2fdb1
Fixed if-else styling.
tsalh Sep 15, 2020
3a54d39
Changed how the collection config option is checked during grounding …
eriq-augustine Sep 15, 2020
88f9616
User must now specify a path for model data collection, some style ch…
tsalh Sep 18, 2020
6296afb
Writing a commit to note down next steps for PR
AaronRodden Sep 19, 2020
319bb26
Merge branch 'psl_viz' of https://github.com/AaronRodden/psl into psl…
AaronRodden Sep 19, 2020
4255885
Collected arithmetic rule at different choke point.
tsalh Sep 20, 2020
9f0758a
Commit to recieve a change to data collection
AaronRodden Sep 20, 2020
2fa0f92
Merge branch 'psl_viz' of https://github.com/AaronRodden/psl into psl…
AaronRodden Sep 20, 2020
682b778
Addressed PR comments: parseAtom returns GroundAtom, various style an…
AaronRodden Sep 20, 2020
5cbd94f
Did a style pass, added some comments and double checked additions to…
AaronRodden Sep 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions psl-cli/src/main/java/org/linqs/psl/cli/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
import org.linqs.psl.model.term.Constant;
import org.linqs.psl.parser.ModelLoader;
import org.linqs.psl.parser.CommandLineLoader;
import org.linqs.psl.util.ModelDataCollector;
import org.linqs.psl.util.Reflection;
import org.linqs.psl.util.StringUtils;
import org.linqs.psl.util.Version;
import org.linqs.psl.util.VizDataCollection;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
Expand Down Expand Up @@ -252,15 +252,15 @@ private void modelDataCollection(Model model, InferenceApplication inferenceAppl

// Collect prediction and truth values for each target.
for (Map.Entry<RandomVariableAtom, ObservedAtom> entry : trainingMap.getLabelMap().entrySet()) {
VizDataCollection.addTruth(entry.getKey(), entry.getValue().getValue());
ModelDataCollector.addTruth(entry.getKey(), entry.getValue().getValue());
}

if (closePredictionDB) {
predictionDatabase.close();
}
truthDatabase.close();

VizDataCollection.dissatisfactionPerGroundRule(inferenceApplication.getGroundRuleStore());
ModelDataCollector.dissatisfactionPerGroundRule(inferenceApplication.getGroundRuleStore());
}

private void outputResults(Database database, DataStore dataStore, Set<StandardPredicate> closedPredicates) {
Expand Down Expand Up @@ -442,7 +442,7 @@ private void run() {

if (parsedOptions.hasOption(CommandLineLoader.OPTION_VISUALIZATION)) {
tsalh marked this conversation as resolved.
Show resolved Hide resolved
Options.CLI_VIZ.set(true);
VizDataCollection.setOutputPath(parsedOptions.getOptionValue(CommandLineLoader.OPTION_VISUALIZATION));
ModelDataCollector.setOutputPath(parsedOptions.getOptionValue(CommandLineLoader.OPTION_VISUALIZATION));
}

// Inference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.linqs.psl.util.IteratorUtils;
import org.linqs.psl.util.MathUtils;
import org.linqs.psl.util.Reflection;
import org.linqs.psl.util.VizDataCollection;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import org.linqs.psl.model.term.Variable;
import org.linqs.psl.model.term.VariableTypeMap;
import org.linqs.psl.reasoner.function.FunctionComparator;
import org.linqs.psl.util.ModelDataCollector;
import org.linqs.psl.util.Parallel;

import com.healthmarketscience.sqlbuilder.BinaryCondition;
Expand Down Expand Up @@ -289,6 +290,11 @@ private void groundForNonSummation(Constant[] constants, Map<Variable, Integer>
groundSingleNonSummationRule(constants, variableMap, atomManager, resources);

results.addAll(resources.groundRules);
if (Options.CLI_VIZ.getBoolean()) {
tsalh marked this conversation as resolved.
Show resolved Hide resolved
for (GroundRule groundRule : resources.groundRules) {
ModelDataCollector.addGroundRule(this, groundRule, variableMap, constants);
}
}
resources.groundRules.clear();
resources.accessExceptionAtoms.clear();
}
Expand All @@ -310,6 +316,11 @@ private void groundForSummation(Constant[] constants, Map<Variable, Integer> var
groundSingleSummationRule(constants, variableMap, atomManager, resources);

results.addAll(resources.groundRules);
if (Options.CLI_VIZ.getBoolean()) {
for (GroundRule groundRule : resources.groundRules) {
ModelDataCollector.addGroundRule(this, groundRule, variableMap, constants);
}
}
resources.groundRules.clear();
resources.accessExceptionAtoms.clear();
}
Expand Down Expand Up @@ -337,8 +348,18 @@ private int groundAllNonSummationRule(AtomManager atomManager, GroundRuleStore g
ResultList results = atomManager.executeQuery(new DatabaseQuery(expression.getQueryFormula(), false));
Map<Variable, Integer> variableMap = results.getVariableMap();

int priorResourcesSize = resources.groundRules.size();
for (int groundingIndex = 0; groundingIndex < results.size(); groundingIndex++) {
groundSingleNonSummationRule(results.get(groundingIndex), variableMap, atomManager, resources);
int postGroundingResourcesSize = resources.groundRules.size();
// Checking the size of the resources allows us to verify if a grounding occured or not.
if (Options.CLI_VIZ.getBoolean()) {
if (postGroundingResourcesSize != priorResourcesSize) {
GroundRule groundRule = resources.groundRules.get(resources.groundRules.size()-1);
ModelDataCollector.addGroundRule(this, groundRule, variableMap, results.get(groundingIndex));
}
}
priorResourcesSize = resources.groundRules.size();
}

int count = resources.groundRules.size();
Expand Down Expand Up @@ -411,8 +432,18 @@ private int groundAllSummationRule(AtomManager atomManager, GroundRuleStore grou
ResultList results = database.executeQuery(rawQuery);
Map<Variable, Integer> variableMap = results.getVariableMap();

int priorResourcesSize = resources.groundRules.size();
for (int groundingIndex = 0; groundingIndex < results.size(); groundingIndex++) {
groundSingleSummationRule(results.get(groundingIndex), variableMap, atomManager, resources);
int postGroundingResourcesSize = resources.groundRules.size();
// Checking the size of the resources allows us to verify if a grounding occured or not.
if (Options.CLI_VIZ.getBoolean()) {
if (postGroundingResourcesSize != priorResourcesSize) {
GroundRule groundRule = resources.groundRules.get(resources.groundRules.size()-1);
ModelDataCollector.addGroundRule(this, groundRule, variableMap, results.get(groundingIndex));
}
}
priorResourcesSize = resources.groundRules.size();
}

int count = resources.groundRules.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
import org.linqs.psl.reasoner.function.GeneralFunction;
import org.linqs.psl.util.HashCode;
import org.linqs.psl.util.MathUtils;
import org.linqs.psl.util.ModelDataCollector;
import org.linqs.psl.util.Parallel;
import org.linqs.psl.util.StringUtils;
import org.linqs.psl.util.VizDataCollection;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -160,7 +160,7 @@ public void ground(Constant[] constants, Map<Variable, Integer> variableMap, Ato

// Visualization runtime argument is specified.
if (Options.CLI_VIZ.getBoolean()) {
VizDataCollection.addGroundRule(this, groundRule, variableMap, constants);
ModelDataCollector.addGroundRule(this, groundRule, variableMap, constants);
}

results.add(groundRule);
Expand Down
Loading