Package: vai-lab
Virtual Artificially Intelligent Laboratories (VAI-Lab)VAI-Lab is a modular, easy-to-use framework for Virtual Laboraties for science and design, where Artifical Intelligence assists the user in their goals.WarningThis project is currently a work in progress and is intended for wider use when a full release is made.Users are welcome to use the software in its current state, but should expect to heavily alter source code until full testing has been done.Consult the development and release schedule for the intended timeline for this project.Any contributions, forks, or pull requests are very welcome. Feel free to get in touchHow to ContributeThe aim of this framework is to be a community effort that will benefit science, engineering and more.We are actively seeking contribution in the form of users, testers, developers, and anyone else who would like to contribute.If you have methods which can be added to the framework,get in touch!If you think this framework will be useful to your research,get in touch!If want to get invovled in development,get in touch!Noticed a bug or other issue?get in touch!How it WorksThe VAI-Lab framework uses a modular, plugin-based architecture.Each module represents a process (e.g. Modelling) and each plugin is a specific implementation of that process (e.g. linear regression).Modules can be chained, looped and modified in real-time to create a highly customisable framework for the user's requirements.InstallationInstalling from packageTo install the latest pip release:pip install vai-labInstalling from sourceClone this repository via HTTPS:gitclonehttps://github.com/AaltoPML/VAI-lab.gitOR SSH:gitclonegit@github.com:AaltoPML/VAI-lab.gitChange directorycdVAI-labCreate a virtual environment and activate it using venvpython3-mvenvvenv&&sourcevenv/bin/activateor using condacondacreate--namevai_labpython=3.8&&condaactivatevai_labUpgrade pippython3-mpipinstall-UpipInstall the packagepython3-mpipinstall.Running Unit TestsUnit tests are run with pytest withpytestLaunching and ExamplesFrom Command LineTo launch the framework with the GUI:vai_labTo launch the framework with an existing config filevai_lab--file<path_to_config_file>From CodeTo launch the framework with the GUI:importvai_labasaicore=ai.Core()core.run()or to execute an existing config file:importvai_labasaicore=ai.Core()core.load_config_file("<path_to_config_file>")core.run()ExamplesPre-madeexamplesshow the syntax and form of the config files and pipeline as a whole, and are the best way to get started.Some basic use-cases are provided among many others:user_feedback_demo.xmlDemonstrates manual image classification of chest X-rayscanvas_demo.xmlLaunches the canvas state-action pair visualiser and editorregression_demo.xmlDemonstrates simple linear regression on a small set of sample dataLaunching examples:To demonstrate the syntax for launching examples usinguser_feedback_demo.xml.Using the command linevai_lab--file./examples/xml_files/user_feedback_demo.xmlFrom codeimportvai_labasaicore=ai.Core()core.load_config_file(("./examples/xml_files/user_feedback_demo.xml"))core.run()Absolute paths, as well paths relative to the library's base directory can be used.
For library-relative paths, starting a path definition with"./"defaults to the directory<path_to_site_packages>/vai_lab/In addition to path strings, the config file paths can be passed as lists or tuples of directory paths. Therefore, the above command/code are equivalent tovai_lab--file./examplesxml_filesuser_feedback_demo.xmlandimportvai_labasaicore=ai.Core()core.load_config_file(("./examples","xml_files","user_feedback_demo.xml"))core.run()Defining Pipelines in GUIThe VAIL module allows to define a pipeline and the relations within by drawing a flowchart on a canvas. This canvas always starts with aninitialisermodule and anoutputmodule and allows to define any number of modules between these two. To do so, the user needs to define the modules and the relations between them.ModulesAt this moment, there are 7 possible modules for VAIL.initialiserandoutputare compulsory for the pipeline, the rest of them can be freely placed in the canvas. These are:Data processing.Modelling.Decision making.User Feedback Adaptation.Input data.If you click on a module and drag it you can modify its position on the canvas.
Finally, they can be deleted by clicking on the desired module and then clicking on theDelete selectionbutton.Module joiningEach module object has a number of circles that can be used to join two modules. The initially clicked circle will be identified as the parent and the second one as the child (the output of the father is fed to the input of the child). There can be only one connection from each circle. As of this version, if you need to edit an existing connection you need to delete one of the connected modules.LoopsIf you click on the canvas and drag, you can draw a rectangle that defines which modules are inside the loop. Upon releasing the button you are requested to input what type of loop you want and what condition should be fulfilled to end the loop.Pipeline uploading via XML fileThe pipeline can also be defined uploading an existing XML file. The structure of the XML file is described in the Back-end section.Plugin Examplesmanual_inputRequires the user to indicate to which class the specified data corresponds to.
In the current example, the model needs to classify images and the model requires expert knowledge for specific images.
The user needs to indicate which classes correspond to the image and save the results to send them to the model.canvas_inputRequires the user to give feedback to state-action pairs.
It opens a tab for each interactable object in the model and either requires adding new state-action samples or to modify the existing ones.
In the current example, the model has two interactable objects that require feedback in two forms: (1) ananglefor the state and for the action or (2) a tuple ofCartesian coordinatesfor the state and for the action. It has been adapted to be able to give feedback to any number of objects. These, at the same time, can be eitherslidingorrotatingobjects. Specifically,slidingrefers to objects that need Cartesian feedback in a two-dimensional space, whilerotatingrefers to objects that require an angle. In order to give feedback, you can choose to either move the corresponding state-action pairs on the canvas or directly edit the tree view display. This last option results in an automatic update on the canvas of the state-action location.Defining a pipeline in XMLThe pipeline structure is defined between thepipelinetags:<pipeline>...</pipeline>InitialiseTheInitialisetag is the dedicated entry point to the pipeline. No other entry points can be declared.Current options:name: attribute for user defined nameinitial_data: element for declaring directory for initial datarelationships: User defined names of modules this one is connected toExample fromcanvas_demo.xml<Initialisername="Init"><inputdata><Xfile="./examples/state-action/X_data.csv"/></inputdata><relationships><childname="My First UserFeedback Module"/></relationships></Initialiser>LoopsLoop tags are used to iterate over a given set of modules until a condition is met. Loops can be nested and named.Seebasic_operation.xmlfor full example.
Current options:type: what variety of loop will this be:for,while,manual(user defined stopping condition on-the-fly)condition: Termination condition for the loop. I'm not sure how to deal with the criteria forwhileloopsname: User defined name for loop<looptype="for"condition="10"name="For Loop 1">...</loop>ModulesModules are declared by tags matching their names, e.g. the GUI module is loaded with theGUItag:Required:name: Unique user defined name for module, so can be referenced laterplugin: The type of plugin to be loaded into the module, along with associated options.relationships: User-defined names of theparentmodules which this module receives data from andchildmodules that this module passes data to.Example fromridge_regression_demo.xml:<Modellingname="Modelling"><relationships><parentname="Initialiser"/><childname="Output"/></relationships><plugintype="RidgeRegression"><alpha>0.02</alpha></plugin></Modelling>Data DefinitionData is loaded from existing files in either theInitialiserorInput Datamodules and is specified using theinputdatatags.Example fromridge_regression_demo.xml:<inputdata><Xfile="./examples/supervised_regression/X_tr.csv"/><Yfile="./examples/supervised_regression/Y_tr.csv"/><X_testfile="./examples/supervised_regression/X_tst.csv"/><Y_testfile="./examples/supervised_regression/Y_tst.csv"/></inputdata>Writing DataTwo methods are given to add data to the XML file. One for modules (append_pipeline_module_to_file) and one for data structures (append_data_structure_field_to_file).Feature and Release Schedule :calendar:October/ November 2022: Public repo, API fixing, TestingJanuary 2023: Representative use case releaseSpring 2023: Initial full release of manual pipelineFall 2023: Initial release of preliminary AI-AssistanceGet in TouchIf you would like contribute, test, give feedback, or ask questions about this framework, we'd like to hear from you!
Email us at:Chris McGreavy, chris.mcgreavy [at] aalto.fiCarlos Sevilla-Salcedo, carlos.sevillasalcedo [at] aalto.fi