Example #1
0
 def test_registry(self):
     registry = MLRegistry()
     self.assertEqual(len(registry.endpoints), 0)
     endpoint_name = "classifier"
     algorithm_object = RandomForestClassifier()
     algorithm_name = "random forest"
     algorithm_status = "production"
     algorithm_version = "0.0.1"
     algorithm_owner = "Kami"
     algorithm_description = "Random Forest with simple pre- and post-processing"
     registry.add_algorithm(endpoint_name, algorithm_object, algorithm_name,
                            algorithm_status, algorithm_version,
                            algorithm_owner, algorithm_description)
     print(registry)
     self.assertEqual(len(registry.endpoints), 1)
Example #2
0
 def test_registry(self):
     registry = MLRegistry()
     self.assertEqual(len(registry.endpoints), 0)
     algorithm_object = BookRatePredictor()
     algorithm_name = "xgboost"
     algorithm_version = "1.0.1"
     algorithm_owner = "from kpi import iasa"
     algorithm_description = "Book rate estimator"
     algorithm_code = inspect.getsource(BookRatePredictor)
     # add to registry
     registry.add_algorithm(algorithm_name,
                 algorithm_version, algorithm_owner,
                 algorithm_description, algorithm_code, algorithm_object)
     # there should be one endpoint available
     self.assertEqual(len(registry.endpoints), 1)
Example #3
0
 def test_registry(self):
     registry = MLRegistry()
     self.assertEqual(len(registry.endpoints), 0)
     endpoint_name = 'income_classifier'
     algorithm_object = RandomForest()
     algorithm_name = "random forest"
     algorithm_status = "production"
     algorithm_version = "0.0.1"
     algorithm_owner = "Piotr"
     algorithm_description = "Random Forest with simple pre- and post-processing"
     algorithm_code = inspect.getsource(RandomForest)
     registry.add_algorithm(endpoint_name, algorithm_object, algorithm_name,
                 algorithm_status, algorithm_version, algorithm_owner,
                 algorithm_description, algorithm_code)
     # there should be one endpoint available
     self.assertEqual(len(registry.endpoints), 1)
Example #4
0
    def test_registry(self):
        registry = MLRegistry()
        self.assertEqual(len(registry.endpoints), 0)
        endpoint_name = "income_classifier"
        algorithm_object = RandomForestClassifier()
        algorithm_name = "random forest"
        algorithm_status = "production"
        algorithm_version = "0.0.1"
        algorithm_owner = "Piotr"
        algorithm_description = "Random Forest with simple pre- and post-processing"
        algorithm_code = inspect.getsource(RandomForestClassifier)
        # add to registry
        registry.add_algorithm(endpoint_name, algorithm_object, algorithm_name,
                               algorithm_status, algorithm_version, algorithm_owner,
                               algorithm_description, algorithm_code)
        # there should be one endpoint available
        self.assertEqual(len(registry.endpoints), 1)

        def test_et_algorithm(self):
            input_data = {
                "age": 37,
                "workclass": "Private",
                "fnlwgt": 34146,
                "education": "HS-grad",
                "education-num": 9,
                "marital-status": "Married-civ-spouse",
                "occupation": "Craft-repair",
                "relationship": "Husband",
                "race": "White",
                "sex": "Male",
                "capital-gain": 0,
                "capital-loss": 0,
                "hours-per-week": 68,
                "native-country": "United-States"
            }
            my_alg = ExtraTreesClassifier()
            response = my_alg.compute_prediction(input_data)
            self.assertEqual('OK', response['status'])
            self.assertTrue('label' in response)
            self.assertEqual('<=50K', response['label'])
Example #5
0
import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')

application = get_wsgi_application()

# ML registry
from ml.registry import MLRegistry
from ml.classifier.random_forest import RandomForestClassifier

try:
    # create ML registry
    registry = MLRegistry()
    # Random Forest classifier
    rf = RandomForestClassifier()
    # add to ML registry
    registry.add_algorithm(
        endpoint_name="classifier",
        algorithm_object=rf,
        algorithm_name="random forest",
        algorithm_status="production",
        algorithm_version="0.0.1",
        owner="Kami",
        algorithm_description=
        "Random Forest with simple pre- and post-processing")
except Exception as e:
    print("Exception while loading the algorithms to the registry,", str(e))
Example #6
0
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'recommendations.settings')
application = get_wsgi_application()

from ml.registry import MLRegistry
# from ml.knn import KNN
from ml.bert import BERT

from utils import custom_logging

try:
    registry = MLRegistry()
    # knn = KNN('/code/ml/knn/')
    # registry.add_algorithm("knn", knn)

    bert = BERT()
    registry.add_algorithm("bert", bert)
    print('ke')

except Exception as e:
    print("Exception while loading the algorithms to the registry,", str(e))
Example #7
0
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')

application = get_wsgi_application()
import inspect
from ml.registry import MLRegistry
from ml.income.random_forest import RandomForestClassifier

try:
    registry = MLRegistry() # create ML registry
    # Random Forest classifier
    rf = RandomForestClassifier()
    # add to ML registry
    registry.add_algorithm(endpoint_name="income",
                            algorithm_object=rf,
                            algorithm_name="random forest",
                            algorithm_status="production",
                            algorithm_version="0.0.1",
                            owner="Piotr",
                            algorithm_description="Random Forest with simple pre- and post-processing",
                            algorithm_code=inspect.getsource(RandomForestClassifier))

except Exception as e:
    print("Exception while loading the algorithms to the registry,", str(e))
Example #8
0
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""

import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')
application = get_wsgi_application()

# ML registry 
import inspect
from ml.registry import MLRegistry
from ml.income_classifier.random_forest import RandomForest
from ml.income_classifier.extra_trees import ExtraTrees

try:
    registry = MLRegistry() #Creates ML registry
    rf = RandomForest()
    registry.add_algorithm(endpoint_name="income_classifier", algorithm_object=rf,
                            algorithm_name="random forest",
                            algorithm_status="production",
                            algorithm_version="0.0.1",
                            owner="Gabriel",
                            algorithm_description="Random Forest with simple pre- and post-processing",
                            algorithm_code=inspect.getsource(RandomForest))
    et = ExtraTrees()
    registry.add_algorithm(endpoint_name="income_classifier", algorithm_object=et,
                            algorithm_name="extra trees",
                            algorithm_status="testing",
                            algorithm_version="0.0.1",
                            owner="Gabriel",
                            algorithm_description="Extra Trees with simple pre- and post-processing",
Example #9
0
import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'coursework.settings')

application = get_wsgi_application()
import inspect
from ml.registry import MLRegistry
from ml.classifier.log import Models
from ml.classifier.ada import Ada



try:
    registry = MLRegistry() # create ML registry
    # Random Forest classifier
    rf = Models()
    # add to ML registry
    registry.add_algorithm(endpoint_name="classifier",
                            algorithm_object=rf,
                            algorithm_name="Models",
                            algorithm_status="production",
                            algorithm_version="0.0.1",
                            owner="Piotr",
                            algorithm_description="Models with simple pre- and post-processing",
                            algorithm_code=inspect.getsource(Models))

    # Extra Trees classifier
    et =Ada()
    # add to ML registry
Example #10
0
It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""

import os
from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')
application = get_wsgi_application()

# ML registry
import inspect
from ml.registry import MLRegistry
from ml.predictor.predictor import BookRatePredictor

try:
    registry = MLRegistry()  # create ML registry
    # Random Forest classifier
    pred = BookRatePredictor()
    # add to ML registry
    registry.add_algorithm(algorithm_object=pred,
                           algorithm_name="xgboost",
                           algorithm_version="1.0.1",
                           algorithm_owner="from kpi import iasa",
                           algorithm_description="Book rate estimator",
                           algorithm_code=inspect.getsource(BookRatePredictor))

except Exception as e:
    print("Exception while loading the algorithms to the registry,", str(e))