How to use the mlpm.solver.Solver function in mlpm

To help you get started, we’ve selected a few mlpm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github autoai-org / AID / components / mlserve / runner_example.py View on Github external
# Copyright (c) 2020 Xiaozhe Yao & AICAMP.CO.,LTD
# 
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT

from mlpm.solver import Solver
from mlpm.metrics import Metrics
from mlpm.server import aidserver

class ExampleSolver(Solver):
    def __init__(self,toml_file=None):
        super().__init__(toml_file)
        self.predictor = ''
        self.acc = Metrics()

    def infer(self, data):
        print(data)
        return {'data': [0, 1, 2, 3]}

    def train(self, data):
        epochs = int(data['epochs'])
        for i in range(epochs):
            print(i)
        print(data)
        return data