Azure form recognizer - model versioning - microsoft-cognitive

Couple of questions about Form Recognizer (FR) model management:
Background:
I'm using FR Labeling tool to train models and C# Function app to interact with FA service and analyze forms.
Each time a model is trained - a new instance is created. New version does not hold any reference to previous versions and there is no way of selecting a model by name in code. Latest model might be queried using TrainingCompletedOn property but it's not failproof and cannot be used if FR has more than one project. Question: if continuous development is being done and model is constantly improved - is there a way (or best practice) to manage which model has to be targeted.
In connection to 1st Q - since FR always creates a new model - it ends up with a big list of not used models that are still active. and since there is no connection between them - there is no safe way of performing a cleanup. old Models can be removed using API but it's a manual process. Any recommendations on how old model versions can be managed?
Can a model be exported added to version control and deployed to other environments from version control? There is an API endpoint to copy models between FR instances, but I would like to keep it in version control and deploy to environments from there.
In connection to Q3 - What is the recommended practice for managing FR project in DevOps? how can work be versioned and deployed across different environments?
Thank you

each model is unique and independent. it's immutable, you need to pick the model with best accuracy based on your test data set.
you can call DELETE api to delete a model.
not such support at this point. as each model can't be changed after it's created, I don't think there is much value in version control for a model.
please see #1, you could use a test data set to measure model performance. If the model does poorly on one test file, you could label that test file and add it to the training set, and train a new (better) model.
-xin (MS Form Recognizer Team)

Related

Firebase Tensorflow Lite Model

I am building a Tensorflow model to predict a certain feature for each user. So, I am making a model for each user of the application. I was wondering how to I upload the Tensorflow lite model to the Firebase in such a way that each user can access the model specific to him/her. For example, let's say there are two users A and B. When A makes a call to firebase, I want to make sure A's model is called and when B uses the app, I want to make sure B's model is called.
Hope that makes sense, Could someone please tell me if there is a way to do this. Thank you!
If you have a different model for each user it wouldn't scale very well if you have a large number of users.
You can use some properties of the user as input in your model, or encode them into some embedding space then use it as part of the input, you can find more info about it here:
https://developers.google.com/machine-learning/crash-course/embeddings/video-lecture
Then you can have a single model that works for all users.

How to get my model and database back in sync Asp.net MVC

I created an application in Asp.Net MVC using the database first method. I generated my model using an edmx file. However i made a change to my context classes. Everytime i run my
application i get the following error:
"The model backing the 'ArticleContext' context has changed since the database was created. Consider using Code First Migrations to update the database"
Should i follow the advice the error gives me? Even though i used the "database first" method?
That depends. Database first approach doesn't only mean that you had the database first and you decide to create your model after that. It also means (in most cases) that database structure would really decide on how your model classes look like. Safest approach is to makde changes on the DB side and promoting them to your model by simply refreshing code from EDMX. If you really need to make some changes to the model classes, do it by implementing parital classes or ViewModels.

ASP.NET MVC3 - Multiple Stored procedures on Single Page

Is it possible to call multiple stored procedures (not multiple result sets from a procedure) and display results on a single page in ASP.NET MVC 3 application?
From what I understand only one Model can created on any single page and my stored procedure is already tied to that Model. I would like to call another procedure and display that result as well on my page
I think the root problem is to understand the meaning of the Model in the MVC pattern.
First of all,
The model consists of application data and business rules, and the controller mediates input, converting it to commands for the model or view.[3] A view can be any output representation of data, such as a chart or a diagram
source
In ASP.Net MVC you link a model to your view, this model should not be part of your domain logic or any domain object
The real model (using the meaning of the MVC pattern) is represented by your domain objects.
So what should you put inside the object that you link to your view??
These objects should contain a representation of the view, in other words simple DTO's containing only the data that is going to be used in the view and nothing more. These models should represent the data being used in the view. If you follow this approach, and you need to display more data in the page, you only need to add another property to this model and voila, you can use it from your view.
In a CQRS architecture, these DTO's should be populated by the Query repositories.
If you do not have a CQRS architecture, just populate these objects in your domain, repositories, etc. Do not do it inside the controller, keep your controllers clean and simple, by making calls to your real domain using services or repositories
Try to avoid the reuse of these DTO's, they should belong to one view only. And do yourself a favor and do not try to reuse a domain object instead of a DTO just to use it as the model.
Following this approach your view-models will be clean, since they will be only DTO's and only containing the data needed by the view. And you can fill these DTO's from different sources, even from different databases if you want.
When you want to perform an action you would read from the model the data provided by the user, and with this data you would call your domain through repositories, services or in a CQRS arc. using commands
The simple answer to your question is "yes".
I suggest you do some more research (ie reading articles and looking at sample apps) into MVC and concentrate on understanding these points:
The Model is a class used to group the data you want to display in the View. It can be populated by a variety of methods and does not have to be the domain object or the pure representation of the database result.
A "page" (the concept of what a user sees in their browser window) can be made up from one or more Views. Each View can be responsible for displaying one type of Model allowing for reuse, but a "page" can have multiple Views.
Models are not "tied" to stored procedures. Perhaps you are using an ORM tool that returns a DTO class (which you call model)? This doesn't have to be the Model used by the View. The Controller could compose several of these DTO classes into one Model class.
N-tier application design where database access is separated from the display logic. MVC tries to encourage this but it still has to be done correctly to avoid tying yourself in knots.
Good luck!

ASP.NET MVC Dummy Repository once working than make Database. Is it wise?

I am working on a project. Completed conceptual model of Database is done in EntityFrameWork. Database is not created yet. Should I make a dummy Records with dummy repository and go on development without creating database and once all done than just created the DB and turn dummy repositories to live? . Is it right decision or should I start making database to work with it from the start?
Thanks
There is nothing wrong with working against a dummy repository. In many ways this is a way of abstracting out your data layer (i.e. EF) from your UI. This should be the case anyhow if you are Unit Testing your models, controllers, etc. One cautionary note (from experience) make sure you're not coding to the hard coded dummy data, real data in the DB may (or will) not conform to the inherent assumptions your hard coded data will most likely have.

How should one import large amounts of data for FIT/Fitnesse tests?

We have a scheduling engine with large amounts of test data to test all the scenarios, so test automation is critical. We're currently hoping to use FIT/Fitnesse. However a single test has quite a large table of test data, so it doesn't fit very well into the mould of "two or three inputs, one or more outputs" that Fitnesse uses in its examples. Hopefully the other functionality of Fitnesse makes it worth using it.
I hear that there is a way to initialize an application for a FIT test with an Excel spreadsheet - not the Spreadsheet to Fitness function, mind you - but I haven't been able to find it so far. Once the whole spreadsheet is loaded into the application, and the application does its thing, we plan to compare either a number of output rows, or perhaps just the last row, to see if the test passes.
The application is currently pulling test data from a database for manual tests, but writing to a database, then initializing from it, is not preferred because of the performance impact.
The application is written in C#.
I can't give a definitive answer without knowing more specifics of your application. When using Fit/FitNesse, you typically write fixture code to interface between the test framework and your application, so you can use this to set up data in any way that suits your application. The examples you've seen use the Fit tables to specify input and expected data, but for large data volumes, this often gets cumbersome. So you might, for example, specify a file name of a spreadsheet in the Fit table that your fixture code would read to feed data to your application.
There is a set of fixtures to set up database data, in a product called DbFit.
This talks about Fit and Excel but is quite old so I don't know what its status is: http://msdn.microsoft.com/en-us/magazine/cc163841.aspx

Resources