{'fraction_non_alphanumeric': 0.036904761904761905, 'fraction_numerical': 0.008275729646697389, 'mean_word_length': 4.7006348511383536, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Learning Preferences for Manipulation Tasks from Online Coactive Feedback

We consider the problem of learning preferences over trajectories for mobile manipulators such as personal robots and assembly line robots. The preferences we learn are more intricate than simple geometric constraints on trajectories; they are rather governed by the surrounding context of various objects and human interactions in the environment. We propose a coactive online learning framework for teaching preferences in contextually rich environments. The key novelty of our approach lies in the type of feedback expected from the user: the human user does not need to demonstrate optimal trajectories as training data, but merely needs to iteratively provide trajectories that slightly improve over the trajectory currently proposed by the system. We argue that this coactive preference feedback can be more easily elicited than demonstrations of optimal trajectories. Nevertheless, theoretical regret bounds of our algorithm match the asymptotic rates of optimal trajectory algorithms. We implement our algorithm on two high degree-of-freedom robots, PR2 and Baxter, and present three intuitive mechanisms for providing such incremental feedback. In our experimental evaluation we consider two context rich settings -- household chores and grocery store checkout -- and show that users are able to train the robot with just a few feedbacks (taking only a few minutes).\footnote{Parts of this work has been published at NIPS and ISRR conferences~\citep{Jain13,Jain13b}. This journal submission presents a consistent full paper, and also includes the proof of regret bounds, more details of the robotic system, and a thorough related work.}


I. INTRODUCTION
Recent advances in robotics have resulted in mobile manipulators with high degree of freedom (DoF) arms. However, the use of high DoF arms has so far been largely successful only in structured environments such as manufacturing scenarios, where they perform repetitive motions (e.g., recent deployment of Baxter on assembly lines). One challenge in the deployment of these robots in unstructured environments (such as a grocery checkout counter or at our homes) is their lack of understanding of user preferences and thereby not producing desirable motions. In this work we address the problem of learning preferences over trajectories for high DoF robots such as Baxter or PR2. We consider a variety of household chores for PR2 and grocery checkout tasks for Baxter.
A key problem for high DoF manipulators lies in identifying an appropriate trajectory for a task. An appropriate trajectory not only needs to be valid from a geometric point (i.e., feasible and obstacle-free, the criteria that most path planners focus on), but it also needs to satisfy the user's preferences. Such users' preferences over trajectories can be common across users or they may vary between users, between tasks, and between the environments the trajectory is performed in. For example, a household robot should move a glass of water in an upright position without jerks while maintaining a safe distance from nearby electronic devices. In another example, a robot checking out a knife at a grocery store should strictly move it at a safe distance from nearby humans. Furthermore, straight-line trajectories in Euclidean space may no longer be the preferred ones. For example, trajectories of heavy items should not pass over fragile items but rather move around them. These preferences are often hard to describe and anticipate without knowing where and how the robot is deployed. This makes it infeasible to manually encode them in existing path planners (e.g., Zucker et al. [63], Sucan et al. [57], Schulman et al. [50]) a priori.
In this work we propose an algorithm for learning user preferences over trajectories through interactive feedback from the user in a coactive learning setting [51]. In this setting the robot learns through iterations of user feedback. At each iteration robot receives a task and it predicts a trajectory. The user responds by slightly improving the trajectory but not necessarily revealing the optimal trajectory. The robot use this feedback from user to improve its predictions for future iterations. Unlike in other learning settings, where a human first demonstrates optimal trajectories for a task to the robot [4], our learning model does not rely on the user's ability to demonstrate optimal trajectories a priori. Instead, our learning algorithm explicitly guides the learning process and merely requires the user to incrementally improve the robot's trajectories, thereby learning preferences of user and not the expert. From these interactive improvements the robot learns a general model of the user's preferences in an online fashion. We realize this learning algorithm on PR2 and Baxter robots, and also leverage robot-specific design to allow users to easily give preference feedback.
Our experiments show that a robot trained using this approach can autonomously perform new tasks and if need be, only a small number of interactions are sufficient to tune the robot to the new task. Since the user does not have to demonstrate a (near) optimal trajectory to the robot, the feedback is easier to provide and more widely applicable. Nevertheless, it leads to an online learning algorithm with provable regret bounds that decay at the same rate as for optimal demonstration algorithms (eg. Ratliff et al. [45]).
In our empirical evaluation we learn preferences for two high DoF robots, PR2 and Baxter, on a variety of household and grocery checkout tasks respectively. We design expressive trajectory features and show how our algorithm learns pref- erences from online user feedback on a broad range of tasks for which object properties are of particular importance (e.g., manipulating sharp objects with humans in the vicinity). We extensively evaluate our approach on a set of 35 household and 16 grocery checkout tasks, both in batch experiments as well as through robotic experiments wherein users provide their preferences to the robot. Our results show that our system not only quickly learns good trajectories on individual tasks, but also generalizes well to tasks that the algorithm has not seen before. In summary, our key contributions are: 1) We present an approach for teaching robots which does not rely on experts' demonstrations but nevertheless gives strong theoretical guarantees. 2) We design a robotic system with multiple easy to elicit feedback mechanisms to improve the current trajectory. 3) We implement our algorithm on two robotic platforms, PR2 and Baxter, and support it with a user study. 4) We consider preferences that go beyond simple geometric criteria to capture object and human interactions. 5) We design expressive trajectory features to capture contextual information. These features might also find use in other robotic applications. In the following section we discuss related works. In section III we describe our system and feedback mechanisms. Our learning algorithm and trajectory features are discussed in sections IV and IV, respectively. Section VI gives our experiments and results. We discuss future research directions and conclude in section VII.

II. RELATED WORK
Path planning is one of the key problems in robotics. Here, the objective is to find a collision free path from a start to goal location. Over the last decade many planning algorithms have been proposed, such as sampling based planners by Lavalle and Kuffner [33], and Karaman and Frazzoli [26], search based planners by Cohen et al. [10], trajectory optimizers by Schulman et al. [50], and Zucker et al. [63] and many more [27]. However, given the large space of possible trajectories in most robotic applications simply a collision free trajectory might not suffice, instead the trajectory should satisfy certain constraints and obey the end user preferences. Such preferences are often encoded as a cost which planners optimize [26,50,63]. We address the problem of learning a cost over trajectories for context-rich environments, and from sub-optimal feedback elicited from non-expert users. We now describe related work in various aspects of this problem. Learning from Demonstration (LfD): Teaching a robot to produce desired motions has been a long standing goal and several approaches have been studied. In LfD an expert provides demonstrations of optimal trajectories and the robot tries to mimic the expert. Examples of LfD includes, autonomous helicopter flights [1], ball-in-a-cup game [30], planning 2-D paths [43,44], etc. Such settings assume that kinesthetic demonstrations are intuitive to an end-user and it is clear to an expert what constitutes a good trajectory. In many scenarios, especially involving high DoF manipulators, this is extremely challenging to do [2]. 2 This is because the users have to give not only the end-effector's location at each time-step, but also the full configuration of the arm in a spatially and temporally consistent manner. In Ratliff et al. [45] the robot observes optimal user feedback but performs approximate inference. On the other hand, in our setting, the user never discloses the optimal trajectory or feedback, but instead, the robot learns preferences from sub-optimal suggestions for how the trajectory can be improved.
Noisy demonstrations and other forms of user feedback: Some later works in LfD provided ways for handling noisy demonstrations, under the assumption that demonstrations are either near optimal, as in Ziebart et al. [62], or locally optimal, as in Levine et al. [36]. Providing noisy demonstrations is different from providing relative preferences, which are biased and can be far from optimal. We compare with an algorithm for noisy LfD learning in our experiments. Wilson et al. [60] proposed a Bayesian framework for learning rewards of a Markov decision process via trajectory preference queries. Our approach advances over [60] and Calinon et. al. [9] in Fig. 2: Re-rank feedback mechanism: (Left) Robot ranks trajectories using the score function and (Middle) displays top three trajectories on a touch screen device (iPad here). (Right) As feedback, the user improves the ranking by selecting the third trajectory. that we model user as a utility maximizing agent. Further, our score function theoretically converges to user's hidden function despite recieving sub-optimal feedback. In the past, various interactive methods (e.g. human gestures) [8,56] have been employed to teach assembly line robots. However, these methods required the user to interactively show the complete sequence of actions, which the robot then remembered for future use. Recent works by Nikolaidis et al. [39,40] in human-robot collaboration learns human preferences over a sequence of sub-tasks in assembly line manufacturing. However, these works are agnostic to the user preferences over robot's trajectories. Our work could complement theirs to achieve better human-robot collaboration.
Learning preferences over trajectories: User preferences over robot's trajectories have been studied in human-robot interaction. Sisbot et. al. [55,54] and Mainprice et. al. [37] planned trajectories satisfying user specified preferences in form of constraints on the distance of the robot from the user, the visibility of the robot and the user's arm comfort. Dragan et. al. [14] used functional gradients [47] to optimize for legibility of robot trajectories. We differ from these in that we take a data driven approach and learn score functions reflecting user preferences from sub-optimal feedback.
Planning from a cost function: In many applications, the goal is to find a trajectory that optimizes a cost function. Several works build upon the sampling-based planner RRT [33] to optimize various cost heuristics [17,11,20]. Additive cost functions with Lipschitz continuity can be optimized using optimal planners such as RRT* [26]. Some approaches introduce sampling bias [35] to guide the sampling based planner. Recent trajectory optimizers such as CHOMP [47] and TrajOpt [50] provide optimization based approaches to finding optimal trajectory. Our work is complementary to these in that we learn a cost function while the above approaches optimize a cost.
Our work is also complementary to few works in path planning. Berenson et al. [5] and Phillips et al. [41] consider the problem of trajectories for high-dimensional manipulators. For computational reasons they create a database of prior trajectories, which we could leverage to train our system. Other recent works consider generating human-like trajectories [15,14,58]. Humans-robot interaction is an important aspect and our approach could incorporate similar ideas.
Application domain: In addition to above mentioned differences we also differ in the applications we address. We capture the necessary contextual information for household and grocery store robots, while such context is absent in previous works. Our application scenario of learning trajectories for high DoF manipulations performing tasks in presence of different objects and environmental constraints goes beyond the application scenarios that previous works have considered. Some works in mobile robotics learn context-rich perception-driven cost functions, such as Silver et al. [53], Kretzschmar et al. [32] and Kitani et al. [28]. In this work we use features that consider robot configurations, object-object relations, and temporal behavior, and use them to learn a score function representing the preferences over trajectories.

III. COACTIVE LEARNING WITH INCREMENTAL FEEDBACK
We first give an overview of our robot learning setup and then describe in detail three mechanisms of user feedback.

A. Robot learning setup
We propose an online algorithm for learning preferences in trajectories from sub-optimal user feedback. At each step the robot receives a task as input and outputs a trajectory that maximizes its current estimate of some score function. It then observes user feedback -an improved trajectory -and updates the score function to better match the user preferences. This procedure of learning via iterative improvement is known as coactive learning. We implement the algorithm on PR2 and Baxter robots, both having two 7 DoF arms. In the process of training, the initial trajectory proposed by the robot can be far-off the desired behavior. Therefore, instead of directly executing trajectories in human environments, users first visualize them in the OpenRAVE simulator [13] and then decide the kind of feedback they would like to provide. Fig. 3: Re-ranking feedback: Shows three trajectories for moving egg carton from left to right. Using the current estimate of score function robot ranks them as red, green and blue. As feedback user clicks the green trajectory. Preference: Eggs are fragile. They should be kept upright and near the supporting surface. Fig. 4: Interactive feedback. Task here is to move a bowl filled with water. The robot presents a bad trajectory with waypoints 1-2-4 to the user. As feedback user moves waypoint 2 (red) to waypoint 3 (green) using Rviz interactive markers. The interactive markers guides the user to correct the waypoint.

B. Feedback mechanisms
Our goal is to learn even from feedback given by non-expert users. We therefore require the feedback only to be incrementally better (as compared to being close to optimal) in expectation, and will show that such feedback is sufficient for the algorithm's convergence. This stands in contrast to learning from demonstration (LfD) methods [1,30,43,44] which require (near) optimal demonstrations of the complete trajectory. Such demonstrations can be extremely challenging and nonintuitive to provide for many high DoF manipulators [2]. Instead, we found [21,22] that it is more intuitive for users to give incremental feedback on high DoF arms by improving upon a proposed trajectory. We now summarize three feedback mechanisms that enable the user to iteratively provide improved trajectories.
(a) Re-ranking: We display the ranking of trajectories using OpenRAVE [13] on a touch screen device and ask the user to identify whether any of the lower-ranked trajectories is better than the top-ranked one. The user sequentially observes the trajectories in order of their current predicted scores and clicks on the first trajectory which is better than the top ranked trajectory. Figure 2 shows three trajectories for moving a knife. As feedback, the user moves the trajectory at rank 3 to the top position. Likewise, Figure 3 shows three trajectories for moving an egg carton. Using the current estimate of score function robot ranks them as red (1 st ), green (2 nd ) and blue (3 rd ). Since eggs are fragile the user selects the green trajectory.
(b) Zero-G: This is a kinesthetic feedback. It allows the user to correct trajectory waypoints by physically changing the robot's arm configuration as shown in Figure 1. High DoF arms such as the Barrett WAM and Baxter have zero-force gravity-compensation (zero-G) mode, under which the robot's arms become light and the users can effortlessly steer them to a desired configuration. On Baxter, this zero-G mode is automatically activated when a user holds the robot's wrist (see Figure 1, right). We use this zero-G mode as a feedback method for incrementally improving the trajectory by correcting a waypoint. This feedback is useful (i) for bootstrapping the robot, (ii) for avoiding local maxima where the top trajectories in the ranked list are all bad but ordered correctly, and (iii) when the user is satisfied with the top ranked trajectory except for minor errors.
(c) Interactive: For the robots whose hardware does not permit zero-G feedback, such as PR2, we built an alternative interactive Rviz-ROS [18] interface for allowing the users to improve the trajectories by waypoint correction. Figure 4 shows a robot moving a bowl with one bad waypoint (in red), and the user provides a feedback by correcting it. This feedback serves the same purpose as zero-G.
Note that, in all three kinds of feedback the user never reveals the optimal trajectory to the algorithm, but only provides a slightly improved trajectory (in expectation).

IV. LEARNING AND FEEDBACK MODEL
We model the learning problem in the following way. For a given task, the robot is given a context x that describes the environment, the objects, and any other input relevant to the problem. The robot has to figure out what is a good trajectory y for this context. Formally, we assume that the user has a scoring function s * (x, y) that reflects how much he values each trajectory y for context x. The higher the score, the better the trajectory. Note that this scoring function cannot be observed directly, nor do we assume that the user can actually provide cardinal valuations according to this function. Instead, we merely assume that the user can provide us with preferences that reflect this scoring function. The robot's goal is to learn a function s(x, y; w) There are two ways of moving it, 'a' and 'b', both are suboptimal in that the arm is contorted in 'a' but it tilts the cup in 'b'. Given such constrained scenarios, we need to reason about such subtle preferences. (Right) We encode preferences concerned with object-object interactions in a score function expressed over a graph. Here y 1 , . . . , y n are different waypoints in a trajectory. The shaded nodes corresponds to environment (table node not shown here). Edges denotes interaction between nodes.
(where w are the parameters to be learned) that approximates the user's true scoring function s * (x, y) as closely as possible.
Interaction Model. The learning process proceeds through the following repeated cycle of interactions.
• Step 1: The robot receives a context x and uses a planner to sample a set of trajectories, and ranks them according to its current approximate scoring function s(x, y; w). • Step 2: The user either lets the robot execute the topranked trajectory, or corrects the robot by providing an improved trajectoryȳ. This provides feedback indicating that s * (x,ȳ) > s * (x, y). • Step 3: The robot now updates the parameter w of s(x, y; w) based on this preference feedback and returns to step 1. Regret. The robot's performance will be measured in terms of regret, , which compares the robot's trajectory y t at each time step t against the optimal trajectory y * t maximizing the user's unknown scoring function s * (x, y), y * t = argmax y s * (x t , y). Note that the regret is expressed in terms of the user's true scoring function s * , even though this function is never observed. Regret characterizes the performance of the robot over its whole lifetime, therefore reflecting how well it performs throughout the learning process. We will employ learning algorithms with theoretical bounds on the regret for scoring functions that are linear in their parameters, making only minimal assumptions about the difference in score between s * (x,ȳ) and s * (x, y) in Step 2 of the learning process. Expert Vs Non-expert user. We refer to an expert user as someone who can demonstrate the optimal trajectory y * to the robot. For example, robotics experts such as, the pilot demonstrating helicopter maneuver in Abbeel et al. [1]. On the other hand, our non-expert users never demonstrate y * . They can only provide feedbackȳ indicating s * (x,ȳ) > s * (x, y). For example, users working with assistive robots on assembly lines.
V. LEARNING ALGORITHM For each task, we model the user's scoring function s * (x, y) with the following parametrized family of functions.
s(x, y; w) = w · φ(x, y) (1) w is a weight vector that needs to be learned, and φ(·) are features describing trajectory y for context x. Such linear representation of score functions have been previously used for generating desired robot behaviors [1,44,62].
We further decompose the score function in two parts, one only concerned with the objects the trajectory is interacting with, and the other with the object being manipulated and the environment We now describe the features for the two terms, φ O (·) and φ E (·) in the following.

A. Features Describing Object-Object Interactions
This feature captures the interaction between objects in the environment with the object being manipulated. We enumerate waypoints of trajectory y as y 1 , .., y N and objects in the environment as O = {o 1 , .., o K }. The robot manipulates the objectō ∈ O. A few of the trajectory waypoints would be affected by the other objects in the environment. For example in Figure 5, o 1 and o 2 affect the waypoint y 3 because of proximity. Specifically, we connect an object o k to a trajectory waypoint if the minimum distance to collision is less than a threshold or if o k lies belowō. The edge connecting y j and o k is denoted as (y j , o k ) ∈ E.
Since it is the attributes [31] of the object that really matter in determining the trajectory quality, we represent each object with its attributes. Specifically, for every object o k , we consider a vector of M binary variables [l 1 k , .., l M k ], with each l m k = {0, 1} indicating whether object o k possesses property m or not. For example, if the set of possible properties are {heavy, fragile, sharp, hot, liquid, electronic}, then a laptop and a glass table can have labels [0, 1, 0, 0, 0, 1] and [0, 1, 0, 0, 0, 0] respectively. The binary variables l p k and l q indicates whether o k andō possess property p and q respectively. 3 Then, for every (y j , o k ) edge, we extract following four features φ oo (y j , o k ): projection of minimum distance to collision along x, y and z (vertical) axis and a binary variable, that is 1, if o k lies vertically belowō, 0 otherwise.
We now define the score s O (·) over this graph as follows: Here, the weight vector w pq captures interaction between objects with properties p and q. We obtain w O in eq. (2) by concatenating vectors w pq . More formally, if the vector at position i of w O is w uv then the vector corresponding to

B. Trajectory Features
We now describe features, φ E (x, y), obtained by performing operations on a set of waypoints. They comprise the following three types of the features: 1) Robot Arm Configurations: While a robot can reach the same operational space configuration for its wrist with different configurations of the arm, not all of them are preferred [61]. For example, the contorted way of holding the cup shown in Figure 5 may be fine at that time instant, but would present problems if our goal is to perform an activity with it, e.g. doing the pouring activity. Furthermore, humans like to anticipate robots move and to gain users' confidence, robot should produce predictable and legible robotic motions [14].
We compute features capturing robot's arm configuration using the location of its elbow and wrist, w.r.t. to its shoulder, in cylindrical coordinate system, (r, θ, z). We divide a trajectory into three parts in time and compute 9 features for each of the parts. These features encode the maximum and minimum r, θ and z values for wrist and elbow in that part of the trajectory, giving us 6 features. Since at the limits of the manipulator configuration, joint locks may happen, therefore we also add 3 features for the location of robot's elbow whenever the endeffector attains its maximum r, θ and z values respectively. Thus obtaining φ robot (·) ∈ R 9 (3+3+3=9) features for each one-third part and φ robot (·) ∈ R 27 for the complete trajectory.
2) Orientation and Temporal Behaviour of the Object to be Manipulated: Object orientation during the trajectory is crucial in deciding its quality. For some tasks, the orientation must be strictly maintained (e.g., moving a cup full of coffee); and for some others, it may be necessary to change it in a particular fashion (e.g., pouring activity). Different parts of the trajectory may have different requirements over time. For example, in the placing task, we may need to bring the object closer to obstacles and be more careful.
We therefore divide trajectory into three parts in time. For each part we store the cosine of the object's maximum deviation, along the vertical axis, from its final orientation at the goal location. To capture object's oscillation along trajectory, we obtain a spectrogram for each one-third part for the movement of the object in x, y, z directions as well as for the deviation along vertical axis (e.g. Figure 6). We then compute the average power spectral density in the low and high frequency part as eight additional features for each. This gives us 9 (=1+4*2) features for each one-third part. Together with one additional feature of object's maximum deviation along the whole trajectory, we get φ obj (·) ∈ R 28 (=9*3+1).
3) Object-Environment Interactions: This feature captures temporal variation of vertical and horizontal distances of the objectō from its surrounding surfaces. In detail, we divide the trajectory into three equal parts, and for each part we compute object's: (i) minimum vertical distance from the nearest surface below it. (ii) minimum horizontal distance from the surrounding surfaces; and (iii) minimum distance from the table, on which the task is being performed, and (iv) minimum distance from the goal location. We also take an average, over all the waypoints, of the horizontal and vertical distances between the object and the nearest surfaces around it. 4 To capture temporal variation of object's distance from its surrounding we plot a time-frequency spectrogram of the object's vertical distance from the nearest surface below it, from which we extract six features by dividing it into grids. This feature is expressive enough to differentiate whether an object just grazes over table's edge (steep change in vertical distance) versus, it first goes up and over the table and then moves down (relatively smoother change). Thus, the features obtained from objectenvironment interaction are φ obj−env (·) ∈ R 20 (3*4+2+6=20).

Algorithm 1 Trajectory Preference Perceptron. (TPP)
Initialize w Sample trajectories {y (1) , ..., y (n) } yt = argmaxys(xt, y; w Fig. 7: Shows our system design, for grocery store settings, which provides users with three choices for iteratively improving trajectories. In one type of feedback (zero-G or interactive feedback in case of PR2) user corrects a trajectory waypoint directly on the robot while in the second (re-rank) user chooses the top trajectory out of 5 shown on the simulator.

C. Computing Trajectory Rankings
For obtaining the top trajectory (or a top few) for a given task with context x, we would like to maximize the current scoring function s(x, y; w O , w E ).
Second, for a given set {y (1) , . . . , y (n) } of discrete trajectories, we need to compute (4). Fortunately, the latter problem is easy to solve and simply amounts to sorting the trajectories by their trajectory scores s(x, y (i) ; w O , w E ). Two effective ways of solving the former problem are either discretizing the state space [3,7,59] or directly sampling trajectories from the continuous space [6,12]. Previously, both approaches have been studied. However, for high DoF manipulators the sampling based approach [6,12] maintains tractability of the problem, hence we take this approach. More precisely, similar to Berg et al. [6], we sample trajectories using rapidly-exploring random trees (RRT) [33]. 5 However, naively sampling trajectories could return many similar trajectories. To get diverse samples of trajectories we use various diversity introducing methods. For example, we introduce obstacles in the environment which forces the planner to sample different trajectories. Our methods also introduce randomness in planning by initizaling goalsample bias of RRT planner randomly. To avoid sampling similar trajectories multiple times, one of our diversity method introduce obstacles to block waypoints of already sampled trajectories. Recent work by Ross et al. [48] propose the use of sub-modularity to achieve diversity. For more details on sampling trajectories we refer interested readers to the work by Erickson and LaValle [16], and Green and Kelly [19]. Since our primary goal is to learn a score function on trajectories we now describe our learning algorithm.

D. Learning the Scoring Function
The goal is to learn the parameters w O and w E of the scoring function s(x, y; w O , w E ) so that it can be used to rank trajectories according to the user's preferences. To do so, 5 When RRT becomes too slow, we switch to a more efficient bidirectional-RRT.The cost function (or its approximation) we learn can be fed to trajectory optimizers like CHOMP [47] or optimal planners like RRT* [26] to produce reasonably good trajectories.
we adapt the Preference Perceptron algorithm [51] as detailed in Algorithm 1, and we call it the Trajectory Preference Perceptron (TPP). Given a context x t , the top-ranked trajectory y t under the current parameters w O and w E , and the user's feedback trajectoryȳ t , the TPP updates the weights in the respectively. Our update equation resembles to the weights update equation in Ratliff et al. [44]. However, our update does not depends on the availability of optimal demonstraions. Figure 7 shows an overview of our system design.
Despite its simplicity and even though the algorithm typically does not receive the optimal trajectory y * t = arg max y s * (x t , y) as feedback, the TPP enjoys guarantees on the regret [51]. We merely need to characterize by how much the feedback improves on the presented ranking using the following definition of expected α-informative feedback: E t [s * (x t ,ȳ t )] ≥ s * (x t , y t ) + α(s * (x t , y * t ) − s * (x t , y t )) − ξ t This definition states that the user feedback should have a score ofȳ t that is -in expectation over the users choiceshigher than that of y t by a fraction α ∈ (0, 1] of the maximum possible range s * (x t ,ȳ t ) − s * (x t , y t ). It is important to note that this condition only needs to be met in expectation and not deterministically. This leaves room for noisy and imperfect user feedback. If this condition is not fulfilled due to bias in the feedback, the slack variable ξ t captures the amount of violation. In this way any feedback can be described by an appropriate combination of α and ξ t . Using these two parameters, the proof by Shivaswamy and Joachims [51] can be adapted (for proof see Appendix A & B) to show that average regret of TPP is upper bounded by: In practice, over feedback iterations the quality of trajectory y proposed by robot improves. The α-informative criterion only requires the user to improve y toȳ in expectation.

VI. EXPERIMENTS AND RESULTS
We first describe our experimental setup, then present quantitative results (Section VI-B) , and then present robotic experiments on PR2 and Baxter (Section VI-D).

A. Experimental Setup
Task and Activity Set for Evaluation. We evaluate our approach on 35 robotic tasks in a household setting and 16 pick-and-place tasks in a grocery store checkout setting. For household activities we use PR2, and for the grocery store setting we use Baxter. To assess the generalizability of our approach, for each task we train and test on scenarios with different objects being manipulated and/or with a different environment. We evaluate the quality of trajectories after the robot has grasped the item in question and while the robot moves it for task completion. Our work complements previous works on grasping items [49,34], pick and place tasks [23], and detecting bar codes for grocery checkout [29]. We consider the following three most commonly occurring activities in household and grocery stores: 1) Manipulation centric: These activities are primarily concerned with the object being manipulated. Hence the object's properties and the way the robot moves it in the environment are more relevant. Examples of such household activities are pouring water into a cup or inserting pen into a pen holder, as in Figure 8 (Left). While in a grocery store, such activities could include moving a flower vase or moving fruits and vegetables, which could be damaged when dropped or pushed into other items. We consider pick-and-place, pouring and inserting activities with following objects: cup, bowl, bottle, pen, cereal box, flower vase, and tomato. Further, in every environment we place many objects, along with the object to be manipulated, to restrict simple straight line trajectories. 2) Environment centric: These activities are also concerned with the interactions of the object being manipulated with the surrounding objects. Our object-object interaction features (Section V-A) allow the algorithm to learn preferences on trajectories for moving fragile objects like egg cartons or moving liquid near electronic devices, as in Figure 8 (Middle). We consider moving fragile items like egg carton, heavy metal boxes near a glass table, water near laptop and other electronic devices. 3) Human centric: Sudden movements by the robot put the human in danger of getting hurt. We consider activities where a robot manipulates sharp objects such as knife, as in Figure 8 (Right), moves a hot coffee cup or a bowl of water with a human in vicinity. Experiment setting. Through experiments we will study: • Generalization: Performance of robot on tasks that it has not seen before. • No demonstrations: Comparison of TPP to algorithms that also learn in absence of expert's demonstrations. • Feedback: Effectiveness of different kinds of user feedback in absence of expert's demonstrations. Baseline algorithms. We evaluate algorithms that learn preferences from online feedback under two settings: (a) untrained, where the algorithms learn preferences for a new task from scratch without observing any previous feedback; (b) pretrained, where the algorithms are pre-trained on other similar tasks, and then adapt to a new task. We compare the following algorithms: • Geometric: The robot plans a path, independent of the task, using a Bi-directional RRT (BiRRT) [33] planner. • Manual: The robot plans a path following certain manually coded preferences. • TPP: Our algorithm, evaluated under both untrained and pre-trained settings. • MMP-online: This is an online implementation of the Maximum Margin Planning (MMP) [44,46] algorithm. MMP attempts to make an expert's trajectory better than any other trajectory by a margin. It can be interpreted as a special case of our algorithm with 1-informative i.e. optimal feedback. However, directly adapting MMP [44] to our experiments poses two challenges: (i) we do not have knowledge of the optimal trajectory; and (ii) the state space of the manipulator we consider is too large, discretizing which makes intractable to train MMP.
To ensure a fair comparison, we follow the MMP algorithm from [44,46] and train it under similar settings as TPP. Algorithm 2 shows our implementation of MMPonline. It is very similar to TPP (Algorithm 1) but with a different parameter update step. Since both algorithms only observe user feedback and not demonstrations, MMP-online treats each feedback as a proxy for optimal demonstration. At every iteration MMP-online trains a structural support vector machine (SSVM) [25] using all previous feedback as training examples, and use the learned weights to predict trajectory scores in the next iteration. Since the argmax operation is performed on a set of trajectories it remains tractable. We quantify closeness of trajectories by the L 2 −norm of the difference in their feature representations, and choose the regularization parameter C for training SSVM in hindsight, giving an unfair advantage to MMP-online.
= Train-SSVM(T ) (Joachims et al. [25]) end for Evaluation metrics. In addition to performing a user study (Section VI-D), we also designed two datasets to quantitatively evaluate the performance of our online algorithm. We obtained experts labels on 1300 trajectories in a grocery setting and 2100 trajectories in a household setting. Labels were on the basis of subjective human preferences on a Likert scale of 1-5 (where 5 is the best). Note that these absolute ratings are never provided to our algorithms and are only used for the quantitative evaluation of different algorithms.

Environment centric
Human centric  We evaluate performance of algorithms by measuring how well they rank trajectories, that is, trajectories with higher Likert score should be ranked higher. To quantify the quality of a ranked list of trajectories we report normalized discounted cumulative gain (nDCG) [38] -criterion popularly used in Information Retrieval for document ranking. In particular we report nDCG at positions 1 and 3, equation (6). While nDCG@1 is a suitable metric for autonomous robots that execute the top ranked trajectory (e.g., grocery checkout), nDCG@3 is suitable for scenarios where the robot is supervised by humans, (e.g., assembly lines). For a given ranked list of items (trajectories here) nDCG at position k is defined as: where l i is the Likert score of the item at position i in the ranked list. IDCG is the DCG value of the best possible ranking of items. It is obtained by ranking items in decreasing order of their Likert score.

B. Results and Discussion
We now present quantitative results where we compare TPP against the baseline algorithms on our data set of labeled trajectories.
How well does TPP generalize to new tasks? To study generalization of preference feedback we evaluate performance of TPP-pre-trained (i.e., TPP algorithm under pre-trained setting) on a set of tasks the algorithm has not seen before. We study generalization when: (a) only the object being manipulated changes, e.g., a bowl replaced by a cup or an egg carton replaced by tomatoes, (b) only the surrounding environment changes, e.g., rearranging objects in the environment or changing the start location of tasks, and (c) when both change. Figure 9 shows nDCG@3 plots averaged over tasks for all types of activities for both household and grocery store settings. 6 TPP-pre-trained starts-off with higher nDCG@3 values than TPP-untrained in all three cases. However, as more feedback is provided, the performance of both algorithms improves, and they eventually give identical performance. We further observe that generalizing to tasks with both new environment and object is harder than when Results on Baxter in grocery store setting. nDCG@3 Results on PR2 in household setting. only one of them changes.
How does TPP compare to MMP-online? MMP-online while training assumes all user feedback is optimal, and hence over time it accumulates many contradictory/suboptimal training examples. We empirically observe that MMP-online generalizes better in grocery store setting than the household setting (Figure 9), however under both settings its performance remains much lower than TPP. This also highlights the sensitivity of MMP to sub-optimal demonstrations.
How does TPP compare to Manual? For the manual baseline we encode some preferences into the planners, e.g., keep a glass of water upright. However, some preferences are difficult to specify, e.g., not to move heavy objects over fragile items. We empirically found (Figure 9) that the resultant manual algorithm produces poor trajectories in comparison with TPP, with an average nDCG@3 of 0.44 over all types of household activities. Table I reports nDCG values averaged over 20 feedback iterations in untrained setting. For both household and grocery activities, TPP performs better than other baseline algorithms.
How does TPP perform with weaker feedback? To study the robustness of TPP to less informative feedback we consider the following variants of re-rank feedback: • Click-one-to-replace-top: User observes the trajectories Fig. 10: Study of re-rank feedback on Baxter for grocery store setting.
sequentially in order of their current predicted scores and clicks on the first trajectory which is better than the top ranked trajectory. • Click-one-from-5: Top 5 trajectories are shown and user clicks on the one he thinks is the best after watching all 5 of them. • Approximate-argmax: This is a weaker feedback, here instead of presenting top ranked trajectories, five random trajectories are selected as candidate. The user selects the best trajectory among these 5 candidates. This simulates Fig. 11: Comparision with fully-supervised Oracle-svm on Baxter for grocery store setting.
a situation when computing an argmax over trajectories is prohibitive and therefore approximated. Figure 10 shows the performance of TPP-untrained receiving different kinds of feedback and averaged over three types of activities in grocery store setting. When feedback is more αinformative the algorithm requires fewer iterations to learn preferences. In particular, click-one-to-replace-top and clickone-from-5 are more informative than approximate-argmax and therefore require less feedback to reach a given nDCG@1 value. Approximate-argmax improves slowly since it is least informative. In all three cases the feedback is α-informative, for some α > 0, therefore TPP-untrained eventually learns the user's preferences.

C. Comparison with fully-supervised algorithms
The algorithms discussed so far only observes ordinal feedback where the users iteratively improves upon the proposed trajectory. In this section we compare TPP to a fullysupervised algorithm that observes expert's labels while training. Eliciting such expert labels on the large space of trajectories is not realizable in practice. However, empirically it nonetheless provides an upper-bound on the generalization to new tasks. We refer to this algorithm as Oracle-svm and it learns to rank trajectories using SVM-rank [24]. Since expert labels are not available while prediction, on test set Oraclesvm predicts once and does not learn from user feedback. Figure 11 compares TPP and Oracle-svm on new tasks. Without observing any feedback on new tasks Oracle-svm performs better than TPP. However, after few feedback iterations TPP improves over Oracle-svm, which is not updated since it requires expert's labels on test set. On average, we observe, it takes 5 feedback iterations for TPP to improve over Oracle-svm. Furthermore, learning from demonstration (LfD) can be seen as a special case of Oracle-svm where, instead of providing an expert label for every sampled trajectory, the expert directly demonstrates the optimal trajectory.

D. Robotic Experiment: User Study in learning trajectories
We perform a user study of our system on Baxter and PR2 on a variety of tasks of varying difficulties in grocery store and household settings, respectively. Thereby we show a proofof-concept of our approach in real world robotic scenarios, and that the combination of re-ranking and zero-G/interactive feedback allows users to train the robot in few feedback iterations.
Experiment setup: In this study, users not associated with this work, used our system to train PR2 and Baxter on household and grocery checkout tasks, respectively. Five users independently trained Baxter, by providing zero-G feedback kinesthetically on the robot, and re-rank feedback in a simulator. Two users participated in the study on PR2. On PR2, in place of zero-G, users provided interactive waypoint correction feedback in the Rviz simulator. The users were undergraduate students. Further, both users training PR2 on household tasks were familiar with Rviz-ROS. 7 A set of 10 tasks of varying difficulty level was presented to users one at a time, and they were instructed to provide feedback until they were satisfied with the top ranked trajectory. To quantify the quality of learning each user evaluated their own trajectories (self score), the trajectories learned by the other users (cross score), and those predicted by Oracle-svm, on a Likert scale of 1-5. We also recorded the total time a user spent on each task -from start of training till the user was satisfied with the top ranked trajectory. This includes time taken for both re-rank and zero-G feedback.
Is re-rank feedback easier to elicit from users than zero-G or interactive? In our user study, on average a user took 3 re-rank and 2 zero-G feedback per task to train a robot (Table II). From this we conjecture, that for high DoF manipulators re-rank feedback is easier to provide than zero-G -which requires modifying the manipulator joint angles. However, an increase in the count of zero-G (interactive) feedback with task difficulty suggests (Figure 12 (Right)), users rely more on zero-G feedback for difficult tasks since it allows precisely rectifying erroneous waypoints. Figure 13 and Figure 14 show two example trajectories learned by a user.
How many feedback iterations a user takes to improve over Oracle-svm? Figure 12 (Left) shows that the quality of trajectory improves with feedback. On average, a user took 5 feedback to improve over Oracle-svm, which is also consistent with our quantitative analysis (Section VI-C). In grocery setting, users 4 and 5 were critical towards trajectories learned by Oracle-svm and gave them low scores. This indicates a possible mismatch in preferences between our expert (on whose labels Oracle-svm was trained) and users 4 and 5.
How do users' unobserved score functions vary? An average difference of 0.6 between users' self and cross score (Table II)    varied across users, but only marginally. In situations where this difference is significant and a system is desired for a user population, a future work might explore coactive learning for satisfying user population, similar to Raman and Joachims [42]. For household setting, the sample size is small to draw a similar conclusion.
How long does it take for users to train a robot? We report training time for only the grocery store setting, because the interactive feedback in the household setting requires users with experience in Rviz-ROS. Further, we observed that users found it difficult to modify the robot's joint angles in a simulator to their desired configuration. In the grocery checkout setting, among all the users, user 1 had the strictest preferences and also experienced some early difficulties in using the system and therefore took longer than others. On an average, a user took 5.5 minutes per task, which we believe is acceptable for most applications. Future research in human-computer interaction, visualization and When manipulating objects in human environments, it is important for robots to plan motions that follow users' preferences. In this work, we considered preferences that go beyond simple geometric constraints and that considered surrounding context of various objects and humans in the environment. We presented a coactive learning approach for teaching robots these preferences through iterative improvements from nonexpert users. Unlike in standard learning from demonstration approaches, our approach does not require the user to provide optimal trajectories as training data. We evaluated our approach on various household (with PR2) and grocery store checkout (with Baxter) settings. Our experiments suggest that it is indeed possible to train robots within a few minutes with just a few incremental feedbacks from non-expert users.
Future research could extend coactive learning to situations with uncertainty in object pose and attributes. Under uncertainty the trajectory preference perceptron will admit a belief space update form, and theoretical guarantees will also be different. Coactive feedback might also find use in other interesting robotic applications such as assistive cars, where a car learns from humans steering actions. Scaling up coactive feedback by crowd-sourcing and exploring other forms of easy-to-elicit learning signals are also potential future directions.

ACKNOWLEDGEMENTS
This research was supported by ARO award W911NF-12-1-0267, Microsoft Faculty fellowship and NSF Career award (to Saxena).

APPENDIX A PROOF FOR AVERAGE REGRET
This proof builds upon Shivaswamy & Joachims [51]. We assume the user hidden score function s * (x, y) is contained in the family of scoring functions s(x, y; w * O , w * E ) for some unknown w * O and w * E . Average regret for TPP over T rounds of interactions can be written as: (s * (x t , y * t ) − s * (x t , y t )) We further assume the feedback provided by the user is strictly α-informative and satisfy following inequality: Later we relax this constraint and requires it to hold only in expectation.
This definition states that the user feedback should have a score ofȳ t that is higher than that of y t by a fraction α ∈ (0, 1] of the maximum possible range s(x t , y * t ; w * O , w * E ) − s(x t , y t ; w * O , w * E ).
Theorem 1: The average regret of trajectory preference perceptron receiving strictly α-informative feedback can be upper bounded for any [w * O ; w * E ] as follows: where C is constant such that [φ O (x, y); φ E (x, y)] 2 ≤ C. Proof: After T rounds of feedback, using weight update equations of w E and w O we can write: ) Adding the two equations and recursively reducing the right gives: − s(x t , y t ; w * O , w * E )) (9) Using Cauchy-Schwarz inequality the left hand side of equation (9) can be bounded as: ] can be bounded by using weight update equations: Eq. (11) follows from the fact that s(x T , y T ; w Assuming strictly α-informative feedback and re-writing equation (7) as: Combining equations (13) and (14) gives the bound on average regret (8).

APPENDIX B PROOF FOR EXPECTED REGRET
We now show the regret bounds for TPP under a weaker feedback assumption -expected α-informative feedback: − ξ t where the expectation is under choicesȳ t when y t and x t are known.
Corollary 2: The expected regret of trajectory preference perceptron receiving expected α-informative feedback can be upper bounded for any [w * O ; w * E ] as follows: Proof: Taking expectation on both sides of equation (9), (10) and (11) yields following equations respectively: