renaming to DCA

This commit is contained in:
Sida Wang 2017-03-26 10:09:27 -07:00
parent fd9dc4be70
commit 44005b2b9e
10 changed files with 74 additions and 35 deletions

View File

@ -1,15 +1,28 @@
# Readme
## Basics
## Running an experiment
1) Start the server
./interactive/run @mode=voxlurn -Server.port 8410
./interactive/run @mode=voxlurn -Server.port 8410
2) Blast the server with simulator on previous logs, under sandbox mode, to get the server into state
3) Collect and append to more logs
4) For any particular experiment, save the previous log
./interactive/run @mode=voxelurn -Server.port 8410
2) last the server with previous logs to get the server into state
./interactive/run @mode=simulator @server=local @sandbox=none @task=freebig
2) Run analysis script to get results
./interactive/run @mode=analyze -execNumber 1
0) (Optional) clean up
./interactive/run @mode=backup # save previous data logs
./interactive/run @mode=trash # deletes previous data logs
## Tests
./shrdlurn/run @mode=test
./shrdlurn/run @mode=test @class=ActionExecutorTest -verbose 5
There are many units for interactive learning
./interactive/run @mode=test
./interactive/run @mode=test @class=DACExecutorTest -verbose 5
## Running the server for voxelurn
1) Start the sempre server
./interactive/run @mode=voxelurn -Server.port 8410
1) Start the client server
./interactive/run @mode=community
2) (optionallly) Blast the server with previous logs to get the server into state
./interactive/run @mode=simulator @server=local @sandbox=none @task=freebig

View File

@ -16,12 +16,29 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 61,
"metadata": {
"collapsed": false,
"scrolled": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"682\n",
"log.file\tstate/execs/682.exec/log\n",
"Simulator.reqParams\tgrammar=1&cite=1&learn=1&logging=0\n",
"Simulator.logFiles\t./shrdlurn/queries/freebuildbig-0206.def.json.gz\n",
"2495 lines in plotInfo\n",
"[u'java.util.concurrent.TimeoutException', u'java.util.concurrent.TimeoutException', u'java.util.concurrent.TimeoutException', u'java.util.concurrent.TimeoutException', u'java.util.concurrent.TimeoutException']\n",
"errors:69, stats.uncaught_error:5\n",
"{u'stats.head_len': 14, u'remote': u'188.0.26.146', u'format': u'lisp2json', u'stats.num_body': 7, u'stats.json_len': 979, u'q': u'(:def_iso \"add red ring 5\" \"[[\\\\\"repeat 2 [select left]\\\\\",\\\\\"(:loop (number 2) (: select (call adj left)))\\\\\"],[\\\\\"repeat 2 [select front]\\\\\",\\\\\"(:loop (number 2) (: select (call adj front)))\\\\\"],[\\\\\"repeat 5 [add red; select right]; select left\\\\\",\\\\\"(:s (:loop (number 5) (:s (: add red here) (: select (call adj right)))) (: select (call adj left)))\\\\\"],[\\\\\"select back; repeat 4 [add red; select back]; select left; select front\\\\\",\\\\\"(:s (:s (:s (: select (call adj back)) (:loop (number 4) (:s (: add red here) (: select (call adj back))))) (: select (call adj left))) (: select (call adj front)))\\\\\"],[\\\\\"repeat 4 [add red; select left]; select right\\\\\",\\\\\"(:s (:loop (number 4) (:s (: add red here) (: select (call adj left)))) (: select (call adj right)))\\\\\"],[\\\\\"select front; repeat 3 [add red; select front]\\\\\",\\\\\"(:s (: select (call adj front)) (:loop (number 3) (:s (: add red here) (: select (call adj front)))))\\\\\"],[\\\\\"repeat 2 [select back; select right]\\\\\",\\\\\"(:loop (number 2) (:s (: select (call adj back)) (: select (call adj right))))\\\\\"]]\")', u'sessionId': u'MT_AIWEXPJAU66D9', u'queryCount': 1, u'stats.num_rules': 2, u'stats.num_failed': 0, u'time': u'2017-02-03T03:26:45.640', u'stats.time': 0.177893299, u'stats.type': u'def'}\n",
"{'total_rules': 2880, 'total_failed': 819, 'total_def_queries': 2421, 'total_body': 15577}\n",
"failpercent: 0.0526\n"
]
}
],
"source": [
"import csv\n",
"import numpy as np\n",

View File

@ -153,12 +153,12 @@ addMode('voxelurn', 'interactive semantic parsing in a VoxelWorld', lambda { |e|
#figOpts,
o('interactiveLearning', true),
o('Executor', 'interactive.DASExecutor'),
o('LanguageAnalyzer', 'interactive.DASLanguageAnalyzer'),
o('DASExecutor.convertNumberValues', true),
o('DASExecutor.printStackTrace', true),
o('Executor', 'interactive.DCAExecutor'),
o('LanguageAnalyzer', 'interactive.DCALanguageAnalyzer'),
o('DCAExecutor.convertNumberValues', true),
o('DCAExecutor.printStackTrace', true),
o('VoxelWorld.maxBlocks', 100000),
selo(0, 'DASExecutor.worldType', 'VoxelWorld', 'CalendarWorld', 'Otherworld'),
selo(0, 'DCAExecutor.worldType', 'VoxelWorld', 'CalendarWorld', 'Otherworld'),
selo(0, 'Grammar.inPaths', './shrdlurn/voxelurn.grammar', './shrdlurn/calendar.grammar'),
o('Params.initWeightsRandomly', false),
@ -170,13 +170,13 @@ addMode('voxelurn', 'interactive semantic parsing in a VoxelWorld', lambda { |e|
o('Parser.pruneErrorValues', true),
o('Parser', 'BeamFloatingParser'),
o('Parser.callSetEvaluation', false),
o('Parser.beamSize', 100),
o('Parser.beamSize', 25),
o('ParserState.customExpectedCounts', 'None'),
selo(0, 'BeamFloatingParser.floatStrategy', 'Never', 'NoParse', 'Always'),
o('BeamFloatingParser.trackedCats', 'Number', 'Numbers', 'Color', 'Direction', 'Set', 'Sets', 'Action', 'Actions'),
o('BeamFloatingParser.maxNewTreesPerSpan', 1000),
o('BeamFloatingParser.maxNewTreesPerSpan', 100),
o('Params.l1Reg', 'nonlazy'),
o('Params.l1RegCoeff', 0.0001),
@ -185,7 +185,7 @@ addMode('voxelurn', 'interactive semantic parsing in a VoxelWorld', lambda { |e|
o('Params.adaptiveStepSize', true),
#o('Params.stepSizeReduction', 0.25),
o('FeatureExtractor.featureComputers', 'interactive.DASFeatureComputer'),
o('FeatureExtractor.featureComputers', 'interactive.DCAFeatureComputer'),
o('FeatureExtractor.featureDomains', ':rule', ':span', ':stats', ':scope', ':social', ':window'),
# o('FeatureExtractor.featureDomains', ':rule'),

View File

@ -23,7 +23,7 @@ import fig.basic.Option;
* supports ActionFormula here, and does conversions of singleton sets
* @author Sida Wang
*/
public class DASExecutor extends Executor {
public class DCAExecutor extends Executor {
public static class Options {
@Option(gloss = "Whether to convert NumberValue to int/double") public boolean convertNumberValues = true;
@Option(gloss = "Whether to convert name values to string literal") public boolean convertNameValues = true;

View File

@ -15,7 +15,7 @@ import edu.stanford.nlp.sempre.*;
* - control what categories to abstract out
* - efficiency improvement, right now use all members of the cross product
*/
public class DASFeatureComputer implements FeatureComputer {
public class DCAFeatureComputer implements FeatureComputer {
public static class Options {
@Option(gloss = "Verbosity")
public int verbose = 0;

View File

@ -10,7 +10,7 @@ import edu.stanford.nlp.sempre.LanguageInfo;
*
* @author sidaw
*/
public class DASLanguageAnalyzer extends LanguageAnalyzer {
public class DCALanguageAnalyzer extends LanguageAnalyzer {
// Stanford tokenizer doesn't break hyphens.
// Replace hypens with spaces for utterances like
// "Spanish-speaking countries" but not for "2012-03-28".

View File

@ -0,0 +1,9 @@
package edu.stanford.nlp.sempre.interactive;
import java.util.List;
import edu.stanford.nlp.sempre.*;
public class Definition {
public Definition(Example head, List<Derivation> chartList, List<Example> body) {
}
}

View File

@ -13,7 +13,7 @@ import edu.stanford.nlp.sempre.Formulas;
import edu.stanford.nlp.sempre.Json;
import edu.stanford.nlp.sempre.NaiveKnowledgeGraph;
import edu.stanford.nlp.sempre.StringValue;
import edu.stanford.nlp.sempre.interactive.DASExecutor;
import edu.stanford.nlp.sempre.interactive.DCAExecutor;
import edu.stanford.nlp.sempre.interactive.Item;
import edu.stanford.nlp.sempre.interactive.World;
import edu.stanford.nlp.sempre.interactive.voxelurn.Color;
@ -27,9 +27,9 @@ import fig.basic.LogInfo;
*/
public class DASExecutorTest {
DASExecutor executor = new DASExecutor();
DCAExecutor executor = new DCAExecutor();
protected static void runFormula(DASExecutor executor, String formula, ContextValue context, Predicate<World> checker) {
protected static void runFormula(DCAExecutor executor, String formula, ContextValue context, Predicate<World> checker) {
LogInfo.begin_track("formula: %s", formula);
executor.opts.worldType = "VoxelWorld";
Executor.Response response = executor.execute(Formulas.fromLispTree(LispTree.proto.parseFromString(formula)), context);

View File

@ -8,7 +8,7 @@ import java.util.function.Predicate;
import fig.basic.*;
import edu.stanford.nlp.sempre.*;
import edu.stanford.nlp.sempre.Parser.Spec;
import edu.stanford.nlp.sempre.interactive.DASExecutor;
import edu.stanford.nlp.sempre.interactive.DCAExecutor;
import org.testng.Assert;
import org.testng.annotations.Test;
@ -50,15 +50,15 @@ public class FloatingParsingTest {
private static Spec defaultSpec() {
FloatingParser.opts.defaultIsFloating = true;
DASExecutor.opts.convertNumberValues = true;
DASExecutor.opts.printStackTrace = true;
DASExecutor.opts.worldType = "VoxelWorld";
DCAExecutor.opts.convertNumberValues = true;
DCAExecutor.opts.printStackTrace = true;
DCAExecutor.opts.worldType = "VoxelWorld";
Grammar.opts.inPaths = Lists.newArrayList("./shrdlurn/voxelurn.grammar");
Grammar.opts.useApplyFn = "interactive.ApplyFn";
Grammar.opts.binarizeRules = false;
DASExecutor executor = new DASExecutor();
DASExecutor.opts.worldType = "BlocksWorld";
DCAExecutor executor = new DCAExecutor();
DCAExecutor.opts.worldType = "BlocksWorld";
FeatureExtractor extractor = new FeatureExtractor(executor);
FeatureExtractor.opts.featureDomains.add("rule");
ValueEvaluator valueEvaluator = new ExactValueEvaluator();

View File

@ -29,7 +29,7 @@ import edu.stanford.nlp.sempre.ParserState;
import edu.stanford.nlp.sempre.Rule;
import edu.stanford.nlp.sempre.Session;
import edu.stanford.nlp.sempre.ValueEvaluator;
import edu.stanford.nlp.sempre.interactive.DASExecutor;
import edu.stanford.nlp.sempre.interactive.DCAExecutor;
import edu.stanford.nlp.sempre.interactive.DefinitionAligner;
import edu.stanford.nlp.sempre.interactive.GrammarInducer;
import edu.stanford.nlp.sempre.interactive.ILUtils;
@ -45,9 +45,9 @@ public class GrammarInducerTest {
private static Spec defaultSpec() {
FloatingParser.opts.defaultIsFloating = true;
DASExecutor.opts.convertNumberValues = true;
DASExecutor.opts.printStackTrace = true;
DASExecutor.opts.worldType = "VoxelWorld";
DCAExecutor.opts.convertNumberValues = true;
DCAExecutor.opts.printStackTrace = true;
DCAExecutor.opts.worldType = "VoxelWorld";
Derivation.opts.showTypes = false;
Derivation.opts.showRules = false;
@ -66,7 +66,7 @@ public class GrammarInducerTest {
GrammarInducer.opts.verbose = 2;
InteractiveMaster.opts.useAligner = true;
DASExecutor executor = new DASExecutor();
DCAExecutor executor = new DCAExecutor();
FeatureExtractor extractor = new FeatureExtractor(executor);