Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
To address this challenge, in this paper we de- planning [6] and hierarchical reinforcement learning
scribe the Maana Meta-learning service which [7]. Symbolic plans generated from a pre-defined
provides interpretable automated machine learn- symbolic formulation of a dynamic domain is used
ing. The goal of this project is two-folded. First, to guide reinforcement learning, and recently this
we hope that the efficiency of developing data approach is generalized to improve interpretability
science solutions can be improved by leveraging of deep reinforcement learning. In the setting of
an automated search and profiling algorithm such AutoML, generating machine learning pipelines is
that a baseline solution can be automatically gen- treated as a symbolic planning problem on an action
erated for the data scientists to fine-tune. Second, description in action language BC[8] that contains
we hope that such automated search process is actions such as preprocessing, featurizing, cross val-
transparent to human users, and through learning idation, training and prediction. The pipeline is sent
process the service can return interpretable insights to execution where each symbolic action by map-
on the choice of models and hyper-parameters and ping to primitive actions in a Markov Decision Pro-
encode them as knowledge. Contrasted with most cess [9] (MDP) space, which are ML pipeline com-
AutoML systems that provide end-to-end solutions, ponents instantiated with random hyper-parameters,
the Maana Meta-learning service is an interactive in order to learn the quality of the actions in the
assistant to data scientists that performs user-guided, pipeline. The learning process is value iteration
machine-assisted automated machine learning. By on R-learning [10], [11], where cross-validation
having data scientists specify a pre-determined accuracy of the pipeline is used as rewards. After
search space, and Meta-learning service then goes the quality of the current pipeline is measured, an
through several stages to perform model selection, improved ML pipeline is generated thereafter using
pipeline profiling and hyper-parameter tuning. Dur- the learned values, and the interaction with learning
ing this process, it returns intermediate results and continues, until no better pipeline can be found.
user can inject feedback to steer the search process. This step is called model profiling. After that, a
Finally, it generates an optimal pipeline along with more systematic parameter sweeping is performed,
structured knowledge encoding the decision mak- i.e., model searching. This allows us to describe
ing process, leading to an interpretable automated the pipeline steps in an intuitive representation and
machine learning process. explore the program space more systematically and
Maana Meta-Learning service features two com- efficiently with the help of reinforcement learning.
ponents: (1) a knowledge representation that cap- In this paper, we demonstrate that Maana Meta-
tures domain knowledge of data scientists and (2) learning provides a decent baseline on a variety of
an AutoML algorithm that generates machine learn- data sets, involving both binomial and multinomial
ing pipeline, evaluates their efficacy by sampling classification tasks on various data types. Further-
hyper-parameters, and encodes all the information more, when knowledge instance is filled into the
about the choices made and subsequent perfor- pre-defined knowledge schema, the insights derived
mance / parameters into the knowledge representa- from Meta-learning process can be visualized as
tion. The knowledge representation is defined using a knowledge graph, improving interpretability and
GraphQL1 . Developed by Facebook as an alternative facilitating knowledge sharing, sustaining as well as
to the popular REST interface [4], GraphQL pro- transferring to similar tasks. We show that by using
vides only a single API endpoint for data access, an interactive process leveraging domain knowledge
backed by a structured, hierarchical type system. and user feedback to populate knowledge into a
Consequently, it allows us to define a knowledge structured knowledge graph, in order to address
taxonomy to capture concepts of machine learning the interpretable automated machine learning sought
pipelines, seamlessly populate facts to the prede- after by industrial application of data science.
fined knowledge graph and reason with them. The
AutoML algorithm, in charge of generating and
II. R ELATED W ORK
choosing which pipelines to pursue, is based on
PEORL framework [5], an integration of symbolic In contrast with optimizing the selection of model
parameters, the goal of the AutoML task is to
1
https://graphql.org/ optimize an entire machine learning pipeline. That
3
is, starting from the raw data, it concerns itself only certain data types are compatible with certain
with everything, including optimal selection of fea- featurizers). Combined with R-Learning [10], feed-
turization, selection of algorithm, hyper-parameter back on actions taken is learned in order to generate
selection as well as the cohesive collection of these new plans.
as an ensemble. The most recent and most relevant
approaches to the AutoML paradigm are Auto- III. P RELIMINARIES
WEKA and Auto-SKLEARN. Auto-WEKA [1] [12] A. GraphQL and Maana Knowledge Platform
call this the combined algorithm selection and hy- GraphQL is a unified layer for data access and
perparameter optimization problem or CASH. This manipulation. In a distributed system, it is located
approach is formalized as a Bayesian optimiza- at the same layer like REST, SOAP, and XMLRPC,
tion problem where it sequentially tests different that means it is used as an abstraction layer to
hide the database internals. A GraphQL schema
pipelines based on the performance of the last using consists of a hierarchical definition of types and
what is called a sequential model-based optimiza- the operations that can be applied on times, i.e.,
tion (SMBO) formulation [13]. In combination with queries and mutations. GraphQLs type system is
the algorithms available in the WEKA library[14], very expressive and supports features like inher-
they provide a complete package targeted toward itance, interfaces, lists, custom types, enumerated
non-expert users, allowing them to build machine types. By default, every type is nullable, i.e. not
every value specified in the type system or query
learning solutions without necessarily knowing the has to be provided. Every GraphQL type system
details required to do so. Auto-SKLEARN [2] ap- must specify a special root type called Query, which
proaches the AutoML task in much the same way serves as the entry point for the querys validation
by treating it as a Bayesian optimization problem. and execution. One example of a GraphQL schema
However, they claim that by giving a ”warmstart” definition is shown as follows. It contains two types:
to the optimization procedure, the time to reach Person that contains fields of name (the punctual
! denotes non-empty fields), age, a list of instances
performant pipelines is significantly reduced. That of books (denoted by brackets []), and a list of
is, they pre-select possible good configurations to instances friends, and a type Book with fields title
begin the procedure. Thus their goal is to increase and a list of persons as authors. Furthermore, there
the efficiency of and reduce time to build. Addi- are 3 queries that retrieve an instance of Person by
tionally, instead of the WEKA library, they use name, an instance of book by title, and a list of
the scikit-learn library [15]. Recent system Key- books by applying a filter. There is also a mutation
StoneML [16] uses technique similar to database that adds a person by providing a name.
query optimization to optimize machine learning type Person{
pipelines end-to-end, where ML operator has a name : String!
age : Integer
declarative logical representation. By comparison,
books(favorite: Boolean) : [Book]
our work has a different focus and scope. Instead friends : [Person]
of directly outputting the best machine learning }
pipeline and providing a one-to-one solution, we type Book {
focus on an interactive process where data scientists title : String!
use this service to explore their predefined search authors : [Person]
}
space and refine their decision. In this setting,
type Query {
Meta-learning provides “user-guided, machine as- person(name : String!) : Person
sisted” automated search and facilitates encoding book(title : String!) : Book
knowledge and decision making process and address books(filter : String!) : [Book]
the challenge of interpretability of data science }
solutions. The intepretability of automated machine type Mutation {
learning and knowledge derived from the search addPerson(name:String!) : Boolean
}
algorithm is enabled leveraging PEORL framework
[5], which is a combination of symbolic planning Such schema provides an representational ab-
and reinforcement learning. Symbolic planning [6] straction of operations and the data they manip-
generates possible sequences of actions to achieve ulates, and connects the front-end query/mutation
a goal which are pre-defined and logic-based (e.g. calls with the back-end implementation details.
4
Maana Knowledge Platform2 is architected based where ρ is a value that will be further updated by
on Graphql-based microservices where their type reinforcement learning. Reinforcement learning is
systems are connected with each other to become a achieved by R-Learning [10], [11], i.e., performing
Computational Knowledge Graph (CKG). Different value iteration
from traditional semantic systems based on ontology
and description logic [17], the CKG separates the α
Rt+1 (st , at ) ←−t rt − ρt (st ) + max Rt (st+1 , a),
conceptual modeling of data, the content of the a
βt
data and the operations on the data. This separa- ρt+1 (st ) ←
− rt + max Rt (st+1 , a) − max Rt (st , a)
a a
tion enables a fluidity of modeling, allowing data (1)
from any source and in any format to be seam- to approximate policy that achieves maximal long
lessly integrated, modeled, searched, analyzed, op- term average reward using R and gain reward using
erationalized and re-purposed. Each resulting model ρ.
is a unique combination of three key components At any time t, given an action description in BC
subject-matter expertise, relevant data from silos, and an initial state I and goal state G, PEORL uses
and the right algorithm all of which are instrumen- an answer set solver such as CLINGO to generate
tal in optimizing operations and decision flows. Fur- a plan Πt , i.e., a sequence of actions that transits
thermore, the CKG is also dynamic, which means state from I to G. After that, the action is sent
that it can represent conceptual and computational to execution one by one, value iteration (1) is
models. In addition, it can be used to perform com- performed. After that, ρ values for all state s in
plex transformations and calculations at interactive plan Π are summed up to obtain the quality of the
speeds, making it a game-changing technology for plan,
agile development of AI-driven knowledge applica-
tions.
X
quality(Πt ) = ρ(s)
hs,a,s0 i
B. PEORL Framework
PEORL [5] is a framework that integrates sym- and ρ(s, a) for all ρ values for all transition hs, a, s0 i
bolic planning with reinforcement learning [7]. Us- are used to update the facts in action descriptions.
ing a symbolic formulation to capture high-level Plan Πt+1 is generated that not only satisfies the
domain dynamics and planning with it, a symbolic goal condition G, but also has a plan quality greater
plan is used to guide reinforcement learning to than the quality(Πt ). This process terminates when
explore the domain, instead of performing random plan cannot be further improved.
trial-and-error. Due to the fact that domain knowl- Meta-learning concerns on generating machine
edge significantly reduces the search space, this learning pipeline with proper hyper-parameter to
approach accelerate learning and also improves the meet an objective, such as accuracy. This problem
robustness and adaptability of symbolic plans for can be formulated as an interplay between gener-
sequential decision making. One instantiation of ating reasonable machine learning pipeline, viewed
such framework in [5] uses action language BC to as a symbolic plan generated from a domain formu-
formulate dynamic domain through a set of causal lation for commonsense knowledge of data science,
laws, i.e., preconditions and effects of actions and and evaluating machine learning pipeline, viewed
static relationships between properties (fluents) of a as execution of actions and receiving rewards from
state. In particular, PEORL requires that causal laws the environment, derived from the objective. This
formulating cumulative effect (plan quality) defined approach allows to use interpretable, explicitly rep-
on a sequence of actions. For an action a executed resented expert knowledge to delineate search space
at state s, such causal laws has the form to look for proper pipeline along with their hyper-
parameters, and also allows user to change their
a causes quality = C + Z if
specification for the search space in run time, lead-
s, ρ(s, a) = Z, quality = C. ing to to an more interpretable and transparent
meta-learning. The details of the algorithm will be
2
https://www.Maana.io/knowledge-platform/ described in Section IV-B.
5
1) Model Selection (Phase 1). For C = C the result is returned to the dispatcher to perform
for each classifier C, call Algorithm 1 using value iteration.
the chosen feature set, and P = {ınoop},
recording the performance. Select classifier A. Example: Classify Spam Email
C0 based on the predefined selection criteria We show how the Meta-learning service perform
(accuracy, F1, precision, recall). on an example dataset obtained from UCI machine
2) Pipeline Learning (Phase 2). Call Algo- learning data repository: Spam message detaction4 .
rithm 1 with C = {C0 }, P and F being user The dataset contains 4601 data entries, 57 float and
specified featurizers and preprocessors, and integer features to detect if a message is a spam or
generate optimal pipeline Π1 not.
3) Parameter Sweeping. (Phase 3). Perform After Meta-learning service is running, the user
grid search or random search for hyper pa- can load a CSV file into a workspace into Maana
rameter Π1 and return the final pipeline Π2 . project. After that, the user launch the service
We also allow the user to gradually refine their through the GraphQL endpoint, where the user spec-
preference during the process. When the user sees ifies feature fields and their related types, candidate
the results, they may inject their feedback by over- classifiers (logistic regression, random forest, linear
riding any preset configurations above, at any time, SVC, SGD classifier) and candidate preprocessors
and this information will be picked up by Meta- (noop, random trees embedding, truncated SVD,
Learning search algorithm, and change its behavior PCA, Nystroem, kernel PCA). It performs 10 folds
towards user’s feedback in the next episode of cross validation, 10 episodes of model profiling and
planning and learning. The user can remove or 20 episodes of model search.
add possible algorithms to test, cancel the current After the service is launched, it goes to the first
pipeline, stop a phase with the current best classifier, phase, model selection. In this phase, it will not
or stop the entire process and use the best classifier apply any preprocessors and only apply default
found. featurizers to the column, and pick up 10 sets of
random hyper parameters for each model and cal-
V. S YSTEM I MPLEMENTATION culate the average cross validation accuracy. By the
end of model selection (Phase 1), it stores the metric
In Maana Knowledge Platform, CSV files can information into the knowledge graph, and is visu-
be uploaded and each column becomes a field and alized in the first column of Fig. 1b. It shows that
their types are automatically identified. The user the most accurate model, based on cross validation
can trigger Meta-learning service by submitting a results, is logistic regression. At this point, the user
query through GraphQL endpoint. The GraphQL is notified that logistic regression is selected, based
input is used to generate part of the initial state for on predefined selection criteria. In Pipeline Learning
planning, and the Meta-learning service is triggered (Phase 2), Meta-learning will try to find the best
for pipeline search. Throughout the pipeline search combination of preprocessors and featurizers using
process, the results are constantly written to the the selected classifier, following Algorithm 1. Since
Maana Knowledge platform according to the knowl- the user does not override any default selection
edge schema. The service is implemented in Python of featurizers, one_hot_encoder is applied to
with Graphene library to enable GraphQL server categorical fields, and min_max_scaler is ap-
and endpoints. It is deployed using a Docker image plied to integer fields. During this process, ASP-
along with other components of Maana Knowledge based planner generates pipelines using the selected
platform. classifier, and reinforcement learner evaluates the
Additionally, another feature we use to improve generated pipeline on the data, using reward derived
performance is the parallelization of building mod- from the cross validation accuracy. The pipeline is
els. Because the model profiling and model search gradually improved till the point that it does not
episodes can be done in parallel, we use asyn- change. By the end of Phase 2, the performance of
chronous approach, where multiple workers are selecting different preprocessor with the classifier
launched and each perform their own parameter
sampling and cross validation on the dataset, and 4
https://archive.ics.uci.edu/ml/datasets/Spambase
10
(a) The Meta-learning Service Architecture. (b) Results of the three stages.
is output in Fig. 1b. From the result, it shows Finally, during parameter sweeping (Phase 3) hyper-
not performing any preprocessor has the best per- parameters are swept, leading to the final results
formance used with logistic regression. Combined in the third column. All of the intermediate search
with the default featurizer, a pipeline of using results are stored in the knowledge graph, shown
min max scaler for integer fields, one hot encoder as a snapshot in Fig. 1c. The upper part of the
for categorical field, random tree embedding for screen shots shows the knowledge schema organized
preprocessor and a logistic regression is learned. as knowledge graph, and on clicking each of the
11
schema node, data instance is shown in the lower • Car evaluation dataset11 contains 1728 in-
part of the workspace. stances, 6 categorical data fields to make clas-
During this process, based on the pre-defined sification of purchasing decisions.
candidate models, preprocessors and the profiling Detailed results are shown in Table I. The re-
episodes, the system has evaluated 4 pipelines (each sult shows that the Meta-learning service generates
parameterized with 10 sets of hyper parameters) in competitive baseline result for the data scientist to
model Selection process. During pipeline learning further work on.
phase, the 8 pipelines based on selected classifier
(logistic regression) and candidate preprocessors are
further evaluated (with 10 hyper-parameter tested in VI. C ONCLUSION AND F UTURE W ORK
a single learning episode) until the optimal pipeline
Meta-learning service provides a novel frame-
converges. This process does not provide system-
work for machine learning pipeline search that is
atic pipeline optimization and search. Instead, it
transparent, interpretable and interactive. It serves as
leverages the decision space pre-defined by the data
a profiling tool for data scientist to use: by incor-
scientist and perform quick profiling and provide
porating human knowledge, meta learning service
evidence for the data scientist to further refine their
performs efficient pipeline generation and profiling
decisions.
in the search space delineated by the data scientists,
allowing feedback to be injected in the middle to
B. Evaluation on Datasets alter search space and providing useful feedback
We evaluate meta-learning services for classifica- for the data scientist to understand the best machine
tion tasks using default setting for featurizers. Our learning pipeline for the dataset of interest. While
data set are obtained includes: the Meta-learning service will by no means replace
5
• Reuters 50/50 dataset contains of 2,500 texts data scientist to finish data science project automat-
(50 per author) for author identification. ically, it can save a large amount of time for manual
6
• IDMB movie review dataset contains 25,000 search and tuning. Currently it is deployed in Maana
movie reviews obtained from IMDB. The clas- Knowledge Platform to facilitate data scientists to
sification task is to predict a movie review is build machine learning solutions faster, with better
positive or negative. insight and facilitate knowledge management and
7
• Adult dataset contains 48842 instances. Each sharing across different projects.
instance has 14 fields, including age (integer), This framework leaves several paths for improve-
working class (categorical), education (categor- ment. Up until now we have only applied featur-
ical), capital gain (float), etc that consitute the ization to data based on what type it is. However,
feature space to predict one of the two classs: it is possible to perform some level of automated
salary > 50k or <= 50k. feature extraction and clean up of the data. It should
8
• Spam email detection contains 4601 data en- be possible to use the knowledge gleaned from
tries, 57 float and integer features to detect if the meta-attributes to guide the algorithm as well.
a message is a spam or not. More advanced parameter optimization can also be
9
• Parkinson’s detection dataset contains 197 applied.
instances, with 22 float features to detect if a
person has Parkinson’s disease or not based on
vocal characteristics. R EFERENCES
10
• Abalone dataset contains 4177 instances, 8 [1] C. Thornton, F. Hutter, H. H. Hoos, and K. Leyton-Brown,
float and integer attributes to detect the sex of “Auto-WEKA: Combined selection and hyperparameter opti-
abalone. mization of classification algorithms,” in Proc. of KDD-2013,
2013, pp. 847–855.
5
https://archive.ics.uci.edu/ml/datasets/Reuter 50 50 [2] M. Feurer, A. Klein, K. Eggensperger, J. Springenberg,
6 M. Blum, and F. Hutter, “Efficient and robust automated ma-
http://ai.stanford.edu/ amaas/data/sentiment/
7
https://archive.ics.uci.edu/ml/datasets/Adult chine learning,” in Advances in Neural Information Processing
8
https://archive.ics.uci.edu/ml/datasets/Spambase Systems, 2015, pp. 2962–2970.
9
https://archive.ics.uci.edu/ml/datasets/Parkinsons
10 11
https://archive.ics.uci.edu/ml/datasets/Abalone https://archive.ics.uci.edu/ml/datasets/Car+Evaluation
12
[3] R. S. Olson, N. Bartley, R. J. Urbanowicz, and J. H. Moore, dations, algorithms, and empirical results,” Machine Learning,
“Evaluation of a tree-based pipeline optimization tool for vol. 22, pp. 159–195, 1996.
automating data science,” in Proceedings of the Genetic and [12] L. Kotthoff, C. Thornton, H. H. Hoos, F. Hutter, and K. Leyton-
Evolutionary Computation Conference 2016. ACM, 2016, pp. Brown, “Auto-weka 2.0: Automatic model selection and hy-
485–492. perparameter optimization in weka,” The Journal of Machine
[4] R. T. Fielding and R. N. Taylor, Architectural styles and the Learning Research, vol. 18, no. 1, pp. 826–830, 2017.
design of network-based software architectures. University of [13] F. Hutter, H. H. Hoos, and K. Leyton-Brown, “Sequential
California, Irvine Doctoral dissertation, 2000, vol. 7. model-based optimization for general algorithm configuration,”
[5] F. Yang, D. Lyu, B. Liu, and S. Gustafson, “Peorl: Integrating in International Conference on Learning and Intelligent Opti-
symbolic planning and hierarchical reinforcement learning for mization. Springer, 2011, pp. 507–523.
robust decision-making,” in International Joint Conference of [14] F. Eibe, M. Hall, and I. Witten, “The weka workbench. online
Artificial Intelligence (IJCAI), 2018. appendix for” data mining: Practical machine learning tools and
[6] A. Cimatti, M. Pistore, and P. Traverso, “Automated planning,” techniques,” Morgan Kaufmann, 2016.
in Handbook of Knowledge Representation, F. van Harmelen, [15] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel,
V. Lifschitz, and B. Porter, Eds. Elsevier, 2008. B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss,
[7] R. Sutton and A. G. Barto, Reinforcement Learning: An Intro- V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau,
duction. MIT Press, 1998. M. Brucher, M. Perrot, and E. Duchesnay, “Scikit-learn: Ma-
[8] J. Lee, V. Lifschitz, and F. Yang, “Action Language BC: chine learning in Python,” Journal of Machine Learning Re-
A Preliminary Report,” in International Joint Conference on search, vol. 12, pp. 2825–2830, 2011.
Artificial Intelligence (IJCAI), 2013. [16] E. R. Sparks, S. Venkataraman, T. Kaftan, M. J. Franklin, and
[9] M. L. Puterman, Markov Decision Processes. New York, USA: B. Recht, “Keystoneml: Optimizing pipelines for large-scale
Wiley Interscience, 1994. advanced analytics,” in Data Engineering (ICDE), 2017 IEEE
[10] A. Schwartz, “A reinforcement learning method for maximizing 33rd International Conference on. IEEE, 2017, pp. 535–546.
undiscounted rewards,” in Proc. 10th International Conf. on [17] F. Baader, D. Calvanese, D. McGuinness, P. Patel-Schneider,
Machine Learning. Morgan Kaufmann, San Francisco, CA, and D. Nardi, The description logic handbook: Theory, imple-
1993. mentation and applications. Cambridge university press, 2003.
[11] S. Mahadevan, “Average reward reinforcement learning: Foun-