We support several types of simple models in our framework:
The detailed smart contract implementations for the models can be found here.
Some of the parameters and fields in those contracts use integers that are multiplied by 109 (1E9).
This is because Solidity contracts cannot handle floating point numbers yet.
The JSON files uploaded to the demo dashboard should not have this conversion already done to the data they hold.
The code that deploys the model to a smart contract will handle these conversions before deploying.
Model Files
Model files contain the information for a model such as its weights or features.
These files can be provided to the demo dashboard to deploy the model to a smart contract on a blockchain.
The dashboard accepts a single file containing only the JSON for one model.
The JSON requires a "type"
key with the value being the string for the model name, for example: {"type: "naive bayes", ...}
.
Details for the fields and their values for each model type can be found here.
As explained above, the numbers in the JSON should not be pre-converted to large integers.
Creating Model Files
You can create the JSON file however you wish but if you use our simulation tools then you can export certain supported models using the export
function in the Classifier
interface.
You might also find the implementation of the export
function for certain scikit-learn models in SciKitClassifier
useful if you need to make your own JSON file.