Open
Conversation
joernhees
requested changes
Feb 8, 2017
Member
joernhees
left a comment
There was a problem hiding this comment.
please rebase on master and cleanup...
graph_pattern.py
Outdated
|
|
||
| def to_find_edge_var_for_narrow_path_query(self, edge_var, node_var, | ||
| vars_, filter_node_count, | ||
| filter_edge_count, limit_res): |
graph_pattern.py
Outdated
| '(dbr:Adult dbr:Child)' \ | ||
| '(dbr:Angel dbr:Heaven)' \ | ||
| '(dbr:Arithmetic dbr:Mathematics)' \ | ||
| '}\n' % (' '.join([v.n3() for v in vars_])) |
Member
There was a problem hiding this comment.
that should be replaced by the values part... also dbr:<SPACE>Anything won't work...
graph_pattern.py
Outdated
| EDGE_VAR_COUNT = Variable('edge_count_var') | ||
| NODE_VAR_COUNT = Variable('node_count_var') | ||
| MAX_NODE_COUNT = Variable('maximum node count') | ||
| PRIO_VAR = Variable('priority') |
Member
There was a problem hiding this comment.
PEP8 (2 newlines above functions)
requirements.txt
Outdated
| rdflib==4.2.1 | ||
| scikit-learn==0.17.1 | ||
| scipy==0.17.0 | ||
| scipy |
tests/test_gp_learner_offline.py
Outdated
| ]) | ||
| filter_node_count = 10 | ||
| filter_edge_count = 1 | ||
| limit_res = 32 |
tests/test_gp_learner_offline.py
Outdated
| filter_node_count = 10 | ||
| filter_edge_count = 1 | ||
| limit_res = 32 | ||
| vars_ = {SOURCE_VAR,TARGET_VAR} |
tests/test_gp_learner_offline.py
Outdated
| if __name__ == '__main__': | ||
| test_mutate_deep_narrow_path() No newline at end of file | ||
| # test_mutate_deep_narrow_path() | ||
| test_to_find_edge_var_for_narrow_path_query() No newline at end of file |
Member
There was a problem hiding this comment.
always have a newline at end of file...
graph_pattern.py
Outdated
| res += ' SELECT DISTINCT %s %s (COUNT(%s) AS %s) WHERE {\n' % ( | ||
| ' '.join([v.n3() for v in vars_]), | ||
| edge_var.n3(), node_var.n3(), NODE_VAR_COUNT.n3()) | ||
| # res += self._sparql_values_part(values) |
Member
There was a problem hiding this comment.
why not use that? set indent accordingly...
joernhees
requested changes
Feb 13, 2017
| MUTPB_DN_FILTER_EDGE_COUNT = 1 | ||
| MUTPB_DN_QUERY_LIMIT = 32 | ||
| # for import in helpers and __init__ | ||
|
|
gp_learner.py
Outdated
| import config | ||
| from gp_query import ask_multi_query | ||
| from gp_query import ask_multi_query, \ | ||
| variable_substitution_deep_narrow_mut_query |
Member
There was a problem hiding this comment.
use same style as surrounding code please
gp_learner.py
Outdated
| '\n'.join([' %d: %s' % (c, v.n3()) | ||
| for v, c in substitution_counts.most_common()]), | ||
| ) | ||
| fixed = 'Y' |
gp_learner.py
Outdated
| mutate_fix_var_filter(substitution_counts) | ||
| if not substitution_counts: | ||
| # could have happened that we removed the only possible substitution | ||
| fixed = 'N' |
| else: | ||
| new_triple = (var_node, var_edge, node) | ||
| return new_triple, var_node | ||
| return new_triple, var_node, var_edge |
Member
There was a problem hiding this comment.
changing this needs adaptation of all users of this function...
gp_learner.py
Outdated
| logger.debug("tried to fix a var %s without result:\n%s" | ||
| "seems as if the pattern can't be fulfilled!", | ||
| edge_var, child.to_sparql_select_query()) | ||
| fixed = 'N' |
gp_learner.py
Outdated
| test_gp = gp + [new_triple] | ||
| test_gp, fixed = _mutate_deep_narrow_path_helper( | ||
| sparql, timeout, gtp_scores, test_gp, var_edge, var_node) | ||
| if fixed == 'Y': |
gp_query.py
Outdated
|
|
||
| def variable_substitution_deep_narrow_mut_query( | ||
| sparql, timeout, graph_pattern, edge_var, node_var, | ||
| source_target_pairs, limit_res, batch_size=config.BATCH_SIZE): |
45dc6e5 to
94f9ee2
Compare
…nd args passing, also tons of minor things
…oc string example
94f9ee2 to
72fc46a
Compare
72fc46a to
1b74508
Compare
1b74508 to
3e7b352
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.