Precautions for ml.net retraining model.

Time:2021-10-13

Ml.net is Microsoft machine learning. If you need a fixed model to operate, just follow the tutorial on the official website. However, most models may not meet the existing needs, so we need to retrain the model.
There are restrictions on the retraining model. The data classification of your retraining model must be the existing classification of the original model. If you want to add classification, you can only retrain a new model for operation.
If the model is retrained, another model file needs to be saved during the first model generation, as shown in the figure:

The module is generated through the defined ogdextimator algorithm, and the algorithm in ogdextimator needs to be consistent with the algorithm of the pipeline you generate the model above. The parameters labelcolumnname and featurecolumnname required by the algorithm also need one-to-one correspondence.
The preparations for the first modeling phase have been completed, and the two zip files to be saved should be saved into the project as far as possible.
The existing models for follow-up training are as follows:

First load the two model files you saved. The parameter type converted by originalmodelparameters needs to match the algorithm parameter type of your model, otherwise it will prompt that the conversion cannot succeed.

Then load the new data you imported and turn it into idataview.

This part is mainly about the algorithm of retraining the model. The parameters in lbfgsmaximumentropy should correspond. Needless to say, of course, your algorithm is not much worse than others.
The first is your new data and the second is your old data. The new training model will start with the old data.

The generated retrainedmodel model data can be saved directly to modelzip.

Next, some changes need to be made when using this model.
If you don’t need to retrain the model, the prediction is as follows:

Directly take the first generated model for prediction. Then return to your predicted results.
However, when we retrain the model, we need to make some changes to the prediction method:

The initial model and the trained model need to be loaded.
This is probably the normal process of retraining the model. The normal generation model and prediction methods can be found in the official demo.
Note: after saving the model, the weights will not be obtained, and the non-public members will be prompted. Then I need to do this:

Define first, and then get the data of weights through getweights.

Recommended Today

SQL statement of three-level linkage of provinces, cities and counties

The first is the table creation statement Copy codeThe code is as follows: CREATE TABLE `t_address_province` ( `id` INT AUTO_ Increment primary key comment ‘primary key’,`Code ` char (6) not null comment ‘province code’,`Name ` varchar (40) not null comment ‘province name’)Engine = InnoDB default charset = utf8 comment = ‘province information table’; CREATE TABLE […]