Skip to main content

Modelmanager API With Azure ML Integration

Project description

Welcome to Modelmanager-api!

This is a api model for interacting with modelmanager.

Note:

  • Example files are are in example_script directory.
  • Example assets are in api_assets directory.
  • It contains scripts for different actions(Add, Update, Delete).

Example Codes

Add Project

from mmanager.mmanager import Usecase
secret_key = 'Secret-Key'
url = 'URL'
data = {
		"name": "UsecaseName",
		"author": "AuthorName",
		"description": "UsecaseDescription",
		"source": "UsecasSource",
		"contributor": "UsecaseContributor",
		"image": 'image.jpg' , #path to image file
		"banner": 'banner.jpg' , #path to banner file
	}
Usecase(secret_key, url).post_usecase(data)

Update Project

from mmanager.mmanager import Usecase
secret_key = 'Secret-Key'
url = 'URL'
project_id = Project_id #use model_id number to update
data = {
		"author": "AuthorName",
		"description": "UsecaseDescription",
		"source": "UsecasSource",
		"contributor": "UsecaseContributor",
		"image": 'image.jpg' , #path to image file
		"banner": 'banner.jpg' , #path to banner file
	}
Usecase(secret_key, url).patch_usecase(data, project_id)

Delete Project

from mmanager.mmanager import Usecase
secret_key = 'Secret-Key'
url = 'URL'
project_id = Project_id #use project_id number to delete
Usecase(secret_key,url).delete_usecase(project_id)


Add Model, Dataset OnPrem

from mmanager.mmanager import Model
secret_key = 'Secret-Key'
url = 'URL'
model_data = {
    "project": "<project-id>", #project-id
    "transformerType": "Classification",
    "algorithmType": "Xgboost",
    "modelFramework": "other",
    "weight": "",
    "datasetinsertionType": "Manual", #To upload datasets and model form local to server
    "training_dataset": "%s/model_assets/train.csv" % path, #path to csv file
    "pred_dataset": "%s/model_assets/pred.csv" % path, #path to csv file
    "actual_dataset": "%s/model_assets/truth.csv" % path, #path to csv file
    "test_dataset": "%s/model_assets/test.csv" % path, #path to csv file
    "model_image_path": "%s/model_assets/model_image.jpg" % path, #path to model image file
    "model_summary_path": "%s/model_assets/summary.json" % path,
    "model_file_path": "%s/model_assets/model.h5" % path, #path to model file
    "scoring_file_path": "",
    "target_column": "label",
    "note": "",
    "model_area": "apiUpload",
    "model_dependencies": "",
    "model_usage": "",
    "model_adjustment": "",
    "model_developer": "",
    "model_approver": "",
    "model_maintenance": "",
    "documentation_code": "",
    "implementation_plateform": "",
    "error_traceback": "",
    "distribution_error": False,
    "current_date": "",
    "production": "observation",
    "regulations": "",
    "score_data": "",
    "sweetviz": "",
    "error_traceback_distribution": "",
    "binarize_scoring_flag": False, #True if binary data
    "model_input_data": "",
    "modelscore_compute": False,
	"amlCred": "",
}
ml_options = {
    "credPath": "config.json",
    "datasetUploadPath": "api_upload_test",
    "fetchOption": "", #Not required
    "modelName": "model-name",
    "dataPath": "", #Not required
    "registryOption": ["Model"], #To register model, add ["Model", "Dataset"] to register both
}
Model(secret_key, url).post_model(model_data, ml_options)

Add Model, Dataset From Azure ML

from mmanager.mmanager import Model
secret_key = 'Secret-Key'
url = 'URL'
model_data = {
    "project": "<project-id>", #project-id
    "transformerType": "Classification",
    "algorithmType": "Xgboost",
    "modelFramework": "other",
    "weight": "",
    "datasetinsertionType": "AzureML",
    "training_dataset": "",
    "pred_dataset": "",
    "actual_dataset": "",
    "test_dataset": "",
    "model_image_path": "",
    "model_summary_path": "",
    "model_file_path": "",
    "scoring_file_path": "",
    "target_column": "label",
    "note": "",
    "model_area": "apiUpload",
    "model_dependencies": "",
    "model_usage": "",
    "model_adjustment": "",
    "model_developer": "",
    "model_approver": "",
    "model_maintenance": "",
    "documentation_code": "",
    "implementation_plateform": "",
    "error_traceback": "",
    "distribution_error": False,
    "current_date": "",
    "production": "observation",
    "regulations": "",
    "score_data": "",
    "sweetviz": "",
    "error_traceback_distribution": "",
    "binarize_scoring_flag": False, #True if binary data
    "model_input_data": "",
    "modelscore_compute": False,
    "amlCred": "",
}
ml_options = {"credPath": "config.json",
              "datasetUploadPath": "",
              "fetchOption": ["Model"], #To fetch model, add ["Model", "Dataset"] to fetch both model and datasets
              "modelName": "model-name",
              "dataPath": "dataset-name",
              "registryOption": "",
              }
Model(secret_key, url).post_model(model_data, ml_options)

Update Model

from mmanager.mmanager import Model
secret_key = 'Secret-Key'
url = 'URL'
model_id = Model_id #use model_id number to update
data = {
		"transformerType": "logistic",
		"target_column": "id",
		"note": "api script Model",
		"model_area": "api script Model",
		"model_dependencies": "api script Model",
		"model_usage": "api script Model",
		"model_audjustment": "api script Model",
		"model_developer": "api script Model",
		"model_approver": "api script Model",
		"model_maintenance": "api script Model",
		"documentation_code": "api script Model",
		"implementation_plateform": "api script Model",
		"training_dataset": "train.csv", #path to csv file
		"pred_dataset": "submissionsample.csv", #path to csv file
		"actual_dataset": "truth.csv", #path to csv file
		"test_dataset": "test.csv", #path to csv file
		"model_file_path":"",
	    "scoring_file_path":"",
		"model_image_path":"" ,
    	"model_summary_path":"",
	}
Model(secret_key, url).patch_model(data, model_id)

Delete Model


from mmanager.mmanager import Model
secret_key = 'Secret-Key'
url = 'URL'
model_id = Model_id #use model_id number to delete
Model(secret_key,url).delete_model(model_id)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mmanager-2.0.0-py3-none-any.whl (91.5 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page