Package: mmanager
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 assets directory.It contains scripts for different actions(Add, Update, Delete).Check logs from file mmanager_log.logExample CodesAdd Applicationsfrommmanager.mmanagerimportApplicationssecret_key='Secret-Key'url='URL'application_data={"name":""}Applications(secret_key,url).post_application(data=application_data)Add Classification/Regressionfrommmanager.mmanagerimportUsecasesecret_key='Secret-Key'url='URL'data={"name":"Determination Of Origin Of Wine Using Chemical Analysis","description":"Wine is one of the most popular alcoholic drinks which has been used for thousands of years. Wine is produced by fermenting grapes.",#(Optional)"image":'/path/image.jpg',#(Optional)}Usecase(secret_key,url).post_usecase(data)Other optional dataKey wordExampleauthorJohn Doeusecase_typeClassification (Options: Classification, Regression, Forecasting)computing_typeClassical (Options: Classical, Qantum, Hybrid)sourceForina, M. et al, PARVUS -An Extendible Package for Data Exploration, Classification and Correlation.,Institute of Pharmaceutical and Food Analysis and Technologies, Via Brigata Salerno,16147 Genoa, Italy.contributorS. Aeberhard, D. Coomans and O. de Vel, Comparison of Classifiers in High Dimensional Settings, Tech. Rep. no. 92-02, (1992), Dept. of Computer Science and Dept. of Mathematics and Statistics, James Cook, University of North Queensland.is_privateSet True to keep the usecase private. Default False.trustabilitySet True to list in trustability. Default False.explainabilitySet True to list in explainability. Default False.hide_modelSet True to hide model related to this usecase. Default False.notification_emailsList of emails that will be notified. Eg:johndoe@qausal.com,adams_mary@qausal.comForecasting Usecasefrommmanager.mmanagerimportUsecasesecret_key='Secret-Key'url='URL'usecase_info={"name":"","usecase_type":"Forecasting","author":"","description":"","source":"","contributor":"","image":"","performance_data_selection":"","notification_emails":["example@example.com"],"applications":"application_id"}forecasting_tables={"table_act":"daily_act2","table_preds":"pred_bounds","table_daily_pred":"daily_pred","table_stats":"pred_statistics","table_fac_name":"fac_id_name","table_metrics":"metric_id_name",}forecasting_tables_fields={"series":"","condition_one":"","condition_two":"","condition_three":""}forecasting_feature_tabs={"result_tab":True,"series_tab":True,"condition_tab":True,"performance_tab":True,"ab_testing_tab":True,"release_tab":True}Usecase(secret_key,url).post_usecase(usecase_info,forecasting_tables,forecasting_tables_fields,forecasting_feature_tabs)Update Usecasefrommmanager.mmanagerimportUsecasesecret_key='Secret-Key'url='URL'project_id=Project_id#use model_id number to updatedata={"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)Get All Usecases Uploaded By Authenticated Userfrommmanager.mmanagerimportUsecasesecret_key='Secret-Key'url='URL'usecases=Usecase(secret_key,url).get_usecases()print(usecases)Get Usecase Detailfrommmanager.mmanagerimportUsecasesecret_key='Secret-Key'url='URL'usecase_id="Usecase-Id"# GET USECASE DETAILusecase_detail=Usecase(secret_key,url).get_detail(usecase_id)print(usecase_detail)# GET ALL USECASE UPLOATED BY AUTHENTICATED USER_usecases=Usecase(secret_key,url).get_usecases()print(_usecases)# GET ALL MODEL ID REGISTERED UNDER USECASEmodel_list=Usecase(secret_key,url).get_models(usecase_id)print(model_list)Delete Projectfrommmanager.mmanagerimportUsecasesecret_key='Secret-Key'url='URL'project_id=Project_id#use project_id number to deleteUsecase(secret_key,url).delete_usecase(project_id)Add Related Databasefrommmanager.mmanagerimportExternalDatabasesecret_key='Secret-Key'url='URL'# db_type: Postgres, MySQLrelated_db_data={"db_type":"Postgres","db_name":"db_name","db_user":"username","db_password":"db_pass","db_host":"localhost","db_port":"5432"}ExternalDatabase(secret_key,url).post_related_db(data=related_db_data)Link External Databasefrommmanager.mmanagerimportExternalDatabasesecret_key='Secret-Key'url='URL'# link_type: Client, Systemexternal_db_data={"link_type":"System","usecase":"usecase_id","external_db":"related_db_id","train_table":"","test_table":"","pred_table":"","actuals_table":""}ExternalDatabase(secret_key,url).link_externaldb(data=external_db_data)Load Database Cachefrommmanager.mmanagerimportUsecasesecret_key='Secret-Key'url='URL'Usecase(secret_key,url).load_cache(usecase_id=7)Add Modelfrommmanager.mmanagerimportModelsecret_key='Secret-Key'url='URL'path='assets'#path to csv filemodel_data={"project":"1",#Project ID or Usecase ID"transformerType":"Classification",#Options: Classification, Regression, Forcasting"datasetinsertionType":"Manual"#Options: AzureML, External DB, Manual"training_dataset":"/path/train.csv""test_dataset":"/path/test.csv""pred_dataset":"/path/pred.csv""actual_dataset":"/path/truth.csv""model_file_path":"/path/model.h5""target_column":"Class"}Model(secret_key,url).post_model(model_data)Other optional dataKey wordExamplenotemodel_areamodel_dependenciesmodel_usagemodel_audjustmentmodel_developermodel_approvermodel_maintenancedocumentation_codeproductionProduction (Options: production, observation, retired)model_input_data"/path/input.csv" (Path to input data.)computing_typeClassical (Options: Classical, Qantum, Hybrid)binarize_scoring_flagSet True to label binarize. Default False.algorithmTypeXgboost (Options: Xgboost, GBM)modelFrameworkdriverless_ai (Options: driverless_ai, tensorflow, keras, scikit, statmodlib, other)Create Config File For Azure ML CredentialsGet Credentials from your existing Azure ML account.Create a config file in following formatGive credential file path in credPath field to enable using AML integration service.{"subscription_id":"<subscription-id>","resource_group":"<resource_group>","workspace_name":"<workspace_name>","tenant-id":"<tenant-id>","datastore_name":"<datastore_name>"}Add Model, Fetch Datasets And Model From Azure MLfrommmanager.mmanagerimportModelsecret_key='Secret-Key'url='URL'model_data={"project":"<project-id>",#Project ID or Usecase ID"transformerType":"model-type",#Options: Classification, Regression, Forcasting"target_column":"target-column-name",#Target Column}ml_options={"credPath":"config.json",#Path to Azure ML credential files."datasetinsertionType":"AzureML",#Option: AzureML, Manual"fetchOption":["Model"],#To fetch model, add ["Model", "Dataset"] to fetch both model and datasets."modelName":"model-name",#Fetch model file registered with model name."dataPath":"dataset-name",#Get datasets registered with dataset name.}Model(secret_key,url).post_model(model_data,ml_options)Add Model, Upload Datasets And Model Manually And Register To Azure MLfrommmanager.mmanagerimportModelsecret_key='Secret-Key'url='URL'path='assets'#path to csv filemodel_data={"project":"1",#Project ID or Usecase ID"transformerType":"Classification",#Options: Classification, Regression, Forcasting"datasetinsertionType":"Manual"#Options: AzureML, External DB, Manual"training_dataset":"/path/train.csv""test_dataset":"/path/test.csv""pred_dataset":"/path/pred.csv""actual_dataset":"/path/truth.csv""model_file_path":"/path/model.h5""target_column":"Class"}ml_options={"credPath":"config.json",#Path to Azure ML credential files."datasetinsertionType":"Manual",#Option: AzureML, Manual"registryOption":["Model"],#To register model, add ["Model", "Dataset"] to register both model and datasets."datasetUploadPath":"dataset-name",#To registere dataset on path.}Model(secret_key,url).post_model(model_data,ml_options)Update Modelfrommmanager.mmanagerimportModelsecret_key='Secret-Key'url='URL'model_id=Model_id#use model_id number to updatedata={"transformerType":"logistic","target_column":"id","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(secret_key,url).patch_model(data,model_id)Delete Modelfrommmanager.mmanagerimportModelsecret_key='Secret-Key'url='URL'model_id="Model_id"#use model_id number to deleteModel(secret_key,url).delete_model(model_id)Get Model Detailsfrommmanager.mmanagerimportModelsecret_key='Secret-Key'url='URL'model_id="Model_id"Model(secret_key,url).get_details(model_id)Get MetricsGet latest metrics recorded under ModelMetric TypeDevelopement MetricScoring Metricfrommmanager.mmanagerimportModelsecret_key='Secret-Key'url='URL'metric=Model(secret_key,url).get_latest_metrics(model_id="Model-Id",metric_type="Metric-Type")Generate Model Reportfrommmanager.mmanagerimportModelsecret_key='Secret-Key'url='URL'model_id="Model-Id"#use model_id numberModel(secret_key,url).generate_report(model_id)Get Model Reportfrommmanager.mmanagerimportModelsecret_key='Secret-Key'url='URL'model_id="Model-Id"#use model_id numberall_report=Model(secret_key,url).get_all_reports(model_id=model_id)