<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>A Database Framework for Classifier Engineering</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Benny Kimelfeld</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Christopher Re´</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>LogicBlox, Inc.</institution>
          <addr-line>and Technion</addr-line>
          ,
          <country country="IL">Israel</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Stanford University</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>: f 1; 1gn ! f 1; 1g where n is a natural number that we call the arity of . A classifier class is a (possibly infinite) family of classifiers. We denote by n the restriction of to the n-ary classifiers in . An n-ary training collection is a multiset T of pairs hx; yi where x 2 f 1; 1gn and y 2 f 1; 1g. We denote by Tn the set of all n-ary training collections. A cost function for a classifier class is a function of the form</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        In the design of machine-learning solutions, a critical and often the most resourceful
task is that of feature engineering [
        <xref ref-type="bibr" rid="ref4 ref7">7, 4</xref>
        ], for which recipes and tooling have been
developed [
        <xref ref-type="bibr" rid="ref3 ref7">3, 7</xref>
        ]. In this vision paper we embark on the establishment of database
foundations for feature engineering. We propose a formal framework for classification, in the
context of a relational database, towards investigating the application of database and
knowledge management to assist with the task of feature engineering. We demonstrate
the usefulness of this framework by formally defining two key algorithmic challenges
within: (1) separability refers to determining the existence of feature queries that agree
with the given training examples, and (2) identifiability is the task of testing for the
property of independence among features (given as queries). Moreover, we give
preliminary results on these challenges, in the context of conjunctive queries. We focus
here on boolean features that are represented as ordinary database queries, and view
this work as the basis of various future extensions such as numerical features and more
general regression tasks.
We first present our formal framework for classification with binary features within a
relational database.
2.1
      </p>
      <p>Classifiers and Learning
In this work, a classifier is a function of the form
where R 0 is the set of nonnegative numbers. In the context of a classifier class and
a cost function c, learning a classifier is the task of finding a classifier 2 n that
minimizes c( ; T ), given a training collection T 2 Tn.</p>
      <p>We illustrate the above definitions on the important class of linear classifiers. An
n-ary linear classifier is parameterized by a vector w 2 Rn, is denoted by w, and is
defined as follows for all a 2 f 1; 1gn.</p>
      <p>w(a) =def
where “ ” denotes the operation of dot product. By Lin we denote the class of linear
classifiers. An example of a cost function is the least square cost lsq that is given by
lsq ( w; T ) =def
(x w</p>
      <p>y)2</p>
      <p>X
hx;yi2T
for the arguments</p>
      <p>w 2 Linn and T 2 Tn.
2.2</p>
      <p>Relational Formalism
Our relational terminology is as follows. A schema is a pair (A; ), where A is a
signature that consists of relation symbols, and is a set of logical integrity constraints
over A. Each relation symbol R has an associated arity. We assume an infinite set Const
of constants. An instance I over a schema S = (A; ) associates with every k-ary
relation symbol R 2 A a finite subset RI of Constk, such that all the constraints of
are satisfied. The active domain of an instance I, denoted adom(I), is the set of all the
constants in Const that are mentioned in I.</p>
      <p>Let S be schema. A query (over S) is a function Q that is associated with an arity
k, and that maps every relation instance I over S into a finite subset Q(I) of Constk. A
query Q0 contains a query Q if Q(I) Q0(I) for all instances I over S; if Q Q0 and
Q0 Q then Q and Q0 are said to be equivalent. A query Q is additive if for every two
instances I1 and I2, if adom(I1) and adom(I2) are disjoint, then</p>
      <p>Q(I1 [ I2) = Q(I1) [ Q(I2) :
A query class is a mapping that associates with every schema S a class of queries over
S. An example of a query class is that of the conjunctive queries. A conjunctive query
(CQ) is represented by the logical formula q(x) that has the form
9y[ 1(x; y; d) ^
^
m(x; y; d)]
where x and y are disjoint sequences of variables, d is a sequence of constants, and each
i is an atomic query over S (i.e., a formula that consists of a single relation symbol and
no logical operators). The result of applying the CQ Q = q(x) to the instance I consists
of all the tuples a (of the same length as x) such that q(a) is true in I; we denote this
result is denoted by Q(I).
2.3</p>
      <p>Classification Framework
We now present our formal framework. An entity schema is a triple (A; ; E), where
(A; ) is a schema and E is a relation symbol in A that represents the entities (as
tuples). An instance I over a schema (A; ; E) is simply an instance over (A; ).
Intuitively, an instance I over an entity schema (A; ; E) represents a set of entities, namely
EI (i.e., the set of tuples in E), along with information about the entities that is
contained in the remaining relations RI . For example, E may be the relation Persons and
A may include, besides Persons, relations such as PersonAddress, PersonCompany,
CompanyCity, and so on. If S = (A; ; E) is an entity schema, then the elements A,
and E are denoted by AS, S and ES, respectively.</p>
      <p>Let S be an entity schema, and let I be an instance over S. A feature query (over
S) is a query over the schema S, such that ES, where ES is viewed as the query
that, given an instance I, copies the relation ESI. In other words, a feature query is a
query that selects entities. For example, if E is Persons(ssn; name) then a feature can
be the following CQ q(s; n) (selecting persons working in New York City).</p>
      <p>9c Persons(s; n) ^ PersonCompany(s; c) ^ CompanyCity(c; ‘NYC’)
If is a feature query, then I denotes the function f : ESI ! f 1; 1g where
f (e) =
(1</p>
      <p>if e 2
1 otherwise.</p>
      <p>(I);
A statistic (over S) is a sequence = ( 1; : : : ; n) of feature queries. We denote by
I the function ( 1I ; : : : ; nI) from ESI to f 1; 1gn.</p>
      <p>A feature schema is a pair (S; ), where S is an entity schema, and is a statistic
over S that produces a sequence of features for every entity of a given input instance.
We say that and (S; ) are in a query class Q if every query in belongs to Q. A
training instance over S is a pair (I; o), where I is an instance over S and o : ESI !
f 1; 1g is a function that partitions the entities into positive and negative examples.
Given a feature schema (S; ) and a classifier class , the training instance (I; o)
defines the training collection that consists of the tuple h I (e); o(e)i for every e 2 ESI.
3</p>
    </sec>
    <sec id="sec-2">
      <title>Feature Engineering</title>
      <p>In feature engineering, one devises feature queries for a classification task. Next, we
discuss two computational challenges that naturally arise in feature engineering.
3.1</p>
      <p>Separability
Let (S; ) be a feature schema, and let be a classifier class. A training instance (I; o)
is said to be -separable with respect to (w.r.t.) if there exists a classifier 2 that
fully agrees with o; that is, and have the same arity, and (e) = o(e) for every
e 2 ESI. We define the following core computational problem.</p>
      <p>Problem 1 (Separability). Let S be an entity schema, let Q be a query class over S, and
let be a classifier class. The separability problem is the following. Given a training
instance (I; o) over S, determine whether there exists a statistic in Q such that (I; o)
is -separable w.r.t. .</p>
      <p>The separability problem, as defined, can be extended in various practical
directions. The input can include a bound N on the length n of the statistic (hence,
limiting the model complexity, which results in classifiers that are more efficient and
less overfitting). One can allow for an approximate agreement with o (e.g., the classifier
should agree with o on at least (1 ) of the entities, or at most k examples should
be misclassified). And one can impose various constraints on common query classes
Q (e.g., limit the size of queries, number of constants, etc., again to limit the model
complexity and potential overfitting). The following theorem considers the complexity
of testing for separability in the case where the class of queries is that of CQs without
constants,3 which we denote by CQnc. It states that, in the absence of such extensions
of the problem, it can very quickly get intractable.</p>
      <p>Theorem 1. Let Q be the class CQnc, and let be the class Lin. For every entity
schema S, separability is in NP. Moreover, there exists an entity schema S such that
separability is NP-complete.</p>
      <p>
        The proof of membership in NP is using the concept of a canonical database [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], and
the proof of NP-hardness is by a reduction from the maximum-clique problem.
      </p>
      <p>
        We note that a problem similar to separability has been studied in a recent paper by
Cohen and Weiss [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], where data are labeled graphs and features are tree patterns.
3.2
      </p>
      <p>Statistic Identifiability
We denote by 0m the vector of m zeroes. Let M be an n k real matrix. A linear column
dependence in M is a weight vector w 2 Rk such that w 6= 0k and M w = 0n; if
M does not have any linear column dependence, then we say that M is linearly column
independent. Let (S; ) be a feature schema, and let I be an instance of S. We fix
an arbitrary order over the entities in ESI, and denote by J I K the matrix that consists
of the rows I (e) for every e 2 ESI in order. The second computational problem we
define is the following.</p>
      <p>Problem 2 (Identifiability). Let Q be a query class. Identifiability is the problem of
testing, given a feature schema (S; ) in Q, whether there exists an instance I over S
such that the matrix J I K is linearly column independent; in that case, we say that
is identifiable.</p>
      <p>
        Identifiability is an important property in the design of machine-learning solutions [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
Particularly, in the case of the classifier class Lin and the cost function lsq , this property
implies that there is a single optimal classifier, whereas its absence implies that the
space of optimal solutions is unbounded.
3 For CQs with constants, the problem is trivial and not interesting, since the positive examples
can be hardcoded into the statistic.
      </p>
      <p>Next, we show that in the case of CQs. identifiability amounts to query equivalence.
A statistic is said to have redundancy if it contains two distinct feature queries that
are equivalent.</p>
      <p>Theorem 2. Let Q be the query class of additive CQs, and let (S; ) be a feature
schema such that is in Q. Then is identifiable if and only if has no redundancy.</p>
      <p>
        We conclude with comments on Theorem 2. First, this theorem is proved again
by applying the concept of a canonical database of a CQ. Second, we can extend the
theorem to the class of all CQs, but the condition that characterizes identifiability is
significantly more complicated (and will be given in the extended version of this paper).
Third, this theorem generalizes to affine independence, which is important in different
cost functions such as maximum entropy [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Finally, by an immediate application of
the NP-completeness of CQ containment [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] we get that identifiability is NP-complete
in the case of additive CQs.
      </p>
    </sec>
    <sec id="sec-3">
      <title>Acknowledgments</title>
      <p>Benny Kimelfeld is a Taub Fellow, supported by the Taub Foundation. The research of
Christopher Re´ is supported by DARPA’s projects XDATA (FA8750-12-2-0335), DEFT
(FA8750-13-2-0039), MEMEX, and SIMPLEX. His research is also supported by NSF
Career Award IIS-1353606, ONR Awards N000141210041 and N000141310129, NIH
Grant U54EB020405 (awarded by NIBIB through funds provided by the trans-NIH
BD2K initiative), the Sloan Research Fellowship, the Moore Foundation, American
Family Insurance, Google, and Toshiba. Any opinions, findings, and conclusions or
recommendations expressed in this material are those of the authors and do not
necessarily reflect the views of DARPA, AFRL, NSF, ONR, NIH, or the U.S. government.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>A. K.</given-names>
            <surname>Chandra</surname>
          </string-name>
          and
          <string-name>
            <given-names>P. M.</given-names>
            <surname>Merlin</surname>
          </string-name>
          .
          <article-title>Optimal implementation of conjunctive queries in relational data bases</article-title>
          . In J. E.
          <string-name>
            <surname>Hopcroft</surname>
            ,
            <given-names>E. P.</given-names>
          </string-name>
          <string-name>
            <surname>Friedman</surname>
          </string-name>
          , and M. A. Harrison, editors,
          <source>STOC</source>
          , pages
          <fpage>77</fpage>
          -
          <lpage>90</lpage>
          . ACM,
          <year>1977</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>S.</given-names>
            <surname>Cohen</surname>
          </string-name>
          and
          <string-name>
            <given-names>Y. Y.</given-names>
            <surname>Weiss</surname>
          </string-name>
          .
          <article-title>Learning Tree Patterns from Example Graphs</article-title>
          . In M. Arenas and M. Ugarte, editors,
          <source>18th International Conference on Database Theory (ICDT</source>
          <year>2015</year>
          ), volume
          <volume>31</volume>
          <source>of Leibniz International Proceedings in Informatics (LIPIcs)</source>
          , pages
          <fpage>127</fpage>
          -
          <lpage>143</lpage>
          , Dagstuhl, Germany,
          <year>2015</year>
          .
          <article-title>Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>I.</given-names>
            <surname>Guyon</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Gunn</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Nikravesh</surname>
          </string-name>
          , and
          <string-name>
            <given-names>L. A.</given-names>
            <surname>Zadeh</surname>
          </string-name>
          . Feature Extraction:
          <article-title>Foundations and Applications (Studies in Fuzziness</article-title>
          and Soft Computing). Springer-Verlag New York, Inc., Secaucus, NJ, USA,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>S.</given-names>
            <surname>Kandel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Paepcke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. M.</given-names>
            <surname>Hellerstein</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.</given-names>
            <surname>Heer</surname>
          </string-name>
          .
          <article-title>Enterprise data analysis and visualization: An interview study</article-title>
          .
          <source>IEEE Trans. Vis. Comput. Graph.</source>
          ,
          <volume>18</volume>
          (
          <issue>12</issue>
          ):
          <fpage>2917</fpage>
          -
          <lpage>2926</lpage>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>E. L.</given-names>
            <surname>Lehmann</surname>
          </string-name>
          and
          <string-name>
            <given-names>G.</given-names>
            <surname>Casella</surname>
          </string-name>
          .
          <article-title>Theory of point estimation</article-title>
          , volume
          <volume>31</volume>
          . Springer,
          <year>1998</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>M. J.</given-names>
            <surname>Wainwright</surname>
          </string-name>
          and
          <string-name>
            <given-names>M. I.</given-names>
            <surname>Jordan</surname>
          </string-name>
          .
          <article-title>Graphical models, exponential families, and variational inference</article-title>
          .
          <source>Foundations and Trends in Machine Learning</source>
          ,
          <volume>1</volume>
          (
          <issue>1</issue>
          -2):
          <fpage>1</fpage>
          -
          <lpage>305</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>C.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Kumar</surname>
          </string-name>
          , and
          <string-name>
            <surname>C. R.</surname>
          </string-name>
          <article-title>Materialization optimizations for feature selection workloads</article-title>
          .
          <source>In SIGMOD Conference</source>
          , pages
          <fpage>265</fpage>
          -
          <lpage>276</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>