项目作者: borysrybak

项目描述 :
.NET Module for Azure Machine Learning Studio
高级语言: C#
项目地址: git://github.com/borysrybak/azure-machine-learning-studio.git
创建时间: 2018-05-09T20:26:50Z
项目社区:https://github.com/borysrybak/azure-machine-learning-studio

开源协议:MIT License

下载


.NET DLLs for Azure Machine Learning Studio management

Overview

Description

This repository contains a proof of concept project for Azure Machine Learning Studio management.

The solution includes .NET Standard 2.0 Class Libraries (DLLs),
which can be incorporated in many .NET applications and be used for scale and automate Azure ML Studio workspaces and experiments.

:construction: At the moment, the project is in the pre-release phase - be aware of possible errors and exceptions before using it! :construction:

Solution Base Overview

The idea of creating a tool to manage Azure Machine Learning Studio was born during the meeting with our partner Soneta/Enova365.

Our partner was looking for solutions that could help automate and scale experiments in Azure ML Studio portal.
After the initial analysis of the available tools, I discovered the only one
that I used later as a base for the current solution
(source: PowerShell Module for Azure Machine Learning Studio & Web Services) - this solution was developed for PowerShell users, and the C# code implementation (SDK) helped me as a base to create this project.

Table of Contents

Prerequisites

Azure Machine Learning Studio

This solution was created for the use of Azure Machine Learning Studio resources - Workspace, Experiment, Database, Modules, etc.
We need a proper account to be able to work by using this library.

We can create different types of workspaces, because our library should deal with any type of account.

Free Workspace

Visit the main website of Azure Machine Learning Studio and simply create a new account - https://studio.azureml.net/

You should notice this:

azurestudiofree

Azure Subscription

Alternatively, create an Azure Account with a subscription.

And create a workspace withing the portal:

azureportalresources
azureportalresourcescreate
azureportalresourcesprice
azureportalresourcespricing

Software

AzureML.Studio.dll and AzureML.Studio.Core.dll are class libraries written in .NET Standard 2.0 .

“The .NET Standard is a formal specification of .NET APIs that are intended to be available on all .NET implementations.
The motivation behind the .NET Standard is establishing greater uniformity in the .NET ecosystem.
ECMA 335 continues to establish uniformity for .NET implementation behavior,
but there is no similar spec for the .NET Base Class Libraries (BCL) for .NET library implementations.”

You can use these DLLs in particluar, however before using concider the following table of all versions of .NET Standard and the platforms supported (source: .NET Standard):

.NET Standard 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0
.NET Core 1.0 1.0 1.0 1.0 1.0 1.0 1.0 2.0
.NET Framework 4.5 4.5 4.5.1 4.6 4.6.1 4.6.1 4.6.1 4.6.1
Mono 4.6 4.6 4.6 4.6 4.6 4.6 4.6 5.4
Xamarin.iOS 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.14
Xamarin.Mac 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.8
Xamarin.Android 7.0 7.0 7.0 7.0 7.0 7.0 7.0 8.0
Universal Windows Platform 10.0 10.0 10.0 10.0 10.0 10.0.16299 10.0.16299 10.0.16299

Tools & Libraries

You may need such tools as code-editors, IDEs or notepads, and libraries through which you can create a .NET application.
In that case, I used Visual Studio with proper frameworks to run a Console Application as an example.

Usage

NuGet

Release

Requirements

(from source: https://github.com/hning86/azuremlps#configuration):

  • Workspace ID

    • This value can be found in Workspace Settings in ML Studio.

  • Workspace Authorization Token

    • This value can be found in Workspace Settings in ML Studio. Note you must be an Owner of the Workspace in order to have access to this token.

  • Location

    • This value can be found in the Workspace drop-down. It is the Azure region the Workspace is provisioned in. Currently supported values for this configuration are:
      • South Central US (use this value for all Free Workspaces)
      • Southeast Asia
      • Japan East
      • West Europe
      • West Central US

Configuration

  • Add reference or install as a NuGet package to your project.

  • Create an instance of StudioClient class and use it.
  1. using AzureML.Studio.Core.Models;
  2. namespace AzureML.Studio.ConsoleApplicationExample
  3. {
  4. class Program
  5. {
  6. static void Main(string[] args)
  7. {
  8. var studioClient = new StudioClient();
  9. var workspaceSettings = WorkspaceSettings();
  10. workspaceSettings.WorkspaceId = "XYZ";
  11. workspaceSettings.AuthorizationToken = "######";
  12. workspaceSettings.Location = "";
  13. var workspace = studioClient.GetWorkspace(workspaceSettings);
  14. ...
  15. ...
  16. }

Operations

  1. var workspace = studioClient.GetWorkspace(workspaceSettings);
  1. var workspace = studioClient.GetWorkspace("XYZ", "######", "");

GetWorkspaces

  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. var workspaces = studioClient.GetWorkspaces(workspacesSettings);

GetWorkspaceUsers

  1. var users = studioClient.GetWorkspaceUsers(workspaceSettings);
  1. var users = studioClient.GetWorkspaceUsers("XYZ", "######", "");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. var users = studioClient.GetWorkspaceUsers(workspace);

GetWorkspacesUsers

  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. var workspaceUsersdictionary = studioClient.GetWorkspacesUsers(workspacesSettings);
  1. IEnumerable<Workspace> workspaces;
  2. var workspaceUsersdictionary = studioClient.GetWorkspacesUsers(workspaces);

AddUserToWorkspace

  1. var workspaceUser = new WorkspaceUser(
  2. new WorkspaceUserInternal() {
  3. User = new UserDetailInternal() {
  4. Email = "email", Role = "role"}}));
  5. studioClient.AddUserToWorkspace(workspaceSettings, workspaceUser);
  1. studioClient.AddUserToWorkspace(workspaceSettings, "email", "role");
  1. studioClient.AddUserToWorkspace("XYZ", "######", "", workspaceUser);
  1. studioClient.AddUserToWorkspace("XYZ", "######", "", "email", "role");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.AddUserToWorkspace(workspace, workspaceUser);
  1. studioClient.AddUserToWorkspace(workspace, "email", "role");

AddUserToWorkspaces

  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. var workspaceUser = new WorkspaceUser(
  3. new WorkspaceUserInternal() {
  4. User = new UserDetailInternal() {
  5. Email = "email", Role = "role"}}));
  6. studioClient.AddUserToWorkspaces(workspacesSettings, workspaceUser);
  1. studioClient.AddUserToWorkspaces(workspacesSettings, "email", "role");
  1. IEnumerable<Workspace> workspaces;
  2. studioClient.AddUserToWorkspaces(workspaces, workspaceUser);
  1. studioClient.AddUserToWorkspaces(workspaces, "email", "role");

AddUsersToWorkspace

  1. IEnumerable<WorkspaceUser> workspaceUsers;
  2. studioClient.AddUsersToWorkspace(workspaceSettings, workspaceUsers);
  1. studioClient.AddUsersToWorkspace("XYZ", "######", "", workspaceUsers);
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.AddUsersToWorkspace(workspace, workspaceUsers);

AddUsersToWorkspaces

  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. IEnumerable<WorkspaceUser> workspaceUsers;
  3. studioClient.AddUsersToWorkspaces(workspacesSettings, workspaceUsers);
  1. IEnumerable<Workspace> workspaces;
  2. studioClient.AddUsersToWorkspaces(workspaces, workspaceUsers);

GetDatasetsFromWorkspace

  1. var datasets = studioClient.GetDatasetsFromWorkspace(workspaceSettings);
  1. var datasets = studioClient.GetDatasetsFromWorkspace("XYZ", "######", "");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. var datasets = studioClient.GetDatasetsFromWorkspace(workspace);

GetDatasetsFromWorkspaces

  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. var workspaceDatasetsDictionary = studioClient.GetDatasetsFromWorkspaces(workspacesSettings);
  1. IEnumerable<Workspace> workspaces;
  2. var workspaceDatasetsDictionary = studioClient.GetDatasetsFromWorkspaces(workspaces);

DeleteDatasetFromWorkspace

  1. studioClient.DeleteDatasetFromWorkspace(workspaceSettings, "datasetFamilyId");
  1. var dataset = new Dataset();
  2. dataset.FamilyId = "datasetFamilyId";
  3. studioClient.DeleteDatasetFromWorkspace(workspaceSettings, dataset);
  1. studioClient.DeleteDatasetFromWorkspace("XYZ", "######", "", dataset);
  1. studioClient.DeleteDatasetFromWorkspace("XYZ", "######", "", "datasetFamilyId");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.DeleteDatasetFromWorkspace(workspace, "datasetFamilyId")
  1. studioClient.DeleteDatasetFromWorkspace(workspace, dataset);

DeleteDatasetsFromWorkspace

  1. IEnumerable<Dataset> datasets;
  2. studioClient.DeleteDatasetsFromWorkspace(workspaceSettings, datasets);
  1. studioClient.DeleteDatasetsFromWorkspace("XYZ", "######", "", datasets);
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.DeleteDatasetsFromWorkspace(workspace, datasets);

DeleteAllDatasetsFromWorkspace

  1. studioClient.DeleteAllDatasetsFromWorkspace(workspaceSettings);
  1. studioClient.DeleteAllDatasetsFromWorkspace("XYZ", "######", "");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.DeleteAllDatasetsFromWorkspace(workspace);

DeleteAllDatasetsFromWorkspaces

  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. studioClient.DeleteAllDatasetsFromWorkspaces(workspacesSettings);
  1. IEnumerable<Workspace> workspaces;
  2. studioClient.DeleteAllDatasetsFromWorkspaces(workspaces);

DownloadDatasetFromWorkspace

  1. studioClient.DownloadDatasetFromWorkspace(workspaceSettings, "datasetId", "fileName");
  1. studioClient.DownloadDatasetFromWorkspace("XYZ", "######", "", "datasetId", "fileName");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.DownloadDatasetFromWorkspace(workspace, "datasetId", "fileName");
  1. var dataset = new Dataset();
  2. dataset.Id = "datasetId";
  3. studioClient.DownloadDatasetFromWorkspace(workspaceSettings, dataset, "fileName");
  1. studioClient.DownloadDatasetFromWorkspace("XYZ", "######", "", dataset, "fileName");
  1. studioClient.DownloadDatasetFromWorkspace(workspace, dataset, "fileName");

DownloadDatasetsFromWorkspace

  1. IEnumerable<Dataset> datasets;
  2. studioClient.DownloadDatasetsFromWorkspace(workspaceSettings, datasets);
  1. studioClient.DownloadDatasetsFromWorkspace("XYZ", "######", "", datasets);
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.DownloadDatasetsFromWorkspace(workspace, datasets);

DownloadAllDatasetsFromWorkspace

  1. studioClient.DownloadAllDatasetsFromWorkspace(workspaceSettings);
  1. studioClient.DownloadAllDatasetsFromWorkspace("XYZ", "######", "");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.DownloadAllDatasetsFromWorkspace(workspace);

DownloadAllDatasetsFromWorkspaces

  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. studioClient.DownloadAllDatasetsFromWorkspaces(workspacesSettings);
  1. IEnumerable<Workspace> workspaces;
  2. studioClient.DownloadAllDatasetsFromWorkspaces(workspaces);

UploadResourceToWorkspace

Enum: ResourceFileFormat.cs

  1. ResourceFileFormat resourceFileFormat;
  2. async studioClient.UploadResourceToWorkspace(workspaceSettings, resourceFileFormat, "filePath");
  1. async studioClient.UploadResourceToWorkspace("XYZ", "######", "", resourceFileFormat, "filePath");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. async studioClient.UploadResourceToWorkspace(workspace, resourceFileFormat, "filePath");

UploadResourcesToWorkspace

Enum: ResourceFileFormat.cs

  1. IDictionary<string, ResourceFileFormat> filePathResourceFileFormatDict;
  2. studioClient.UploadResourcesToWorkspace(workspaceSettings, filePathResourceFileFormatDict);
  1. studioClient.UploadResourcesToWorkspace("XYZ", "######", "", filePathResourceFileFormatDict);
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.UploadResourcesToWorkspace(workspace, filePathResourceFileFormatDict);

UploadResourceToWorkspaces

Enum: ResourceFileFormat.cs

  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. ResourceFileFormat resourceFileFormat;
  3. studioClient.UploadResourceToWorkspaces(workspacesSettings, resourceFileFormat, "filePath");
  1. IEnumerable<Workspace> workspaces;
  2. studioClient.UploadResourceToWorkspaces(workspaces, resourceFileFormat, "filePath");

UploadResourcesToWorkspaces

Enum: ResourceFileFormat.cs

  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. IDictionary<string, ResourceFileFormat> filePathResourceFileFormatDict;
  3. studioClient.UploadResourcesToWorkspaces(workspacesSettings, filePathResourceFileFormatDict);
  1. IEnumerable<Workspace> workspaces;
  2. studioClient.UploadResourcesToWorkspaces(workspaces, filePathResourceFileFormatDict);

GetExperiment

  1. var experiment = studioClient.GetExperiment(workspaceSettings, "experimentId");
  1. var experiment = studioClient.GetExperiment("XYZ", "######", "", "experimentId");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. var experiment = studioClient.GetExperiment(workspace, "experimentId");

GetExperiments

  1. IEnumerable<string> experimentsIds;
  2. var experiments = studioClient.GetExperiments(workspaceSettings, experimentsIds);
  1. var experiments = studioClient.GetExperiments("XYZ", "######", "", experimentsIds);
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. var experiments = studioClient.GetExperiments(workspace, experimentsIds);

GetAllExperiments

  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. var workspaceExperimentsDict = studioClient.GetAllExperiments(workspacesSettings);
  1. IEnumerable<Workspace> workspaces;
  2. var workspaceExperimentsDict = studioClient.GetAllExperiments(workspaces);
  1. var experiments = studioClient.GetAllExperiments(workspaceSettings);
  1. var experiments = studioClient.GetAllExperiments("XYZ", "######", "");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. var experiments = studioClient.GetAllExperiments(workspace);

RunExperiment

  1. studioClient.RunExperiment(workspaceSettings, "experimentId");
  1. studioClient.RunExperiment("XYZ", "######", "", "experimentId");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.RunExperiment(workspace, "experimentId");
  1. var experiment = new Experiment;
  2. experiment.ExperimentId = "experimentId";
  3. studioClient.RunExperiment(workspaceSettings, experiment);
  1. studioClient.RunExperiment("XYZ", "######", "", experiment);
  1. studioClient.RunExperiment(workspace, experiment);

RunExperiments

  1. IEnumerable<string> experimentsIds;
  2. studioClient.RunExperiments(workspaceSettings, experimentsIds);
  1. studioClient.RunExperiments("XYZ", "######", "", experimentsIds);
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.RunExperiments(workspace, experimentsIds);
  1. IEnumerable<Experiment> experiments;
  2. studioClient.RunExperiments(workspaceSettings, experiments);
  1. studioClient.RunExperiments("XYZ", "######", "", experiments);
  1. studioClient.RunExperiments(workspace, experiments);

RunAllExperiments

  1. studioClient.RunAllExperiments(workspaceSettings);
  1. studioClient.RunAllExperiments("XYZ", "######", "");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.RunAllExperiments(workspace);
  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. studioClient.RunAllExperiments(workspacesSettings);
  1. IEnumerable<Workspace> workspaces;
  2. studioClient.RunAllExperiments(workspaces);

SaveExperiment

  1. studioClient.SaveExperiment(workspaceSettings, "experimentId");
  1. studioClient.SaveExperiment("XYZ", "######", "", "experimentId");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.SaveExperiment(workspace, "experimentId");
  1. var experiment = new Experiment;
  2. experiment.ExperimentId = "experimentId";
  3. studioClient.SaveExperiment(workspaceSettings, experiment);
  1. studioClient.SaveExperiment("XYZ", "######", "", experiment);
  1. studioClient.SaveExperiment(workspace, experiment);

SaveExperiments

  1. IEnumerable<string> experimentsIds;
  2. studioClient.SaveExperiments(workspaceSettings, experimentsIds);
  1. studioClient.SaveExperiments("XYZ", "######", "", experimentsIds);
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.SaveExperiments(workspace, experimentsIds);
  1. IEnumerable<Experiment> experiments;
  2. studioClient.SaveExperiments(workspaceSettings, experiments);
  1. studioClient.SaveExperiments("XYZ", "######", "", experiments);
  1. studioClient.SaveExperiments(workspace, experiments);

SaveAllExperiments

  1. studioClient.SaveAllExperiments(workspaceSettings);
  1. studioClient.SaveAllExperiments("XYZ", "######", "");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.SaveAllExperiments(workspace);
  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. studioClient.SaveAllExperiments(workspacesSettings);
  1. IEnumerable<Workspace> workspaces;
  2. studioClient.SaveAllExperiments(workspaces);

SaveExperimentAs

  1. studioClient.SaveExperimentAs(workspaceSettings, "experimentId", "newName");
  1. studioClient.SaveExperimentAs("XYZ", "######", "", "experimentId", "newName");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.SaveExperimentAs(workspace, "experimentId", "newName");
  1. var experiment = new Experiment;
  2. experiment.ExperimentId = "experimentId";
  3. studioClient.SaveExperimentAs(workspaceSettings, experiment, "newName");
  1. studioClient.SaveExperimentAs("XYZ", "######", "", experiment, "newName");
  1. studioClient.SaveExperimentAs(workspace, experiment, "newName");

DeleteExperiment

  1. studioClient.DeleteExperiment(workspaceSettings, "experimentId");
  1. studioClient.DeleteExperiment("XYZ", "######", "", "experimentId");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.DeleteExperiment(workspace, "experimentId");
  1. var experiment = new Experiment;
  2. experiment.ExperimentId = "experimentId";
  3. studioClient.DeleteExperiment(workspaceSettings, experiment);
  1. studioClient.DeleteExperiment("XYZ", "######", "", experiment);
  1. studioClient.DeleteExperiment(workspace, experiment);

DeleteExperiments

  1. IEnumerable<string> experimentsIds;
  2. studioClient.DeleteExperiments(workspaceSettings, experimentsIds);
  1. studioClient.DeleteExperiments("XYZ", "######", "", experimentsIds);
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.DeleteExperiments(workspace, experimentsIds);
  1. IEnumerable<Experiment> experiments;
  2. studioClient.DeleteExperiments(workspaceSettings, experiments);
  1. studioClient.DeleteExperiments("XYZ", "######", "", experiments);
  1. studioClient.DeleteExperiments(workspace, experiments);

DeleteAllExperiments

  1. studioClient.DeleteAllExperiments(workspaceSettings);
  1. studioClient.DeleteAllExperiments("XYZ", "######", "");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.DeleteAllExperiments(workspace);
  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. studioClient.DeleteAllExperiments(workspacesSettings);
  1. IEnumerable<Workspace> workspaces;
  2. studioClient.DeleteAllExperiments(workspaces);

ExportExperiment

  1. studioClient.ExportExperiment(workspaceSettings, "experimentId");
  1. studioClient.ExportExperiment("XYZ", "######", "", "experimentId");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.ExportExperiment(workspace, "experimentId");
  1. var experiment = new Experiment;
  2. experiment.ExperimentId = "experimentId";
  3. studioClient.ExportExperiment(workspaceSettings, experiment);
  1. studioClient.ExportExperiment("XYZ", "######", "", experiment);
  1. studioClient.ExportExperiment(workspace, experiment);
  1. studioClient.ExportExperiment(workspaceSettings, "experimentId", "outputFilePath");
  1. studioClient.ExportExperiment("XYZ", "######", "", "experimentId", "outputFilePath");
  1. studioClient.ExportExperiment(workspace, "experimentId", "outputFilePath");
  1. studioClient.ExportExperiment(workspaceSettings, experiment, "outputFilePath");
  1. studioClient.ExportExperiment("XYZ", "######", "", experiment, "outputFilePath");
  1. studioClient.ExportExperiment(workspace, experiment, "outputFilePath");

ExportExperiments

  1. IEnumerable<string> experimentsIds;
  2. studioClient.ExportExperiments(workspaceSettings, experimentsIds);
  1. studioClient.ExportExperiments("XYZ", "######", "", experimentsIds);
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.ExportExperiments(workspace, experimentsIds);
  1. IEnumerable<Experiment> experiments;
  2. studioClient.ExportExperiments(workspaceSettings, experiments);
  1. studioClient.ExportExperiments("XYZ", "######", "", experiments);
  1. studioClient.ExportExperiments(workspace, experiments);

ExportAllExperiments

  1. studioClient.ExportAllExperiments(workspaceSettings);
  1. studioClient.ExportAllExperiments("XYZ", "######", "");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.ExportAllExperiments(workspace);

ImportExperiment

  1. studioClient.ImportExperiment(workspaceSettings, "inputFilePath");
  1. studioClient.ImportExperiment("XYZ", "######", "", "inputFilePath");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.ImportExperiment(workspace, "inputFilePath");
  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. studioClient.ImportExperiment(workspacesSettings, "inputFilePath");
  1. IEnumerable<Workspace> workspaces;
  2. studioClient.ImportExperiment(workspaces, "inputFilePath");
  1. studioClient.ImportExperiment(workspaceSettings, "inputFilePath", "newName");
  1. studioClient.ImportExperiment("XYZ", "######", "", "inputFilePath", "newName");
  1. studioClient.ImportExperiment(workspace, "inputFilePath", "newName");
  1. studioClient.ImportExperiment(workspacesSettings, "inputFilePath", "newName");
  1. studioClient.ImportExperiment(workspaces, "inputFilePath", "newName");

CopyExperiment

  1. studioClient.CopyExperiment(sourceWorkspaceSettings, "experimentId", destinationWorkspaceSettings);
  1. var experiment = new Experiment;
  2. experiment.ExperimentId = "experimentId";
  3. studioClient.CopyExperiment(sourceWorkspaceSettings, experiment, destinationWorkspaceSettings);

CopyExperiments

  1. IEnumerable<string> experimentsIds;
  2. studioClient.CopyExperiments(sourceWorkspaceSettings, experimentsIds, destinationWorkspaceSettings);
  1. IEnumerable<Experiment> experiments;
  2. studioClient.CopyExperiments(sourceWorkspaceSettings, experiments, destinationWorkspaceSettings);

CopyAllExperiments

  1. studioClient.CopyAllExperiments(sourceWorkspaceSettings, destinationWorkspaceSettings);

GetTrainedModel

  1. var userAsset = studioClient.GetTrainedModel(workspaceSettings, "userAssetId");
  1. var userAsset = studioClient.GetTrainedModel("XYZ", "######", "", "userAssetId");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. var userAsset = studioClient.GetTrainedModel(workspace, "userAssetId");

GetTrainedModels

  1. var userAssets = studioClient.GetTrainedModels(workspaceSettings);
  1. var userAssets = studioClient.GetTrainedModels("XYZ", "######", "");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. var userAssets = studioClient.GetTrainedModels(workspace);
  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. var workspaceUserAssetsDict = studioClient.GetTrainedModels(workspacesSettings);
  1. IEnumerable<Workspace> workspaces;
  2. var workspaceUserAssetsDict = studioClient.GetTrainedModels(workspaces);

GetTransform

  1. var userAsset = studioClient.GetTransform(workspaceSettings, "userAssetId");
  1. var userAsset = studioClient.GetTransform("XYZ", "######", "", "userAssetId");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. var userAsset = studioClient.GetTransform(workspace, "userAssetId");

GetTransforms

  1. var userAssets = studioClient.GetTransforms(workspaceSettings);
  1. var userAssets = studioClient.GetTransforms("XYZ", "######", "");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. var userAssets = studioClient.GetTransforms(workspace);
  1. IEnumerable<WorkspaceSettings> workspacesSettings;
  2. var workspaceUserAssetsDict = studioClient.GetTransforms(workspacesSettings);
  1. IEnumerable<Workspace> workspaces;
  2. var workspaceUserAssetsDict = studioClient.GetTransforms(workspaces);

ModifyNodeParameter

  1. studioClient.ModifyNodeParameter(workspaceSettings, "experimentId", "nodeNameComment", "nodeParameterName", "value", "saveAs");
  1. studioClient.ModifyNodeParameter("XYZ", "######", "", "experimentId", "nodeNameComment", "nodeParameterName", "value", "saveAs");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.ModifyNodeParameter(workspace, "experimentId", "nodeNameComment", "nodeParameterName", "value", "saveAs");

ModifyNodeEdge

  1. studioClient.ModifyNodeEdge(workspaceSettings, "experimentId", "sourceNodeComment", "destinationNodeComment", "saveAs");
  1. studioClient.ModifyNodeEdge("XYZ", "######", "", "experimentId", "sourceNodeComment", "destinationNodeComment", "saveAs");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.ModifyNodeEdge(workspace, "experimentId", "sourceNodeComment", "destinationNodeComment", "saveAs");

AddModule

  1. studioClient.AddModule(workspaceSettings, "experimentId", "nameOfNewModule", "saveAs");
  1. studioClient.AddModule("XYZ", "######", "", "experimentId", "nameOfNewModule", "saveAs");
  1. var workspace = new Workspace();
  2. workspace.WorkspaceId = "XYZ";
  3. workspace.AuthorizationToken.PrimaryToken = "######";
  4. workspace.Region = "";
  5. studioClient.AddModule(workspace, "experimentId", "nameOfNewModule", "saveAs");

Many lines of code are missing, however at this state you will be able to do many basic operations.

Testing

There is a Unit Test project included but it is empty and it will be finished in next iterration of development.
So far I have tested few important operations in Console Application.

Copying an Experiment from one Workspace to another, both are having same pricing tier and same region:

  • Copy Experiment: ‘Import Data - Experiment’
  • Source Workspace: ‘FakeWestEuropeCommandCenterS1’
  • Destination Workspace: ‘FakeWestEuropeCustomerS1’
  • Before copying experiment should be saved and has finished running status.
  1. static void CopyExperimentFromWorkspaceToWorkspaceSamePricingSameRegion(StudioClient studioClient)
  2. {
  3. var sourceWorkspace = new WorkspaceSettings()
  4. {
  5. WorkspaceId = "",
  6. AuthorizationToken = "",
  7. Location = "West Europe"
  8. };
  9. var destinationWorkspace = new WorkspaceSettings()
  10. {
  11. WorkspaceId = "",
  12. AuthorizationToken = "",
  13. Location = "West Europe"
  14. };
  15. //var experiments = studioClient.GetExperiments(sourceWorkspace);
  16. var experimentId = "";
  17. var experiment = studioClient.GetExperiment(sourceWorkspace, experimentId);
  18. studioClient.CopyExperiment(sourceWorkspace, experiment, destinationWorkspace);
  19. }

Copying an Experiment from one Workspace to another, different pricing tier but same region:

  • Copy Experiment: ‘Import Data - Experiment’
  • Source Workspace: ‘FakeWestEuropeCommandCenterS1’
  • Destination Workspace: ‘FakeWestEuropeCustomerDEVTEST’
  • Before copying experiment should be saved and has finished running status.
  1. static void CopyExperimentFromWorkspaceToWorkspaceDifferentPricingSameRegion(StudioClient studioClient)
  2. {
  3. var sourceWorkspace = new WorkspaceSettings()
  4. {
  5. WorkspaceId = "",
  6. AuthorizationToken = "",
  7. Location = "West Europe"
  8. };
  9. var destinationWorkspace = new WorkspaceSettings()
  10. {
  11. WorkspaceId = "",
  12. AuthorizationToken = "",
  13. Location = "West Europe"
  14. };
  15. //var experiments = studioClient.GetExperiments(sourceWorkspace);
  16. var experimentId = "";
  17. var experiment = studioClient.GetExperiment(sourceWorkspace, experimentId);
  18. studioClient.CopyExperiment(sourceWorkspace, experiment, destinationWorkspace);
  19. }

Copying an Experiment from one Workspace to another, both are having same pricing tier but different region:

  • Copy Experiment: ‘Import Data - Experiment’
  • Source Workspace: ‘FakeWestEuropeCommandCenterS1’
  • Destination Workspace: ‘FakeSouthCentralUSCustomerS1’
  • Before copying experiment should be saved and has finished running status.
  1. static void CopyExperimentFromWorkspaceToWorkspaceSamePricingDifferentRegion(StudioClient studioClient)
  2. {
  3. var sourceWorkspace = new WorkspaceSettings()
  4. {
  5. WorkspaceId = "",
  6. AuthorizationToken = "",
  7. Location = "West Europe"
  8. };
  9. var destinationWorkspace = new WorkspaceSettings()
  10. {
  11. WorkspaceId = "",
  12. AuthorizationToken = "",
  13. Location = "West Europe"
  14. };
  15. //var experiments = studioClient.GetExperiments(sourceWorkspace);
  16. var experimentId = "";
  17. var experiment = studioClient.GetExperiment(sourceWorkspace, experimentId);
  18. studioClient.ExportExperiment(sourceWorkspace, experiment);
  19. var inputFilePath = @"C:\...\experimentFileName";
  20. studioClient.ImportExperiment(destinationWorkspace, inputFilePath, "Copied from other region");
  21. }

Copying an Experiment from one Workspace to another, different pricing tier and different region:

  • Copy Experiment: ‘Import Data - Experiment’
  • Source Workspace: ‘FakeWestEuropeCommandCenterS1’
  • Destination Workspace: ‘FakeSouthCentralUSDEVTEST’
  • Before copying experiment should be saved and has finished running status.
  1. static void CopyExperimentFromWorkspaceToWorkspaceDifferentPricingDifferentRegion(StudioClient studioClient)
  2. {
  3. var sourceWorkspace = new WorkspaceSettings()
  4. {
  5. WorkspaceId = "",
  6. AuthorizationToken = "",
  7. Location = "West Europe"
  8. };
  9. var destinationWorkspace = new WorkspaceSettings()
  10. {
  11. WorkspaceId = "",
  12. AuthorizationToken = "",
  13. Location = "West Europe"
  14. };
  15. //var experiments = studioClient.GetExperiments(sourceWorkspace);
  16. var experimentId = "";
  17. var experiment = studioClient.GetExperiment(sourceWorkspace, experimentId);
  18. studioClient.ExportExperiment(sourceWorkspace, experiment);
  19. var inputFilePath = @"C:\...\experimentFileName";
  20. studioClient.ImportExperiment(destinationWorkspace, inputFilePath, "Copied from other region");
  21. }

That’s what it looked like from the portal’s view:






Modify an experiment’s node parameter value and overwriting the experiment:

  • Modify Experiment: ‘Import Data - Experiment’
  • Modified Node Name: ‘Import Data’ //Found by comment “Import Data Comment”
  • Modified Parameter Name: ‘Database Query’
  1. static void ModifyExperimentNodeAndOverwrite(StudioClient studioClient)
  2. {
  3. var workspace = new WorkspaceSettings()
  4. {
  5. WorkspaceId = "",
  6. AuthorizationToken = "",
  7. Location = "West Europe"
  8. };
  9. //var experiments = studioClient.GetExperiments(sourceWorkspace);
  10. var experimentId = "";
  11. var experiment = studioClient.GetExperiment(workspace, experimentId);
  12. studioClient.ModifyNodeParameter(workspace, experimentId, "Import Data Comment", "Database Query", "SELECT Name, ProductNumber, CAST(Weight AS float) Weight\r\nFROM SalesLT.Product");
  13. }

Modify an experiment’s node parameter value and saving as a new experiment:

  • Modify Experiment: ‘Import Data - Experiment’
  • Modified Node Name: ‘Import Data’ //Found by comment “Import Data Comment”
  • Modified Parameter Name: ‘Database Query’
  1. static void ModifyExperimentNodeAndSaveAsAnotherExperiment(StudioClient studioClient)
  2. {
  3. var workspace = new WorkspaceSettings()
  4. {
  5. WorkspaceId = "",
  6. AuthorizationToken = "",
  7. Location = "West Europe"
  8. };
  9. //var experiments = studioClient.GetExperiments(sourceWorkspace);
  10. var experimentId = "";
  11. var experiment = studioClient.GetExperiment(workspace, experimentId);
  12. studioClient.ModifyNodeParameter(workspace, experimentId, "Import Data Comment", "Database Query", "SELECT Name, Color, CAST(Weight AS float) Weight\r\nFROM SalesLT.Product", "Import Data - Experiment 2");
  13. }

From the portal’s view:




Modify the connection within the modules (nodes) and overwriting the experiment:

  • Modify Experiment: *’Connect Modules - Experiment’
  1. static void ModifyConnectionWithinTheModulesAndOverwrite(StudioClient studioClient)
  2. {
  3. var workspace = new WorkspaceSettings()
  4. {
  5. WorkspaceId = "",
  6. AuthorizationToken = "",
  7. Location = ""
  8. };
  9. //var experiments = studioClient.GetExperiments(sourceWorkspace);
  10. var experimentId = "";
  11. var experiment = studioClient.GetExperiment(workspace, experimentId);
  12. studioClient.ModifyNodeEdge(workspace, experimentId, "CSV", "Dataset");
  13. }

Modify the connection within the modules (nodes) and saving as a new experiment:

  • Modify Experiment: *’Connect Modules - Experiment’
  1. static void ModifyConnectionWithinTheModulesAndSaveAsAnotherExperiment(StudioClient studioClient)
  2. {
  3. var workspace = new WorkspaceSettings()
  4. {
  5. WorkspaceId = "",
  6. AuthorizationToken = "",
  7. Location = ""
  8. };
  9. //var experiments = studioClient.GetExperiments(sourceWorkspace);
  10. var experimentId = "";
  11. var experiment = studioClient.GetExperiment(workspace, experimentId);
  12. studioClient.ModifyNodeEdge(workspace, experimentId, "CSV", "Dataset", "Connect Modules - Experiment 2");
  13. }

Aaand from the portal’s view:





Adding a new module to the experiment and overwriting it:

  • Modify Experiment: ‘Add Module - Experiment’
  1. static void AddModuleToTheExperimentAndOverwrite(StudioClient studioClient)
  2. {
  3. var workspace = new WorkspaceSettings()
  4. {
  5. WorkspaceId = "",
  6. AuthorizationToken = "",
  7. Location = ""
  8. };
  9. //var experiments = studioClient.GetExperiments(sourceWorkspace);
  10. var experimentId = "";
  11. var experiment = studioClient.GetExperiment(workspace, experimentId);
  12. var nameOfNewModule = "";
  13. //nameOfNewModule hard-coded
  14. //TODO: make a dictionary of <Module Names, Module IDs>
  15. //EXAMPLES:
  16. //Convert to TSV: 506153734175476c4f62416c57734963.1cdbcda42ece49088b87e6b636258d3d.v1-default-1644
  17. //Convert to Dataset: 506153734175476c4f62416c57734963.72bf58e0fc874bb19704f1805003b975.v1-default-1642
  18. studioClient.AddModule(workspace, experimentId, nameOfNewModule);
  19. }

Adding a new module to the experiment and saving as a new one:

  • Modify Experiment: ‘Add Module - Experiment’
  1. static void AddModuleToTheExperimentAndSaveAsAnotherExperiment(StudioClient studioClient)
  2. {
  3. var workspace = new WorkspaceSettings()
  4. {
  5. WorkspaceId = "",
  6. AuthorizationToken = "",
  7. Location = ""
  8. };
  9. //var experiments = studioClient.GetExperiments(sourceWorkspace);
  10. var experimentId = "";
  11. var experiment = studioClient.GetExperiment(workspace, experimentId);
  12. var nameOfNewModule = "";
  13. //nameOfNewModule hard-coded
  14. //TODO: make a dictionary of <Module Names, Module IDs>
  15. //EXAMPLES:
  16. //Convert to TSV: 506153734175476c4f62416c57734963.1cdbcda42ece49088b87e6b636258d3d.v1-default-1644
  17. //Convert to Dataset: 506153734175476c4f62416c57734963.72bf58e0fc874bb19704f1805003b975.v1-default-1642
  18. studioClient.AddModule(workspace, experimentId, nameOfNewModule, "Connect Modules - Experiment 2");
  19. }

Source code of the website and portal’s view:


Learnings

There are many thoughts that I have had during coding this solution.
Most of all it was hard to be consistent regarding naming
methods, classes, or even describing summaries of each instance.
I tried to be sure that the code that I have been creating would not be a spaghetti one.
The solution is still in development, and continuous support is needed!
For sure refactoring is a must in many aspects and few principles should be implemented.
Moreover, few methods are still a mystery for me,
and I left them behind in the SDK (ManagementService.cs) - you need to find them!

What is more, I encountered several errors of the portal itself. These bugs are hidden somewhere in those copy/saving operations.

As I wrote at the begging - it is a pre-release version that contains many errors and not-handle exceptions
(implementation of these is on my TODO list).
Be aware!!!

Feel free to contribute, fork, modify, cooperate.
I hope this library will be helpful.

Credits

  • Borys Rybak - Software Development Engineer, Microsoft:
    • AzureMLSDK (source: azuremlps by Hai Ning) small refactor into AzureML.Studio.Core
    • Entire solution of AzureMachineLearningStudio
      • AzureML.Studio
      • AzureML.Studio.ConsoleApplicationExample
      • AzureML.Studio.Core
      • [In Progress] AzureML.Studio.Test

Helpful Materials