- Created by Dave Trier, last modified by Alberto Rodriguez on Jul 14, 2020
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 14 Next »
ModelOp Center provides plugins into common data science development tools such as Jupyter, to allow data scientists to interact with ModelOp Center from their preferred development environment.
Table of Contents
What’s New in v2.1:
Including “Model Functions” definition feature to “Add Model” wizard.
Inspects the code searching for functions to include as options of the dropdown.
Read “smart comments” and pre-sets functions.
Include help about “Model Functions” and “Smart Tags” in information icon.
Editing existing model.
Basic Model Info.
Model Functions (same way).
Platform summary.
Catches unsaved changes in code before saving.
ModelOp toolbar update.
Get rid of “Model Details” button (it was for debugging purposes).
The “Asset Details” button lets you edit the asset name and repo info.
Include Live Search on the “Load Model” screen.
Allow search by model name
Allow search by tag
Support for external parameterized ModelOp Center base URL.
Environment variable setup.
Parameter in NBextensions config.
Enable CORS support to invoke REST API from Jupyter external host.
Enable external libraries compatibility when running on an custom instance.
Add support for Jupyter versions prior to 5.7.0, incompatibility between jquery 3+ and jquery-ui <1.12
Validating file extension to source code asset filename (when creating model and when editing asset file name)
Visualizing ModelOp Jupyter plugin version in all dialogs
Visual feedback on the attachments file upload status
Support for asset role definition on the attachments (during model creation and during file upload).
Enable plugin for Jupyterhub notebook.
Bug Fixes:
When a model was just created the “submit” screen didn’t show the last changes (the initial commit).
Update local cell metadata when saving a model (to avoid keeping outdated data).
Validate to include only code cells in the model creation
Include the model summary in the ‘Save’ screen.
Updating a model overwrote MOC with the current (modified) local copy. That got fixed on “Model Save”, “Model functions editing”, “Asset button edit”
Using ModelOp Center Jupyter plugin V2.1
Overview
The ModelOp Center (MOC) is flexible on how models are registered so that data scientists can leverage their preferred environments for model creation. In other words it is agnostic to the toolkit used to create the model.
Jupyter (http://jupyter.org/) is a popular tool among data scientists and other users of Python and R for building models. It is an evolution of the IPython project, and provides a Notebook interface similar to that of Mathematica or SAGE. For the purposes of the interaction between ModelOp Center and Jupyter we have the Jupyter plugin available which makes it easier to make some of the most useful operations directly in the user’s IDE of choice, in this case, Jupyter notebook.
Installation and configuration instructions
ModelOp specific functions available within Jupyter
Once installed, when the user opens or creates a new Jupyter notebook file, the Jupyter notebook interface is provided with a set of toolbar buttons that interact with ModelOp Center and will be expanded in the sections below.
Registering a new model
From the toolbar, click on the “Register a new model with ModelOp Center” icon.
The “Add Model to Model Operations Center” window opens. Click in the left side of the code cells to designate that the code is part of the model. The selected cells will have a highlighted green border on the left.
Click Next. In the “Model Information” section, type the Model Name. Optionally, you can add a brief Description of the model.
Click Next. In the “Cell details” section:
Choose the remote repository configuration. Make sure ModelOp Center has been configured with access to the git repositories.
If the Git Remote text field is blank it will create a local (to ModelOp Center) git repository (no remote repository associated).
If the Git Remote text field is provided (with a valid accessible git repository URL), the local copy will be associated with given remote repository.
Check Use default repo option if you want the same git remote and branch for all the source code assets (cells). Otherwise, specify each asset with a different remote url or branch.
You can entirely disable git handling by switching off the Remote repo configuration toggle. This will in turn handle the source code assets using ModelOp Center internal storage only.Provide a File Name, and select Primary Model Source if appropriate.
The file name will be complemented with a default extension, but it can be provided by the input text field as part of the file name.
A model must have one and only one primary source code, which is where it will look for the model functions (more on model functions in the next step).
Click Next. Specify the model functions used in your code. (For additional information on the model functions please see here.) ModelOp Center allows the user to associate the triggering operations with specific code functions. Additionally it can identify if the functions already have predefined model functions associated via smart tags. These optional smart tags should be presented as comments in the line above the function definition and the supported comments are:
modelop.init
modelop.score
modelop.metrics
modelop.training
For example:# modelop.init def begin(): ...
You will find that the functions identified from source with a smart tag are already associated with one of the functions, and this selection is not modifiable. If you wish to change the associated model function, either you can edit or remove the smart tag comment, or you can modify the associated model function in the ModelOp Center UI.
The function associated via smart tag cannot be used for multiple model functions, but the remaining functions can be selected as options for the other associations:Click Next. On the next screen, add any attachments associated the model and select an asset role for each of the files to upload. This will help ModelOp Center runtime identify the accompanying assets for different purposes across the Model Life Cycle. Leave the asset role blank to let ModelOp Center automatically identify the asset based on the file type.
Click Next. Review the summary and click Submit Model.
Opening an existing model
From the toolbar, click on the “Load model from ModelOp Center“ icon.
Then, either select the desired model from the list or filter models using the live search bar. Note that your search can match the name of the model or the tags of the model.
The plugin will then create a new cells at the bottom of the active notebook with the source code assets' contents (each asset on a new cell).
Updating an existing model
There are multiple ways in which a model can be updated, depending on what you are ultimately achieving.
Editing the source code
From the toolbar, click on the “Update current model in ModelOp Center“ icon.
Please make sure the previously select a cell which is part of a model already loaded or created using either of the two options above (Registering a new model / Opening an existing model). The screen prompted will confirm the latest changes worked on the cell code before updating the model. This option copies back the source code of the selected cell into the ModelOp Center.
Updating model metadata fields
From the toolbar, click on the “Edit current model” icon.
Please make sure you previously select the notebook cell with an associated model, and the plugin will prompt you with a screen that allows to change the following:
Edit the Model Information
Change Model Name
Change the model Description
Edit the model functions associated with the primary source code. Please refer to “Registering a new model” section of this guide or here for more details. Please note that in order to avoid versioning conflicts, make sure to save all code modifications as indicated in the step “Editing the source code” above before changing the model functions. This will prevent recently introduced function definitions in the code to be associated before the code itself is synced back to ModelOp Center.
This step also sends ModelOp Center with information of the underlying platform in which this is run (system details, python details and libraries loaded).
Adding attachments
From the toolbar, click on the “Add attachment for existing model” icon.
Please make sure you previously select the notebook cell with an associated model, and the plugin will prompt you with a file browser and a screen to attach selected file to the model in the active cell.
Select the role for the asset to upload or leave blank to be automatically determined by ModelOp Center based on the file type.
Submit model version
From the toolbar, click on the “Submit a model version to ModelOp Center” icon.
Please make sure you previously select the notebook cell with an associated model, and the plugin will prompt you with a screen confirming the last changes made to the model.
This action will submit a version for deploy, creating a deployable model. Note it doesn’t directly deploy the model depending on the active Model Life Cycle (MLC) process associated.
- No labels