# Patent

## Title
Method and apparatus for non-disruptive embedding of specialized elements

## Abstract

Techniques for non-disruptive embedding of specialized elements are disclosed. In one aspect of the techniques, ontology is defined to specify an application domain. A program interface (API) is also provided for creating raw features by a developer. Thus a module is provided for at least one form of statistical analysis within the ontology. The module is configured automatically in a computing device with the API in response to a system consistent with the ontology, wherein the system has no substantial requirement for specialized knowledge of that form of statistical analysis, and the module has no substantial requirement for specialized knowledge of particular functions provided by the system.

## Background
CROSS REFERENCE TO RELATED APPLICATION
This application is a continuation-in-part of U.S. patent application Ser. No. 11/890,262 “Non-disruptive embedding of specialized elements”, filed Aug. 3, 2007 and now U.S. Pat. No. 7,558,698, which claims the priority from U.S. Provisional Patent Application No. 60/592,980, titled “Battlefield Learning”, filed Jul. 30, 2004, and claims priority from U.S. patent application Ser. No. 11/036,975, titled “Non-Disruptive Embedding of Specialized Elements,” filed Jan. 14, 2005.


BACKGROUND OF THE INVENTION
1. Field of the Invention
The invention generally is related to data processing and computer programming. More specifically, the present invention is related to systems for embedding specialized elements (e.g., statistical analysis or machine learning techniques) into application programs in a relatively non-disruptive and efficient manner.
2. Related Art
It is often problematic to attempt to embed expert knowledge about a specialized domain into an application program. In the known art, either

    
    
        the expert knowledge is supplied in a very general form, for example, a library of callable functions. While this allows developers of many different application programs to use a generic library, this technique involves a substantial amount of information by developers about the expert knowledge and how to apply it.
        the expert knowledge is supplied in a very specific form, for example, a custom program or system written for use by the application program. While this allows the developer of the application program to use that expert knowledge, this technique involves a substantial amount of information by the creator of the custom program or system about how the expert knowledge will be applied to the application program.
    
    


Neither of these techniques is fully satisfactory, as either they involve having the developers of application programs learn a substantial amount of information they might not have time to fully learn and understand, or they involve having the developers of custom programs or systems learn a substantial amount of information about the application program. Both of these problems have the drawback that they increase the expense, in terms of effort, money, time, and trust between developers.
Accordingly, it would be desirable to provide techniques by which application developers can make easy use of specialized elements provided by expert knowledge providers, with a minimum of cross-domain knowledge required, while still maintaining broad applicability of the specialized elements, thus avoiding drawbacks of the known art.
Many different computer program applications could benefit from embedding specialized program elements that enable the use of specialized knowledge, including statistical analysis, data mining, machine learning, OLAP (online analytical processing), and the like. Conventional integration of such specialized elements into application programs generally takes one of two forms.
First, the specialized elements could be applied at development time or “offline.” This approach is limited in that the specialized elements cannot learn from or otherwise adapt at runtime.
Second, the specialized elements could be applied at runtime or “online.” One major benefit of this approach is that the elements can adapt and be personalized to an individual user.
Current approaches to providing specialized elements (for example, embedded packages such as those for statistical analysis) at runtime generally fall into two categories, (a) supplying very widely applicable specialized elements, but requiring the client (i.e., a developer writing the code for use by an end user) to identify all relevant features and cast them into a pre-defined format at runtime, (b) supplying very narrowly applicable specialized elements that have all features pre-defined, but that are only applicable to a specific application. Each of these approaches has various drawbacks.
If the specialized elements are widely applicable, the client generally must learn and utilize extensive expertise in order to tie the elements into an application. This process can be problematic, especially if the client does not understand which features are important for proper function of the specialized elements. Furthermore, even if the does understand which features need to be provided, the client might not know or understand details of exactly how those features should be provided, or how those features should be provided for optimum effect.
The supplier of the specialized elements can assist the client with these matters. However, the supplier might need access to the client's application source code in order to provide useful assistance. This can be unacceptable if the client wants or needs to keep the application source code secret, for example, to protect trade secrets and other intellectual property embodied in the source code.
Finally, any changes to application program code can necessitate changes to how the specialized elements are tied into the application. As a result, the client might need assistance from the supplier throughout the entire coding process. Such assistance can be very time consuming, and therefore expensive, especially if it must be provided to the very end (sometimes called the “last mile”) of the coding process.
For at least these reasons, conventional widely applicably specialized elements can be overly expensive for the developer, especially in domains requiring specialized statistical analysis. With very narrowly applicable specialized elements, the process of tying the elements to a particular application can be simpler. However, such specialized elements will only be useful with the particular application for which they are specifically designed. Every time similar elements are needed for another application, they will have to be re-written or the old elements will have to be extensively modified, even if their general operation and use are the same as previous implementations. This is not an efficient development process.
The foregoing issues particularly arise in, but are not limited to, the contexts of machine learning, statistical analysis, and OLAP (online analytical processing). For example, game and simulation developers are often experts at creating graphics, environments, player and non-player characters, simple artificial intelligences, and the like. However, they often have only limited experience in the application of more complex machine learning to software agents that control the game's or simulation's characters. Likewise, developers of financial application software are often experts at calculations involving financial transactions, graphics and conventions for depicting those transactions, and the like. However, they often have only limited experience in the application of machine learning to analysis of financial trends and likely actions of actors in a market place.
In both of these examples, the developers might turn to outside suppliers for specialized elements than enable such machine learning. When the developers attempt to incorporate those elements into their applications, they will encounter the issues discussed above.
SUMMARY OF THE INVENTION
The invention provides techniques, including methods and systems, for integration of specialized elements (for example, machine learning and statistical methods) into application programs, without having either the developers of the application programs or the specialized elements have to know much about the system they are being fitted into.
In one embodiment, both the application programs and the specialized elements conform to a known ontology (i.e., a model of a set of data, a model of techniques for operating on that data, or a model of a set of semantic meanings for those techniques). For example, in one embodiment, the known ontology may include a computer game including melee combat, where the melee combat may include either player characters or non-player characters.
At a development time, the application program and the specialized elements (e.g., machine learning or statistical methods) are bound together using an application program/specialized element interface, which more specifically defines possible ways in which the application program may interact with the specialized elements. This has the effect that the application program does not need to have substantial knowledge of the specialized elements, nor that the specialized elements have substantial knowledge of the application program, so long as both substantially conform to the agreed ontology.
In one embodiment, the developer of the application program provides a set of program header files, from which an embodiment of the invention can create an application program/specialized element interface. In such embodiments, the specialized elements might apply substantial internal knowledge about the agreed ontology to provide a rich set of statistical techniques and machine learning techniques, with very little information necessarily exchanged between the two.
The success of applying specialized elements (e.g., statistical methods and machine learning techniques) to an application program depends critically on the amount, quality, content and nature of the input data the statistical methods and machine learning techniques obtain from the application program. For example, in the science of meteorology, the task of predicting future weather patterns usually require access to a large amount of accurate data that records past weather patterns. The content of the data is important in that it must include as much information as possible that is relevant to making accurate predictions. It should also exclude as much extraneous and irrelevant information as possible since this information might otherwise overwhelm or confuse the statistical methods being used. The nature of the provided data is important in the sense that predictions may be facilitated by transforming the data in some way before applying the statistical method. For example, instead of providing raw temperature values as input, some statistical methods work better if the data is first transformed into more discrete values such as “hot”, “warm” or “cold”. Other specialized elements may prefer yet different types of data, such as data that has been processed to extract its principal components (sometimes referred to herein as “PCA”).
Those skilled in the art of applying specialized elements (e.g., statistical methods and machine learning techniques) to data have crucial experience, techniques and methods for selecting relevant data and excluding irrelevant data. They also use, are aware of, or have experience in many techniques and methods for massaging and processing data so they can maximize the effectiveness of different statistical techniques. Effective use of this knowledge can make the difference between success and failure of those specialized elements. Those not skilled in the art of applying those specialized elements often lack experience and an in-depth knowledge of how the underlying algorithms work. They are often unaware of what input data is even relevant when trying to apply particular specialized elements (such as for example, particular statistical methods or machine learning techniques). Their lack of in-depth knowledge and experience means that they are also often unaware of the necessary transformations of their data that they need to perform, and are thus unable to make effective use of specialized elements that would otherwise be powerful and useful in their business.
According to one aspect of the present invention, the invention addresses these issues through a system and methodology, which (1) restricts specialized elements, for example, statistical methods and machine learning techniques, to a particular problem within a particular domain of data analysis or processing; and (2) provides configurable data that permits the specialized elements to be tailored to a particular application program. One advantage of the present invention is that those not skilled in the art of applying those specialized elements can still effectively apply those specialized elements to their business. This is possible because those skilled in the art of applying statistical methods can incorporate, in advance, knowledge about those specialized elements, and can incorporate, in advance, transformations and representations of the data as deemed necessary to make those who can incorporate, in advance, effective tools for solving their specific problem. Another advantage of the present invention is that those skilled in the art of applying those specialized elements can provide prepackaged solutions that work for a wide variety of applications within the relevant domain. Without item 2 as listed above, it would only be possible for those skilled in the art of applying those specialized elements to supply prepackaged solutions for one specific application, or at most a small class of applications that were nearly identical. Taken together, these two aspects of the invention enable an entirely new business model for the supplier of those specialized elements.
In one preferred embodiment of the invention, the inventors have discovered a set of transformations of basic information about a game world in a video game that is effective in games involving melee combat. In particular, the transformations have proved effective in applying a set of specialized elements (e.g., statistical techniques involved in statistical machine learning) to the problem of a non-player character (NPC) learning, in real-time, to play by observing a character controlled by a human.
This application refers to basic information about the game world as the game's “raw features” and to information that is the result of the inventive transformations of those raw features as the “derived features”. The inventors have discovered that the derived features comprise much of the information that is required to learn effectively. By packaging up the derived features and the specialized elements, the inventors have created a module that they refer to as the “battlefield learning module.”
Furthermore, the inventors have discovered that by adding a system or methodology for configurable data, (as described with respect to item 2 above) the invention allows game developers to specify their own set of raw features. The module can therefore apply to many different games that fall within the melee combat genre. One advantage thereof is that game developers who are not typically skilled in the art of applying the provided specialized elements can more effectively use those specialized elements within their game products. It should be noted that this level of configurability is completely different and far beyond the usual trivial amount of configurability that most software provides during the installation process (e.g. when software is installed the user is often allowed to pick the install directory, choose some file locations, etc.). Moreover, the inventors have discovered that the data configuration process can be made simple enough that the supplier of the specialized elements does not need to be involved in the process of fitting it to the client's game. This is because all the required configuration is within the context of the application domain of the module and thus uses concepts that are familiar to the client. That is, the client only needs to be an expert in the application domain and the client's own application; the client does not need to be an expert in the use of the provided specialized elements.
In addition to video games, the invention also applies to many other applications that involve components that would benefit from the provided specialized elements. For example, the invention could be used to create modules for various real-time applications, such as:

    
    
        a module that could be configured by the air force to create software for the operation of unmanned drones that learn in real-time from a human pilot in a real battlefield situation.
        a module could be created that could be configured by stock brokers to be used in financial applications that adapt in real-time to changing market conditions.
        a module could be created, that is designed to be configured by medical practitioners for various medical applications in which some apparatus or equipment must adapt to changing conditions in real-time.
    
    


The invention also applies to non real-time statistical data processing applications such as OLAP (online analytical processing). In traditional OLAP style applications of statistical methods for data processing, the supplier of the specialized elements (i.e., those including the statistical methods) does not write any of the features. Instead all the features are written by the client. This is in marked contrast to the case that occurs when using the invention. That is, when using the invention the bulk of the features are written by the supplier. This difference in “ownership” of the features is a major difference between the invention and any known art.
Of course, in traditional applications the supplier and the client can be, and often are, one in the same. In such cases, an opportunity to sell the specialized elements and the features together as a package to a third party only exists if the third party's application is ostensibly identical.
The invention also applies when the specialized elements are

    
    
        (1) embodied in a software package that can be configured,
        (2) embodied in a hardware device that can be configured,
        (3) embodied in a device that is a combination of software and hardware, or
        (4) embodied in a plurality of devices operating in conjunction or cooperation, such as a cluster processor.

Process Overview

    
    


In one preferred embodiment, the invention is used by a supplier to encapsulate the supplier's specialized elements (e.g., statistical processing algorithms and knowledge of a domain) in what the inventors refer to as a “module”. A module is designed to be used by a developer to incorporate those specialized elements into their application. A module may include various distinct components including, but may not limited to, a runtime library for statistical processing of data, configurable data, applications for configuring the configurable data, example configurations, example applications, and documentation. Different components are designed to be used in various operations that occur at two different times: development time (“devtime”) and runtime. In particular, the configurable data and the applications for configuring the configurable data are designed to be used at devtime. For one example, the runtime library for statistical processing of data is designed to be used at runtime.
In a preferred embodiment, at devtime the developer must provide a set of raw feature definition (RFD) files, effect files and parameter files, as described below. The files are read by a devtime application, called the “featurizer,” which compiles them into a set of derived features that the inventors refer to as the “cooked features”. At runtime the cooked features are read in by the runtime library in order to customize the runtime library to the particular application to which it is linked. More specifically, the derived features that comprise the cooked features are instantiated in memory and hooked up to the raw features that are computed by the application.
Those skilled in the art would have little difficulty in seeing how the cooked features could be represented differently. For example, a relational database could be used. With some minor modifications it is also possible to represent the cooked features as code that is generated by the featurizer application, in which case the generated code may have to be compiled at devtime so that it could be linked in with application and runtime library. This may lead to some speed advantages in evaluating the derived features at runtime. Note that, if the code was in an interpreted language (e.g. Python), or if there was a compiler embedded within the application, then there would be no need to compile the generated code in advance at devtime.
It shall be noted that during the developer's overall development process, the devtime and runtime are interleaved. That is, the developer will run their application to test the behavior of their application with the supplier's runtime library and the initial cooked features. In early attempts, the behavior is unlikely to be correct. The errors could be caused by, among other possibilities, bugs in the application, errors in computing the raw features, or errors or oversights in the configuration process. The developer will therefore engage in an iterative process of reconfiguring the configurable data, generating a new cooked features and re-testing their application.
Once the developer is happy with the behavior of the application and the interaction with the runtime library, the developer will ship the application to the users. For example, the developer might be a developer of a computer game that uses the battlefield learning module to create characters that can learn by example. The ultimate users of the application are people in their homes playing the game that, for example, they bought in a shop (or alternatively, people playing the game at an arcade). The users at home are using the battlefield learning module in runtime mode only and so the only components of the module that need ship with the game are the runtime library and the final cooked features.
Later, if the developer wishes to fix bugs that were not fixed earlier, or to add new functionality to the game, new cooked features and (if necessary) a new runtime library, could be made available for the user to download or purchase as an upgrade or patch.
Devtime
In a preferred embodiment, configuring the configurable data includes two parts. The first part is concerned with making sure that the required raw features are correctly and efficiently linked into an application. The second part is concerned with allowing the developer to extend the raw features, and what and how effects should be instantiated in their application.
RFD Files
In a preferred embodiment, hooking up the raw features is largely achieved using what the inventors refer to as raw feature definition (RFD) files. In particular, an RFD file is a regular C header file that is used to specify the raw features. An initial RFD file is supplied to the developer as part of the module. The RFD file can also include other RFD files and other C header files initially supplied as part of the module. The other C header files and portions of the RFD files must remain fixed. They represent data structures that the supplier requires to be present for the subsequent correct functioning of the runtime library. The developer can however extend RFD files with their own data-structures. These additional data-structures will be correctly handled by the featurizer application, and corresponding raw features created. More specifically, the featurizer records inside the cooked feature object the offsets in bytes needed to access the different fields inside the RFD files.
The ability for the developer to add its own data-structures to the RFD file is part of what allows the module to be able to be used in more than one specific predetermined application. Rather, it can be used in any application in the correct domain ontology.
The idea behind RFD files is that, when the application is compiled, it is compiled with the RFD files. At runtime the values in the data-structures are filled in with important information about the application. For example, in a game the information will contain basic information about positions and orientations and etc of a character. The big advantage of using RFD files is that the data-structures in the RFD file can be one and the same as the applications internal data-structures. For example, in a game a character's position data-structure can be used both by the statistical processing algorithms inside the runtime library and independently in the rest of the program, for instance, for rendering a depiction of the game world. This means that there does not have to be an additional potentially time-consuming step in which data is copied or marshaled from the applications own internal data-structures into those used by the runtime library. The RFD files therefore represent a method to gain added efficiency. If this added efficiency is not important a more traditional API that relies on copying data can be used instead. Those skilled in the art would recognize that the use of the RFD files is an optional extra device to increase efficiency and that alternatives exist that do not alter the fundamental nature of the invention.
Effect Files
In a preferred embodiment, deciding what and how effects should be instantiated in an application is primarily done with effect files. Each file instantiates a related collection of behaviors. For example, an effect file could contain behaviors related to movement. An individual behavior is usually parameterized and represents the potential to learn a specific behavior with respect to the supplied parameters. For example, a behavior could be defined to potentially learn to run away from a particular target when a certain condition is true.
Creating a new behavior that an NPC could potentially learn includes supplying values for the behavior's parameters. The inventors call it instantiating a behavior. The exact set of parameters can vary depending on the effect. The inventors have discovered that a common set of parameters is a target and a condition. When the developer instantiates a behavior, they provide actual values for the condition and target. In this way a developer can create an effect, for example, to potentially learn to run away from a green object when the character is frightened. Another effect, say, is to learn to run toward blue flowers when there are a large number of dragons circling overhead. The options are limitless and again show how flexible the invention is in allowing a single module to apply to a huge number of possible applications.
Technically, the parameter values supplied by the developer have to be features. For example, they can be raw features created from the RFD files. But to allow greater flexibility, convenience and customizability, there is also a special parameter file that provides a place where the developer can define their own derived features that represent important concepts in their application. Important concepts for each application will be different but they typically include predicates, targets, iterators, etc. that are relevant to the application. For example, in a certain game green orcs with yellow noses maybe an important aspect of the game. In another the list of all green spaceships with large missiles may be important.
Behaviors are represented as template files. A template file defines a set of derived features in terms of some parameters (e.g. an unspecified condition and target). The derived features in a template can compute various functions of raw features, parameters and other derived features. The derived features can be simple transformations of raw features, such as computing relative coordinates from global ones. Or they can be defined recursively to perform sophisticated statistical functions of other derived features such as machine learning. The derived features can reference other derived features defined elsewhere in the file, defined in other template files, defined inside the runtime library, or defined in the parameter file.
The details of how a template or parameter file is represented are not particularly important. The inventors use text files, but relational databases or code could be equally well used. It would also be obvious to anyone skilled in the art of writing software that a GUI, or configuration “wizard” could be trivially wrapped around the whole process.
The invention addresses drawbacks of the known art with a system that includes at least (1) specialized elements that are restricted to a particular domain of data analysis or processing, and (2) configurable data that permits the specialized elements to be tailored to a particular application. The configurable data expands applicability of the specialized elements to plural applications within the particular domain.
The specialized elements can be provided by a supplier to a developer without the supplier having detailed knowledge of structures and internal operations used by the particular application. The particular application can be generated by the developer without the developer having detailed knowledge of internal operations used by the specialized elements.
By virtue of constriction to a particular domain and expansion within that domain, this runtime approach provides a middle ground between overly-broad and overly-narrow specialized elements.
The particular domain can be a particular form of game, simulation, or analysis program. Examples include, but are not limited to, battlefield games, simulations, and analysis programs, and financial games, simulations, and analysis programs. The specialized elements can enable statistical analysis, data mining, machine learning, online learning, or online analytical processing in the particular domain. Other domains and types of specialized elements can also benefit from the current invention.
The configurable data, once configured, provides a link between the particular application and the specialized elements within the domain. In a preferred embodiment, the configurable data includes templates provided by the supplier. These templates can be for one or more header files and/or parameters for the specialized elements.
The header files can define structures for features used by an application whereby the specialized elements can access those features. The parameters can specify predicates and targets for the specialized elements whereby the specialized elements can respond to queries from the particular application. Other types of header files, parameters, and templates can be used without departing from the invention.
In terms of “offline” versus “online” or “runtime,” the invention is a modified runtime approach. The approach actually involves operations that occur at two different times: development time (“devtime”) and runtime. The configurable data is configured by the developer at devtime to provide the link between the particular application and the specialized elements. These devtime operations involve identifying, constructing, and inserting all features (i.e., value, groups of values, data constructs, and the like) needed by the specialized elements into a pre-defined format. The resulting information about the features can be stored in various ways, for example as a flat file, computational graph, or relational database.
At runtime, the link provided by the configurable data is used to enable the specialized elements to respond to queries from the particular application. In particular, the specialized elements preferably use the stored configurable data to access features in the developer's code in order to perform some form of statistical analysis, data mining, machine learning, or the like.
Different techniques can be used to configure the data for the link between the specialized elements and the application. For example, the data can be configured through manual editing or through an input interface provided by the supplier along with the specialized elements. This interface can include a graphical user interface. Other techniques to configure the data can be used.
Once the data is configured, a featurizer provided by the supplier is run at devtime to create a linkable library that implements the specialized elements. The resulting linkable library is accessible by the particular application in accordance with the configurable data. In a preferred embodiment, the featurizer analyzes the configurable data to ensure proper dependencies between identified features and parameters.
After the library has been generated, the particular application can link to and use the library to marshal data from the particular application, to modify models used by the specialized elements based on the data, and to use the models to respond to the queries from the particular application.
The invention also encompasses methods performed in accordance with the foregoing description, computer programs and code that implement those methods, data structures used by those programs and code, and media that stores such programs, code and data structures. Other embodiments are possible.
After reading this application, those skilled in the art would recognize that the systems described herein provide an enabling technology, with the effect that heretofore advantageous features can be provided that heretofore were substantially infeasible.



BRIEF DESCRIPTION OF THE FIG.S
FIG. 1 shows a conceptual overview of several principals underlying the invention;
FIG. 2 shows a work flow and elements for embedding specialized elements in an application;
FIG. 3 shows a flowchart of embedding specialized elements in an application;
FIG. 4 shows a block diagram of an exemplary system in which machine learning has been embedded;
FIG. 5 shows a block diagram of an exemplary embedded machine learning;
FIG. 6 shows a flowchart of operating in a system in which machine learning has been embedded;
FIG. 7 shows a conceptual relationship between suppliers, clients and end-users according to the invention;
FIG. 8 shows a screen shot with a number of windows for a debugging system according to one embodiment of the present invention.



DETAILED DESCRIPTION OF A PREFERRED EMBODIMENT
The detailed description of the invention is presented largely in terms of procedures, steps, logic blocks, processing, and other symbolic representations that directly or indirectly resemble the operations of data processing devices coupled to networks. These process descriptions and representations are typically used by those skilled in the art to most effectively convey the substance of their work to others skilled in the art. Reference herein to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase “in one embodiment” in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Further, the order of blocks in process flowcharts or diagrams representing one or more embodiments of the invention do not inherently indicate any particular order nor imply any limitations in the invention.
For convenience, definitions for some terms are provided below. It should be noted that the definitions are to facilitate the understanding and description of the present invention according to one embodiment. The definitions may appear to include limitations with respect to the embodiment. However, the actual meaning of the terms may have applicability beyond such embodiment.

    
    
        “specialized elements” refers to data driven analytic tools, techniques, methods and code, for example but not limited to statistical analysis, data mining, machine learning, online learning, and online analytical processing (OLAP).
        “machine learning,” “artificial intelligence,” and the like interchangeably refer to processes and techniques by which computers or other devices emulate learning and learned behavior, for example to emulate or to predict actions of humans or other actors. (Technically, machine learning is a subset of artificial intelligence; however, the terms are generally used in a broader and more interchangeable sense in this application.)
        “online learning” and “online machine learning” refer to real-time machine learning in which models are built and modified “on the fly” in real-time in immediate or near-immediate response to training signals and other inputs. The models are then used to respond to real-time queries. Online learning is particularly useful in the contexts of games and simulations where immediate or near-immediate responses are particularly important.
        “development time” or “devtime” refers to a time period during which a developer develops application code, including configuration of that code for inclusion of specialized elements.
        “runtime” refers to a time period during which application code that has embedded specialized elements executes.
        “module” refers to specialized elements that are utilized at runtime and the associated configuration information defined at devtime.
        “supplier” refers to any people, businesses, or other entities, singularly or collectively, who provide modules to others for incorporation into application or other code.
        “developer” refers to any people, businesses, or other entities, singularly or collectively, who are involved in designing, producing, developing, coding, and otherwise making application or other code.
        “client” refers to a developer who receives modules from a supplier and incorporates those specialized elements into application or other code.
        “developer supplied code” refers to code provided by one or more developers to enable some application, function, action, or use.
        “user” or “end user” refers to any people, businesses, or other entities, singularly or collectively, who use an application or other code designed, developed, coded, or otherwise made by a developer.
        “raw features” refers to a subset of values and structures used or generated by an application (i.e., “developer supplied code”) that the specialized elements need to access, either directly or indirectly, in order to interact with that application.
        “derived features” refers to values, structures, and functions used by specialized elements. Derived features can be derived based on one or more raw features and/or other derived features.

Parties Involved in Use of Specialized Elements

    
    


As shown in FIG. 7, the system of the invention generally involves three distinct groups of people: supplier(s) 100, client(s) 101, and end user(s) 102. (Throughout this document, the singular of a noun is meant to encompass the plural and vice versa. For example, “supplier” encompasses both a single supplier and a group of suppliers. The singular will generally be used hereinafter for the sake of convenience.)
The supplier provides specialized elements to the client. The specialized elements enable some form of statistical analysis, data mining, machine learning, online learning, or online analytical processing for an application created by the client. The specialized elements can be embodied as modules and templates, shown in FIG. 1 as modules and templates 105, or in some other form.
The client configures the specialized elements and develops some type of application that can benefit from the specialized elements. The end user uses the application delivered by the client. From the end user's perspective, the client is the developer of the application. (The client in the supplier/client relationship is the same as the developer in the developer/end user relationship.) These relationships are illustrated in FIG. 7.
Knowledge of Parties
The specialized elements according to the invention are not provided by the supplier for use with a particular application. Rather, the specialized elements are provided for use with a domain of applications. Therefore, the supplier is unlikely to have detailed knowledge of structures and internal operations used by a particular application.
Likewise, the client is likely to have only limited knowledge of how the specialized elements perform their data analysis. The client might wish to have their application benefit from analysis techniques that they understand in a general sense but are not expert at developing. Thus, the client relies on the expertise of the supplier, as embedded in the specialized elements, to improve their application.
For example, game and simulation developers are often experts at creating graphics, environments, player and non-player characters, simple artificial intelligence, and the like. However, they often have only limited experience in the application of more complex machine learning to software agents that control the game's or simulation's characters. Games and simulations can be greatly enhanced by such machine learning, especially online machine learning that responds in realtime.
Likewise, developers of financial application software are often experts at calculations involving financial transactions, graphics and conventions for depicting those transactions, and the like. However, they often have only limited experience in the application of machine learning to analysis of financial trends and likely actions of actors in a market place. Financial software can be greatly enhanced by such machine learning.
In these and other contexts, the client relies on the supplier to deliver the specialized elements and to make the specialized elements relatively easy to embed in their application.
For at least these reasons, neither the supplier nor the client can be expected to have detailed knowledge of how the other party's contribution to the application operates. Neither the supplier nor the client is usually interested in expending resources to gain such knowledge. Furthermore, both parties might have a vested interest in keeping the details of the operation of their own contributions confidential, for example if trade secret information is embedded therein. Thus, the variable names, operation names, and other structures used by the specialized elements are almost certainly going to differ from those used by the application.
Constriction and Expansion
FIG. 1 illustrates the principals of constriction and expansion utilized by the invention. Briefly, the invention utilizes a system that includes at least (1) specialized elements that are restricted to a particular domain of data analysis or processing and (2) configurable data that permits the specialized elements to be tailored to a particular application. The configurable data expands applicability of the specialized elements to plural applications within the particular domain.
As noted above, the specialized elements are provided for use with a domain of applications rather than with a single application. According to the invention, this domain is constricted to a particular type of analysis for a particular type of application. This constriction is represented by region 110 in FIG. 1.
Examples of particular types of analysis include, but are not limited to, statistical analysis, data mining, machine learning, online learning, and online analytical processing. Example of particular types of applications include, but are not limited to, battlefield games and simulations, flight games and simulations, fighting games and simulations, virtual reality games and simulations, financial games and simulations, and political games and simulations.
Constriction must be performed because the specialized elements and the application program should share a common ontology (i.e., way of looking at the world). For example, any battlefield game or simulation is likely to share a common ontology with specialized elements designed to analyze actions in a battlefield. While specific details of structures and operations may differ, it will be possible to construct a correspondence between structures and operations used by each.
In contrast, the ontology for a financial simulation is entirely different from the ontology for a battlefield game. Specialized elements for analyzing a financial situation are almost certainly inapplicable to providing effective analysis in a battlefield setting. In almost every case, it would be difficult if not impossible to draw useful correspondences between the two world views.
The applicants note that exceptions can exist. For example, a stock market could be analogized to a battlefield, and correspondences could be generated based on that analogy. While the invention is applicable to such cases, the more common case will involve specialized elements and applications that share a common ontology.
As long as the specialized elements and application share a common ontology, the general types of data and operations used by each will have at least some degree of correlation. Some structures and operation will have one-to-one correspondences between the elements and the application. More complex correspondences might be needed for other structures and operations.
By drawing the proper correspondences within the ontology, the specialized elements will be able to be tailored to a particular application. This ability to tailor the specialized elements means that they can be used with a range of applications within their given domain. The applicability of the specialized elements to plural applications is referred to as “expansion.” Such expansion is illustrated as region 111 in FIG. 1.
Correspondences between structures and operations used by the specialized elements and the application preferably are defined through configurable data supplied with the modules. This configurable data (after configuration) is shown in FIG. 1 as settings 107 and provides a link between the specialized elements and the application within the given domain.
In a preferred embodiment, the configurable data includes templates for one or more header files and/or parameters for the specialized elements. The header files can define data structures for features used by the application whereby the specialized elements can access those features. The parameters can specify predicates and targets for the specialized elements whereby the specialized elements can respond to queries from the particular application. Other types of header files, parameters, templates, and configurable data can be used without departing from the invention.
By virtue of constriction to a particular domain and expansion within that domain, the invention provides a middle ground between overly-broad and overly-narrow specialized elements. As shown in the FIG. 1, constriction occurs as the specialized elements are generated by a supplier. Tailoring of the specialized elements (i.e., expansion) through the configurable data is performed by the client during “devtime.”
Devtime and Runtime
FIG. 1 also illustrates principals of devtime and runtime according to the invention. The configurable data is configured by a developer at devtime 112 (which corresponds to expansion 111). These devtime operations involve identifying, constructing, and inserting all features (i.e., value, groups of values, data constructs, and the like) needed by the specialized elements into a pre-defined format. The resulting information about the features can be stored in various ways, for example, as a flat file, computational graph, relational database, or some other form.
The configured data, which is shown in FIG. 1 as settings 107, serves as a link between devtime 112 and runtime 113. At runtime 113, the link provided by the configured data is used to enable the specialized elements to respond to queries from the particular application. In particular, the specialized elements preferably use the stored configured data to access features in the developer's code in order to perform some form of statistical analysis, data mining, machine learning, or the like. This process involves linking modules for the specialized elements to the application, marshalling data from the application, and using that data to perform analysis and modeling.
Runtime 113 operations can be performed by both the client (developer) and the end user. The client can perform runtime operations in order to train the application, to debug the application and the application's link to the specialized elements, and the like. The user performs runtime operation in normal use of the application.
Workflow
FIG. 2 shows a work flow and elements for embedding specialized elements in an application. Several elements in FIG. 2 are supplied by the supplier to the client (developer) in order to permit the client to incorporate specialized elements into an application. These elements include code for the specialized elements and configurable data, which can be viewed as an SDK.
The code for the specialized elements is preferably in a compiled runtime library, shown in FIG. 2 as runtime library 200. In the interest of preserving any proprietary information in the code, source code for the elements preferably is not made available to the client. However, source code can be provided if so desired.
The configurable data in FIG. 2 includes required structs 210, additional structs 220, and parameters 230. These items preferably are provided in the form of templates that can be edited by the client. In some embodiments, the client edits the structs and parameters directly, for example, using a programming tool or text editor. In other embodiments, the input interface 240 provided by the supplier is used to configure some or all of the structs and parameters. The input interface can be a text based or graphical user interface (GUI). Other configuration techniques can be used without departing from the teachings of the invention.
Required structs 210 and additional structs 220 are configured by the client so as to define raw features 250. Raw features are a subset of values and structures used or generated by an application that the specialized elements need to access, either directly or indirectly, in order to interact with that application.
In a preferred embodiment, required structs 210 are in the form of a header (.h) file. These structs represent a minimum set of features that must be present for the specialized elements to function. Also in a preferred embodiment, additional structs 220 are in the form of an iKuni definitions (.ik) header file. These structs represent additional features that are needed to permit the specialized elements to provide added functionality to the application.
The .h and .ik header files preferably include declarations of data types, for example C/C++ declarations. They preferably do not include any logic. The header files can include special annotations to assist in later processing. For example, a $ delimiter can be used to provide an annotation about a variable, as shown for example below:















typedef struct Info



{









float position[2];



float value [2];



int status;



int color; // $ firm $



// etc.









}










In this example, the annotation within $ . . . $ indicates that “color” is a “firm” variable. Firm variables are only evaluated once at runtime and are considered to be constants thereafter. Some other possible annotations and possible meanings are listed below:

    
    
        const: a const feature never alters its value
        variable: a variable feature can vary between queries, but never during a query
        volatile: a volatile feature can alter its value at any time
    
    


According to another embodiment, a developer simply makes calls to feature construction API provided by the suppliers. For example, it is supposed that the developer has the following C++ class that holds a game character's current state in their game:















namespace Game {



{









typedef float Vec[3];



struct Character {









Vec pos; // character's position



Vec vel; // character's velocity



bool enemy; // is this an enemy character?



int color; // character's color









};









}










Then the developer can declare this state to the specialized elements with the C/C++ macro and API calls like the following:













namespace AiLive {









template<>



struct declareType<Game::Character> {









static inline void declare( AiLive::TypeDataBase& tdb ) {









tdb.TDB_DECLARE_CLASS( Game::Character );



tdb.TDB_DECLARE_CLASS_MEMBER( Game::Character, pos );



tdb.TDB_DECLARE_CLASS_MEMBER( Game::Character, vel );



tdb.TDB_DECLARE_CLASS_MEMBER( Game::Character, enemy );



tdb.TDB_DECLARE_CLASS_MEMBER( Game::Character, color );









}









};







}









The specialized elements now know the:

    
    
        structure of
        data members (and their offsets within the containing structure) of
        names of
        locations in memory of
        values of, and
        datatypes of

the C++ classes, data members, data structures, variables and arrays that the developer has defined in their game code. The developer can create raw features using the supplied API and the types that they have declared to the specialized elements:

        RawFeatureRef me=bt.newRawFeature(tdb.get(“Game::Character”), “me”);
    
    


At run-time the developer can set the value of any raw features. For example, suppose the developer has previously defined an array of characters in a game. To set the value of the “me” raw feature to point at a first element of the array, an API call like the following can be used:

    
    
        me->set<Game::Character*>(&(gs.characters[0]));
    
    


Raw features provide a convenient way to input information into the specialized elements at run-time. To produce interesting output from the specialized elements, further configuration is necessary before they are used.
One of the advantages of this embodiment is that the supplier does not need to define features, neither does the supplier have to provide a tool to parse the expressions. Parsing can be slow, complicated, cumbersome and error prone. It is also difficult to provide high-quality error messages. Thus an important feature in this embodiment is that the supplier never has to write parsing code. The supplier simply provides an API in an existing language. All the parsing is done using industry standard tools such as commercial C++ compilers.
Once the developer has used the supplier's feature construction API to declare all their raw features, further features can be constructed. The developer uses additional components in the supplier's feature construction API. For example, after the “me” raw feature has been created, this can be used to create derived features. If the developer desires to create a derived feature to be able to, at run-time, look up “my” color, the developer can make the following calls to the C++ feature creation API:

    
    
        FeatureRef myColorF=member(me, “color”);

Any feature can be given a name as follows:

        bt[“myColor”]=myColorF;

At run-time the value of the feature can be queried. For example:

        int c=bt[“myColor”]->eval<int>( );

would look up the value of the color filed in the character record that was pointed to by the “me” feature.

    
    


The feature creation API allows all sorts of features to be created. For example, the following sequence of calls builds up a feature that calculates the “nearest enemy” to the “me” character that is currently making a decision.

    
    
        IteratorRef iter=iteratorFactory(member(gsf, “characters”));
        FeatureRef elem=elementOf(iter);
        IteratorRef enemiesIter=iteratorFactory(iter, is EnemyCallback(elem));
        IteratorRef senemiesIter=createSortedIter(me, enemiesIter);
        FeatureRef nerestEnemy=firstVal(senemiesIter);

It should be noted that, the “gsf” variable refers to a game object that is of a type assumed to have been previously declared to the API and which contains a list of game characters.

    
    


Here is an example of a call to create an actual specialized element. It is a predictor that can learn to predict actions of a human player. Its inputs include the brain template that contains the list of all the features created, an enumerated type that specifies the possible output labels, and a list of features whose values specify different contexts that the developer judges to be important for learning to be effective.

    
    
        ActionPredictorRef pred=newActionPredictor(bt, actionEnum, contextConditions);
    
    


At run-time, each of the features in the list of contexts will be evaluated. For learning, a label will be provided that specifies the human's action choice within that context. This information will be used to update the specialized element's internal state. For example, some weights might be modified. For predictions, the specialized element will look at the current value of all the features in the list of contexts and pick the action it considers most likely the human would pick if it were in the same situation.
The invention is not limited to these annotations or to these particular definitions for the annotations. Because raw features 250 include variable declarations for values and structures used or generated by the application, the header files (or other embodiment of the raw feature definitions) are supplied for compiling the application. This is represented by the diagonal arrow labeled “raw features” in FIG. 2.
The client can use the names of the declared raw features for features in their application. If those names are used, the raw features will be directly available for use by the specialized elements. This results in very efficient interaction between the application and the specialized elements, which can be very important in certain online applications such as games and simulations.
However, the client can also choose to use their own names for features in the application. If the client uses their own names, the application will have to marshal data into values and structures with names that match the declared raw features so that the specialized elements can access that data. Efficiency tends to be somewhat lessened by having to marshal the data; however, this approach still results in fairly efficient operation.
As stated above, the configurable data in FIG. 2 also includes parameters 230. These parameters define derived features 260 for the specialized elements. Derived features refer to values, structures, and functions used by the specialized elements to perform their analysis. Derived features can be derived based on one or more raw features and/or other derived features.
In a preferred embodiment, the derived features include predicates and targets. The predicates are derived features that provide a context for data analysis. For example, in the context of a battlefield simulation, some predicates might be a health of a character, a number of opposing characters present, distances to those characters, and the like.
The targets represent objects or items that can be the subjects of queries and responses by the specialized elements. For example, in the context of a battlefield simulation, a target might be a player character about whom the application might ask the specialized elements to make a prediction.
The parameters can define additional functions or features. For example, the parameters can define debugging functions for use during runtime. Parameter definitions can involve values for thresholds to be used by a specialized element, names of and/or pointers to variables, arrays, functions, and other data structures corresponding to information used or generated by an application (i.e., raw features), expressions involving values, names of and/or pointers to variables, arrays, functions, and other data structures. In a preferred embodiment, the parameter definitions are expressed in a feature specification language (FSL). An example of a FSL is described in depth in the incorporated provisional application. In another preferred embodiment, the parameter definitions are expressed using a feature specification API similar to the template-based API described earlier.
The parameter definitions preferably form a computational graph. Alternatively, the derived features can be embodied in a flat file of definitions, a relationship database, or in some other form.
As discussed above, the configured structs and parameters form settings that bridge the devtime and runtime aspects of the invention. These settings create a link through which the application and the specialized elements can communicate data within their shared ontology.
The features 270 are instantiated from their definitions before being passed to featurizer 280. Instantiation preferably involves checking the features for proper dependencies. In addition, instantiation involves expanding the definitions for all instances of defined features.
The featurizer 280 operates on the instantiated features to generate models or other resources 285. These resources are used by the specialized elements to analyze data, to be able to answer queries framed in terms of predicates and targets (i.e., derived features). In a preferred embodiment, these models or other resources are similar to art or map resource files.
Compiled code 290 for the application that includes calls to runtime library 200 are linked to the library and resources 285, after which the application can be executed 295 for use. FIG. 2 includes an annotation of that instantiation, featurization and execution can occur during both development and use. During development, execution can be used for debugging. In addition, resources 285 can be modified during development through execution of the application, for example in the context of training for machine learning. The modified resources can be stored for later shipment along with the application to an end user.
If learning is to continue, resources 285 can continue to be modified during use by an end user. Alternatively, some or all of the resources could be frozen so as to freeze the data analysis, machine learning, or other models.
FIG. 3 shows a flowchart 300 of embedding specialized elements in an application. The flowchart 300 is performed using the workflow shown in FIG. 2. Although the flowchart 300 is described serially, the flow points and steps of the flowchart 300 can be performed by separate elements in conjunction or in parallel, whether asynchronously or synchronously, in a pipelined manner, or otherwise. There is no particular requirement that the flowchart 300 must be performed in the same order in which this description lists flow points or steps, except where explicitly indicated.
In step 301, a client receives modules for specialized elements, preferably including at least a runtime library and configurable data, from a supplier. Steps 302 to 305 represent devtime. In steps 302 and 303, structs and parameters in the configurable data are edited so as to identify raw features and derived features (e.g., predicates and targets). In a preferred embodiement the parameters are defined and edited in a functional specification language (FSL). Editing can be manual or through an input interface. In another preferred embodiement the parameters are defined using a feature specification API.
In step 304, the features are instantiated. Instantiation preferably involves checking the features for proper dependencies. In addition, instantiation involves expanding the definitions for all instances of defined features. A featurizer generates resources for the specialized elements based on the instantiated features in step 305. These resources are used by the specialized elements to analyze data so as to be able to answer queries framed in terms of predicates and targets (i.e., derived features). In a preferred embodiment, these models or other resources are similar to art or map resource files.
Steps 306 to 308 represent runtime. The configured features, parameters and resources, which together form settings for the specialized elements, form a link between the devtime steps and the runtime steps. In step 306, the application's code, the runtime library for the specialized elements, and the resources are linked. The linked code is executed in step 307. Training and debugging occur in step 308. In training, the resources can be modified by the specialized elements “on the fly.” These modifications can be kept, discarded, or modified as desired.
Development of the application, embedding the specialized elements, and training the elements is usually an iterative process. Thus, the client can go from step 308 to any of the previous steps. Once the client is satisfied with the embedded specialize elements and associated settings and resources, the entire packed of linked code can be shipped to an end user. This is shown as step 309.
In step 310, the end user executes the application. For example, if the application is a game for a game console, the end user plays the game. Training might continue or might be frozen, depending on how the application is designed and possibly on choices and inputs from the end user.
Runtime Example
FIG. 4 shows a block diagram of an example of a system in which machine learning has been embedded. The invention is equally applicable to other types of specialized elements that implement different techniques of data analysis. Application of the invention to those techniques would not require undue experimentation or further invention. In this example, the specialized elements enhable machine learning in an application that is ready for training and debugging by a developer or use by an end user.
An application 400 running on a system 405 includes developer supplied code 410. The code preferably includes program structures such as data structures, data types, function entry points, function pointers, object data types, object methods, and the like. Some, all, none or different structure might be present depending on the way in which the code 410 is designed. One or more users 420 typically interact with the application 400, although the invention is also applicable to applications and code that does not interact with users.
In one embodiment, described in more detail in the Incorporated Disclosure, the application is a game, for example, a simulation or a game involving player and non-player characters. The invention is equally applicable to non-game and non-simulation applications.
The code 410 includes state information 430. The state information can include, for example, variables, values, arrays, objects (e.g., C++ objects), pointers, and/or other data structures that define or store information used by the application 400.
According to the invention, raw features 450 include information from state information 430. The raw features might include, without limitation, the actual values, the data structures that store those values, pointers to the values and data structures, functions and object methods capable of determining the values and data structures, pointers to those functions and object methods, and the like.
There might be many raw features 450. The Incorporated Disclosure provides examples of raw features in the setting of a game or simulation. The derived features 460 include a set of features derived in response to the raw features 450, such as for example by calculating the values of those derived features 460 using the values of the raw features 450. A derived feature 460 might include a weighted sum of a set of raw features 450, a function calculation in response to a set of raw features 450, and the like.
A derived feature 460 might be determined using one or more predefined calculations or operations performed on one or more raw features, raw features and derived features, or both raw features and derived features. A derived feature 460 might also or instead be determined using one or more learned or derived calculations or operations performed on one or more raw features, raw features and derived features, or both raw features and derived features.
For example, not intended to be limiting in any way, a derived feature 460 might include one or more of the following data:

    
    
        A derived feature 460 might include a Boolean value or a predicate operator, such as a determination whether some condition is true at the moment with regard to the application 400.
        A derived feature 460 might include a Boolean value or a predicate operator defined in response to already-known predicates.
        A derived feature 460 might include an iterator defined in response to an array of already-known raw features 450 or derived features 460.
        A derived feature 460 might include an element of an iterative operator by selecting one or more objects from that iterative operator.
        A derived feature 460 might be defined in response to other raw features 450, other derived features 460, or recursively defined in response to a variant form of the same derived feature 460 (such as for example a sorted version of an array or list).
        A derived feature 460 might be defined in response to a machine learning elements (described below), with the effect that an output of a machine learning element might be used as an input for defining a derived feature 460.
    
    


One aspect of the invention is the provision of a selected set of derived features needed for effective machine learning. The inventors have found that it is non-obvious and unexpectedly useful to provide such a selected set of derived features.

    
    
        First, this has the effect of allowing the code developer to not have to think about which derived features are going to be derived from the raw features (or other system state variables) of the application when designing or implementing that application.
        Second, this has the effect of allowing the code developer to not have to design any code or data structures for providing those derived features, and also allowing the developer to not have to design any code or data structures for computing those derived features.
        Third, this has the effect of allowing the code developer to not have to think about any learning aspects of the application, and to not have to design any code or data structures therefore.
        Fourth, this has the effect of allowing the code developer to call upon learners 465 provided by the invention to ask for responses to queries that could benefit from machine learning.
    
    


After reading this application, other and further advantages of providing a selected set of derived features will be clear to those skilled in the art. Moreover, these other and further advantages will be clear to be within the scope and spirit of the invention, and not to involve any undue experimentation or further invention. Learners 465 are capable of providing dynamic machine learning to code 410 based on derived features 460. Learners 465 are shown in FIG. 4 as including one or more artificial intelligence (AI) engines 470 that respond to queries 480 from code 410 with responses 490.
AI engines 470 embody machine learning techniques. In a preferred embodiment, one or more AI engines are capable or learning from prior situations, for example as described by derived features 460, and making predictions and/or suggestions based on such learning.
Examples of applicable machine learning techniques include, but are not limited to, context-based learners, exponential gradient techniques based on weighted sums of raw and/or derived features, Bayesian classifiers, neural networks, expert systems, hidden Markov models, partially observable Markov decision process models, other simulation engines, etc. An example of a context-based learner is described in detail in the Incorporated Disclosure.
Examples of queries 480 can include, for example and without limitation, requests for predictions, suggested actions, identifications of goals, rankings of goals, rankings of factors, rankings of other objects or information, identifications of relative or absolute probabilities, determinations of uncertainty, selections of what information is most/least critical, identifications of most/least common results over a distribution of results, reasons for predicting actions or for other responses, and other information. Responses 490 can include, for example and without limitation, the requested predictions, actions, identifications, rankings, determinations, selections, reasons, and other information. Other types of queries and responses can be used as desired.
Training signals 510 provide information and feedback from code 410 to learners 465. The feedback could indicate a result of taking action based on responses 490, a comparison of a prediction in responses 490 to what actually occurred, and other training signals of types known in the art of machine learning.
AI engines 470 of learners 465 preferably use the training signals to learn and adapt, thereby enhancing the operation of application 400. Learning could be confined to a learning or training mode during which responses are not sent to code 410. Alternatively, learning could continue during an operational mode during which responses are sent to code 410.
Storage
The storage 520 includes a device for storing electronic data including but not limited to a hard disk drive, an optical drive, a silicon chip storage element (smart media card, external storage card, random access memory). Code and data for the application 400 preferably can be saved to the storage 520.
In one embodiment, data that is generated by the learners 465 might be saved and loaded, either on demand, or in response to particular user inputs. This data might be used to initiate AI engines 470. The data might include parameters that define a starting point for learning by the AI engines, a current or prior state of learning by the AI engines, or any other information regarding the learners 465 and AI engines 470. The data might define a pre-training or post-training state for the learners and AI engines.
Runtime Example
FIG. 5 shows a block diagram of an example of embedded specialized elements, in this case machine learning code. The invention is not limited in any way to the details of this example.
Raw features 450 are shown in FIG. 5 as including various values and indications for code 410. A learner according to the invention generates the derived features 460 from the raw features 450 and possibly from other derived features 460.
In the example shown in FIG. 5, the code is for a simulator such as a flight simulator. The various raw features 450 relate to information about the flight simulation. The particular raw features shown in FIG. 5 are meant to be illustrative only; actual code for a flight simulator might use all, some, none, or different raw features.
The derived features 460 in FIG. 5 represent relationships between some of raw features 450. Derived features 460 according to the invention are not limited to such relationships. Furthermore, the particular relationships shown in FIG. 5 are meant to be illustrative only; actual derived features for a flight simulator might use all, some, none, or different derived features.
In order to generate the derived features, the learner must know where in the code 410 to find the corresponding raw features 450. The locations of or pointers to the raw features are shown in FIG. 5 as access points 530. The access points preferably are extracted from the code based on configuration information supplied by the code's developer and based on templates supplied for this purpose, as explained in more detail above with reference to FIGS. 1 and 3.
The derived features 460 are supplied to AI engines 470, where they are used to generate responses 490 to queries 480 from code 410. In FIG. 5, an example of queries 480 is shown as a query for what a next action should be, and an example of response 490 is that action. Any other types of queries and responses could be used.
The code 410 supplies training signals 510 to AI engines 470, which use the signals to learn and to adapt according to the nature of the AI engines.
Operation at Runtime
FIG. 6 shows a process flow diagram of a method of operating in a system in which machine learning has been embedded.
A method 600 is performed by the application 400. Although the method 600 is described serially, the flow points and steps of the method 600 can be performed by separate elements in conjunction or in parallel, whether asynchronously or synchronously, in a pipelined manner, or otherwise. There is no particular requirement that the method 600 must be performed in the same order in which this description lists flow points or steps, except where explicitly indicated.
Associating, Updating and Using Behavior Models
At a flow point 601, the method 600 is ready to begin utilizing machine learning that is embedded in an application as discussed herein. At a step 602, the application 400 is activated, and the method 600 begins to operate in conjunction or combination with the application 400. At a step 603, the method 600 determines if any learning elements or information for use by learning elements need to be pre-loaded. If so, the method 600 performs the next step (the step 604), and continues with the step thereafter (the step 605). If not, the method 600 skips the next step (the step 604), and continues with the step thereafter (the step 605).
At a step 604, the method 600 loads one or more machine learning elements 465, for example including AI engines 470 and stored or pre-set settings for those engines. At a step 605, the method 600 determines that the application 400 uses one or more learners 465. If so, the method performs the next step (the step 606), and continues with the step thereafter (the step 607). If not, the method 600 skips the next step (the step 606), and continues with the step thereafter (the step 607).
The step 605 could include determining which of plural available learners are going to be used by the application 400. At a step 606, the method 600 couples one or more learners 465 to application 400, as determined in the previous step (the step 605).
At a step 607, the method 600 updates the AI engines 470 in the learners 465, for example based on training signals 610 from code 410 of the application 400. The step of training could involve updating coefficients, weights, or other values used by the AI engines.
At a step 608, the learners 465 receive queries for predictions, actions, identifications, rankings, determinations, selections, reasons, and/or other information from code 410 of the application 400.
At a step 609, the AI engines 470 of the learners 465 access relevant derived features 460 based on the received queries. As discussed above, the derived features 460 are based at least in part on raw features 450 in code 410. If the raw features 450 need to be access, learners 465 use access points 430 to do so.
At a step 610, a response to the query is sent to the querying code module, section, function, object or the like of code 410. In a training mode, less than all of these steps might be performed. For example, step 610 might be skipped in a training mode. Conversely, if the learners are considered to be fully trained, step 607 might be skipped. Other variations are possible.
Those of steps 607 to 610 that are performed preferably are repeatedly executed so as to facilitate learning by the software agents. As raw features 450 and derived features 460 change, learners 465 learn and adapt, permitting application 400 to benefit from the machine learning expertise embodied in the derived features 460 and AI engines 470 of learners 465. This continues until the game ends in steps 611 and 612.
Interrelation of Method Parts
After reading this application, those skilled in the art will recognize that many variations are possible that would be workable, that such variations are within the scope and sprit of the invention, and that such variations would not require undue experimentation or further invention.
For example, not intended to be limiting in any way, the following aspects of the method 600 would be clear to those skilled in the art:

    
    
        Each of steps 607 to 610 can be, and preferably are, performed in parallel. This has the effect that the method 600 can update the learners 465 concurrently with using those learners 465.
        In the context of the invention, there is no particular requirement for learning to start and stop when the application starts or stops. For example, learning might be conducted for only a short duration after the learners start, or at pre-selected time durations, or at periodic time durations, or at time durations responsive to the learners themselves.
        In the context of the invention, it is possible for learning to be conducted in context at one or more levels of generality.
        The more the learners are used, the more they learn. This can enhance overall application performance over time.
    
    


Learners can be directed to learn based on activities of single actors, groups of actors, historical records of past acts by actors, etc. In this context, an “actor” can be a user, another application or entity, or the like. Learning can be collaborative—attempting to get actors to work more effectively in concert—or competitive—attempting to defeat or overcome one or more other actors.
Alternative Embodiments
Although preferred embodiments are disclosed herein, many variations are possible which remain within the concept, scope, and spirit of the invention. These variations would become clear to those skilled in the art after perusal of this application. While standard debugging tools allow the state of a program to be viewed, they require that the program being debugged is currently running live in the memory of a computer. In some cases, existing debugging tools also allow the debugging of programs on a different computer (e.g. the debugging on a PC of a computer game meant to run on a games console), and in some cases the input can be provided to a program to provide a repeatable test case (e.g., a recording of a series of joystick inputs). The source code for the program may be modified, the program re-run using saved test data as input, and the changes observed to assist in debugging.
According to one embodiment, the invention provides superior functionality in some respects. i) interactions with a library (a subsystem of a program) via an API are recorded (including any memory that could possibly be referenced by the API during those interactions) for each call to the API interface. This allows the state of the memory at any time during the recording session to be easily accessed. Developers may rewind the recording to restore the state of memory at time t-n after viewing it at time t. This is not possible with existing debuggers which only provide the user with a view of the current state of the computer memory and not a view over time. ii) The recorded API interaction is idempotent of the program of which it is a part and the larger system is not required to view or restore the recording. This is a large departure from traditional debugging.
In one embodiment, a sequence of joystick inputs may be recorded as a test case. The recorded joystick input may be replayed to the game program in lieu of real user input and used to generate the same sequence of game states within the computer's memory as was observed while the recording was made. However, the utility of such recordings is limited for three reasons. First reason: if a sequence of joystick inputs is recorded, relatively minor changes to the game may result in radically different sequences of game states being produced when the recording is applied. Common examples include:
i) the recording was made during an optimized build of the game but played back with a debug build of the game in which floating point operations yield different results, having consequences such as: a game character may have bumped into an obstacle at the time of the original recording but will not when the recording is replayed,
ii) another member of the development team committed changes to the game's source code or data files, which introduced changes to the way in which joystick input affects the game state (e.g., by causing a computer character to be killed, rendering the following playback of recorded joystick data meaningless, out-of-context junk).
In summary, recordings of program input provide brittle test cases. Small changes to the program may have unpredictable consequences when the recording is played back. More, generally, the sequence of the game's state of during playback cannot be guaranteed to be unaltered following even minor changes to game by the developer.
Second reason: traditional techniques require the availability of a game in order to debug its use of any libraries it uses. In some cases, the game developer may not be able to debug problems themselves and want to delegate the problem to the supplier of the library. However, because the game is proprietary and the developer may not wish to provide access to the game. Therefore, the ability to assist in debugging is blocked to the supplier of the library. This invention resolves this problem, because the library can record all of the developer's interactions to the library's API, save the recording and transmit it to the supplier. The supplier can then replay the API's interactions and perform debugging without need of the game.
Third reason: frequently, changes may be required to fix a bug under study. Those changes can affect the sequence of game states generated by the recorded input. Thus, after attempting to fix a bug, the input cannot be used to regenerate the failure case that the recording was intended to provide.
When the bug lies in the interactions with a supplier's library, accessed by a supplier's API, the supplier can solve these problems for their client by using recordings of the interactions with the API and the state of any memory required by calls to the API. When the recording is replayed there is sufficient information within the recording to regenerate the same sequence of library calls and memory state internal to the library as occurred during the time of the recording. Additionally, because the game memory accessed via the API is also recorded and restored during playback, we can guarantee that the output from the API does not modify that memory. The API always receives the same input, even if the implementation of API is changed or some configuration used by the API is changed. This property allows:

    
    
        the state of recorded memory to be inspected at any point
        changes to be made to the implementation of the API
        changes to be made to configurable parts used by the API
        the respective consquences to be observed in isolation.
    
    


An application to replay a recording may be supplied entirely by a supplier of the API. The larger application is not needed whereas it would be required in the traditional debugging of programs. For example, in the computer game embodiment, a computer game is no longer required to replay the test case.
FIG. 8 shows an embodiment of this invention that is implemented for computer games. The windows show an application referred to as iTEd with a recording of some sessions of a client's computer game loaded. 802 shows a slider bar indicating the current game frame of the recording. Windows 801-805 show information pertaining to a particular frame. The slider may be dragged left and right causing the information in windows 801-805 to be updated in real time to reflect the chosen game frame.
Window 801 shows a graphical rendering of the frame depicting the locations of computer game characters in a game. Window 803 shows the API calls the clients game made to the library on a particular frame (currently 459). Window 805 shows the state of the client's memory that the library accesses for that frame (these are the ‘raw features’ described above, and which may be specified by the user).
Window 804 shows configurable elements specified by the client through calls to the API (these are ‘derived features’, described above). In this embodiment, the API calls also represent a sequence of training behavior that can be used to train an AI character's brain. Window 806 is used to train a brain using a collection of recordings 807 demonstrating different ‘lessons’. By varying the elements of the collection and the sequence of playback, different AI brains with different behaviors may be produced. This is done by actually calling the API function shown in 803 with the memory state (raw features) shown in 805 and the configurable elements (i.e. derived features, some of which are shown in 803) applied to our library. The trained brain may be saved as a data file and later loaded into the current build of the client's game.
Window 808 provides a cutting tool. This provides a means of removing API calls and eliminating undesired training. Various other kinds of modifications and trans-formation of the recordings are possible (including all manner of edits, removals, additions and transformations of elements of the recording). The recordings can be viewed, debugged, replayed and used to train and output AI brains. Changes to the game code in which the recording was originally made have no effect on any of these operations (unlike traditional means of logging a program's input, particularly by means of recording joystick input).
Additionally, because the values of the derived features depend on the recorded raw features, the derived features can be modified, and the recording replayed following these modifications. Consequently, it can be certain that the changes in output (e.g. brains or values of derived features) are due solely to changes in the derived feature configuration. This is of great advantage in the development of trainable AI as the bulk of the client's time is spent in the configuration of the derived features. The availability of a recording of training means that there is no need to manually resupply training examples in order to regenerate a brain trained with a new derived feature configuration.
Two key features enable this new functionality: 1) the library calls are self-logging. Calls to its API (and parameters to those calls) are recorded by the library itself. The complete and correct recording of information required to regenerate the state of the library subsystem independent of any larger system can therefore be guaranteed. 2) the specification of raw features (by the client to the library) allows the library to record the states of the memory that may be required for its operation, and to restore them at a later time during playback. In particular, the raw features identify the structure and means to interpret that memory (e.g. via the raw features, it is known which memory locations hold variable, the names and types of those variables, the locations of class instances, the names of the classes, the offsets within the classes of data members, the names and types of those data members, and so forth). Further, because the state of memory can be restored to any point in time of the original recording, no operation may cause the sequence of memory states to diverge during playback of the recording. Thus the playback of recording is robust to various kinds of change.
After reading this application, those skilled in the art would recognize that the techniques described herein provide an enabling technology, with the effect that heretofore advantageous features can be provided that heretofore were substantially infeasible. Furthermore, those skilled in the art will recognize that these alternative embodiments and variations are illustrative and are intended to be in no way limiting.

## Claims

1. A method for non-disruptive embedding specialized elements using a computing device, the method comprising:
defining an ontology specifying an application domain;
providing a program interface (API) for creating raw features;
providing a module for at least one form of statistical analysis within the ontology; and
configuring automatically the module with the API in response to a system consistent with the ontology, wherein the system has no substantial requirement for specialized knowledge of the statistical analysis, and the module has no substantial requirement for specialized knowledge of particular functions provided by the system.

2. The method as recited in claim 1, wherein the raw features are created by a developer using the API and types being declared, the raw features provide a convenient way to input information into the specialized elements at run-time.

3. The method as recited in claim 2, further comprising displaying a graphic display showing configurable elements specified by the developer through calls to the API.

4. The method as recited in claim 2, wherein the ontology includes a model of a game world.

5. The method as recited in claim 2, wherein the statistical analysis includes a form of machine learning.

6. The method as recited in claim 5, wherein the form of machine learning includes a portion capable of generating a behavior defined within the ontology.

7. The method as recited in claim 1, wherein the API is supplied in a commonly used computer language so that the developer defines the raw features that are constructed using the API.

8. An apparatus including a non-transitory computer readable medium for storing program instructions, the instructions associated with
defining an ontology specifying an application domain;
providing a program interface (API) for creating raw features;
providing a module for at least one form of statistical analysis within the ontology; and
configuring automatically the module in a computing device with the API in response to a system consistent with the ontology, wherein the system has no substantial requirement for specialized knowledge of the statistical analysis, and the module has no substantial requirement for specialized knowledge of particular functions provided by the system.

9. The apparatus as recited in claim 8, wherein the raw features are created by a developer using the API and types being declared, the raw features provide a convenient way to input information into the specialized elements at run-time.

10. The apparatus as recited in claim 9, the instructions further associated with displaying a graphic display showing configurable elements specified by the developer through calls to the API.

11. The apparatus as recited in claim 9, wherein the ontology includes a model of a game world.

12. The apparatus as recited in claim 9, wherein the form of statistical analysis includes a form of machine learning.

13. The apparatus as recited in claim 12, wherein the form of machine learning includes a portion capable of generating a behavior defined within the ontology.

14. The apparatus as recited in claim 8, wherein the API is supplied in a commonly used computer language so that the developer defines the raw features that are constructed using the API.

15. A system for non-disruptive embedding specialized elements, the system comprising:
specialized elements that are restricted to a particular domain of data analysis or processing, wherein the particular domain is defined by an ontology;
a set of program interfaces for creating raw features for a particular application; and
configurable data, provided by a module for at least one form of statistical analysis within the ontology that permits the specialized elements to be tailored to the particular application, thereby expanding applicability of the specialized elements to a plurality of applications within the particular domain.

16. The system as recited in claim 15, wherein
the specialized elements are provided by a supplier to a developer without the supplier having detailed knowledge of structures and internal operations used by the particular application; and
the particular application is generated by the developer without the developer having detailed knowledge of internal operations used by the specialized elements.

17. The system as recited in claim 16, wherein the particular domain is a particular form of game, simulation, or analysis program.

18. The system as recited in claim 16, wherein the specialized elements enable statistical analysis, data mining, machine learning, online learning, or online analytical processing in the particular domain.

19. The system as recited in claim 16, wherein the configurable data includes templates of configurable data definitions that, once configured, provide a link between the particular application and the specialized elements.

20. The system as recited in claim 19, wherein the configurable data includes one or more parameters that specify predicates and targets for the specialized elements, the specialized elements respond to queries from the particular application.

21. The system as recited in claim 20, wherein the configurable data includes:
one or more header files that define structures for features used by the application; and
one or more parameters that specify predicates and targets for the specialized elements.