Skip to content

Commit

Permalink
FIX Removed some garbage.
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-martins committed Aug 6, 2014
1 parent 6cd849d commit d19b164
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 31 deletions.
4 changes: 2 additions & 2 deletions scripts/train_test_parser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ regularization_parameter_pruner=1e12 # Same for the pruner.
train=true
test=true
prune=true # This will revert to false if model_type=basic.
train_external_pruner=true #false # If true, the pruner is trained separately.
train_external_pruner=false # If true, the pruner is trained separately.
posterior_threshold=0.0001 # Posterior probability threshold for the pruner.
pruner_max_heads=10 # Maximum number of candidate heads allowed by the pruner.
labeled=true # Output dependency labels.
large_feature_set=true # Use a large feature set (slower but more accurate).
case_sensitive=false # Distinguish word upper/lower case.
form_cutoff=0 # Cutoff in word occurrence.
lemma_cutoff=0 # Cutoff in lemma occurrence.
projective=true # Force single-rooted projective trees.
projective=false # If true, force single-rooted projective trees.
model_type=standard # Parts used in the model (subset of "af+cs+gp+as+hb+np+dp+gs+ts").
# Some shortcuts are: "standard" (means "af+cs+gp");
# "basic" (means "af"); and "full" (means "af+cs+gp+as+hb+gs+ts").
Expand Down
4 changes: 2 additions & 2 deletions scripts_srl/train_test_semantic_parser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ test=true
prune=true # This will revert to false if model_type=basic.
prune_labels=true
prune_distances=true
train_external_pruner=false #false # If true, the pruner is trained separately.
trained_external_pruner=true #false # If true, loads the external pruner.
train_external_pruner=false # If true, the pruner is trained separately.
trained_external_pruner=false # If true, loads the external pruner.
posterior_threshold=0.0001 # Posterior probability threshold for the pruner.
pruner_max_arguments=20 #10 # Maximum number of candidate heads allowed by the pruner.
labeled=true # Output semantic labels.
Expand Down
23 changes: 0 additions & 23 deletions src/semantic_parser/FactorPredicateAutomaton.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ class FactorPredicateAutomaton : public GenericFactor {
const vector<double> &additional_log_potentials,
Configuration &configuration,
double *value) {
//LOG(INFO) << "Begin Maximize";
// Decode maximizing over the senses and using the Viterbi algorithm
// as an inner loop.
// If sense=-1, the final score is zero (so take the argmax at the end).
Expand All @@ -147,9 +146,6 @@ class FactorPredicateAutomaton : public GenericFactor {
vector<vector<int> > path(length);
CHECK_GE(length, 1);

//LOG(INFO) << "Sense " << s << " of " << num_senses;
//LOG(INFO) << "length = " << length;

// The start state is a1 = 0.
values[0].resize(1);
values[0][0] = 0.0;
Expand Down Expand Up @@ -180,8 +176,6 @@ class FactorPredicateAutomaton : public GenericFactor {
additional_log_potentials);
}

//LOG(INFO) << "Terminate";

// The end state is a = length.
int best_last_state = -1;
double best_score = -1e12;
Expand All @@ -202,14 +196,11 @@ class FactorPredicateAutomaton : public GenericFactor {
best_score += GetSenseScore(s, variable_log_potentials,
additional_log_potentials);

//LOG(INFO) << "Backtrack";

// Only backtrack if the solution is the best so far.
if (best_score > *value) {
// This is the best sense so far.
best_sense = s;
*value = best_score;
//LOG(INFO) << length;
best_path.resize(length);
best_path[length-1] = best_last_state;

Expand All @@ -228,8 +219,6 @@ class FactorPredicateAutomaton : public GenericFactor {
}
}

//LOG(INFO) << "Write config";

// Now write the configuration.
vector<int> *sense_arguments =
static_cast<vector<int>*>(configuration);
Expand All @@ -240,17 +229,13 @@ class FactorPredicateAutomaton : public GenericFactor {
sense_arguments->push_back(a);
}
}

//LOG(INFO) << "End Maximize";
}

// Compute the score of a given assignment.
void Evaluate(const vector<double> &variable_log_potentials,
const vector<double> &additional_log_potentials,
const Configuration configuration,
double *value) {
//LOG(INFO) << "Begin Evaluate";

const vector<int> *sense_arguments =
static_cast<const vector<int>*>(configuration);
// Sense belong to {-1,0,1,...}
Expand All @@ -276,7 +261,6 @@ class FactorPredicateAutomaton : public GenericFactor {
int a2 = GetLength(s); // Stop position.
*value += GetSiblingScore(s, a1, a2, variable_log_potentials,
additional_log_potentials);
//LOG(INFO) << "End Evaluate";
}

// Given a configuration with a probability (weight),
Expand Down Expand Up @@ -387,10 +371,6 @@ class FactorPredicateAutomaton : public GenericFactor {
map_senses[s] = k;
}

//LOG(INFO) << outgoing_arcs.size() << " outgoing arcs.";
//LOG(INFO) << siblings.size() << " siblings.";


// Create a temporary list of arguments.
// Each argument position will be mapped to a one-based array, in
// which sense_arguments[s][1] = p, sense_arguments[s][2] = p+1 (p-1),
Expand All @@ -406,7 +386,6 @@ class FactorPredicateAutomaton : public GenericFactor {
CHECK_EQ(p, outgoing_arcs[k]->predicate());
int a = outgoing_arcs[k]->argument();
int s = outgoing_arcs[k]->sense();
//LOG(INFO) << "Arc " << s << " " << p << " " << a;
int position = (right)? a-p : p-a;
++position; // Position 0 is reserved for the case a1=-1.
CHECK_GE(position, 1) << p << " " << a;
Expand Down Expand Up @@ -448,8 +427,6 @@ class FactorPredicateAutomaton : public GenericFactor {
int a1 = siblings[k]->first_argument();
int a2 = siblings[k]->second_argument();

//LOG(INFO) << "Sibling " << s << " " << p << " " << a1 << " " << a2;

int position1 = right? a1-p : p-a1;
int position2 = right? a2-p : p-a2;
if (a1 < 0) position1 = -1; // To handle a1=-1.
Expand Down
4 changes: 0 additions & 4 deletions src/semantic_parser/SemanticDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1362,8 +1362,6 @@ void SemanticDecoder::DecodeFactorGraph(Instance *instance, Parts *parts,
}
}

//LOG(INFO) << "Created predicate automata.";

//////////////////////////////////////////////////////////////////////
// Build consecutive co-parent factors.
//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1580,8 +1578,6 @@ void SemanticDecoder::DecodeFactorGraph(Instance *instance, Parts *parts,
factor_graph->SetResidualThresholdAD3(1e-3);
//factor_graph->SetResidualThresholdAD3(1e-6);

//LOG(INFO) << "Running AD3";

// Run AD3.
timeval start, end;
gettimeofday(&start, NULL);
Expand Down

0 comments on commit d19b164

Please sign in to comment.