6
$\begingroup$

This topic is actually rather hard to google for as 'tree' has been overloaded in this domain to refer to decision trees.

I'd be interested in having a learning algorithm produce code, such as used in Microsoft Power BI's feature to query databases using natural language ('Q&A', formerly 'InfoNav').

Evidently, natural language and database queries can both be expressed as text, so we have a good answer: recurrent neural networks.

However, if we take at SQL queries for one, then intuitively the actual prediction job can be simplified if we'd look at their AST representation rather than their textual one.

If we were to predict an AST representation, language keywords would suddenly no longer clog up the output vector to be predicted, as we could use the BNF describing the language and have the decisions at each node be represented as an integer or the like, along with other info (e.g. the content of number/string literals).

Is there a standard way to approach this? What are best practices here?

Wikipedia has an article on structured prediction, but obviously it's based on theory and academics, and even articles featured are fairly old (for ML), so I'm inclined to think it may not necessarily tell me much about current best practice, if any...

$\endgroup$
4
  • 1
    $\begingroup$ This is way out of my experience, but a quick search suggests this might be relevant? (as a more specific and recent article that is well cited, rather than an answer per se.) $\endgroup$
    – GeoMatt22
    Jun 20, 2017 at 17:49
  • 1
    $\begingroup$ Rather than recurrent, see recursive neural networks. The Wikipedia intro: A recursive neural network (RNN) is a kind of deep neural network created by applying the same set of weights recursively over a structure, to produce a structured prediction over variable-size input structures, or a scalar prediction on it, by traversing a given structure in topological order. RNNs have been successful for instance in learning sequence and tree structures in natural language processing, mainly phrase and sentence continuous representations based on word embedding. $\endgroup$
    – User0
    Jun 20, 2017 at 18:52
  • $\begingroup$ Thanks guys, looks like recursive nets do indeed seem the answer. It looks like we may have a good implementation in TensorFlow Fold. If either of you would like to post this as an answer I'll gladly accept. $\endgroup$ Jun 21, 2017 at 4:21
  • $\begingroup$ in retrospect, genetic programming, a type of evolutionary algorithm, is also relevant here. $\endgroup$ Nov 6, 2018 at 15:31

1 Answer 1

2
$\begingroup$

I know its too late to answer, but still find below:

I think you are looking for Natural language to SQL statement kind of problem statement, there are few solutions developed in last few months listed below:

  1. SEQ2SEQ method for SEQ2SQL
  2. SQLNET https://arxiv.org/pdf/1711.04436.pdf

few more: https://github.com/sriniiyer/nl2sql

Enjoy!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.