{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/machinelearning/pulls/comments/219323467","pull_request_review_id":157473652,"id":219323467,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTMyMzQ2Nw==","diff_hunk":"@@ -0,0 +1,144 @@\n+﻿// Licensed to the .NET Foundation under one or more agreements.\n+// The .NET Foundation licenses this file to you under the MIT license.\n+// See the LICENSE file in the project root for more information.\n+\n+using Microsoft.ML.Runtime.Data;\n+\n+namespace Microsoft.ML.Runtime.Training\n+{\n+    /// <summary>\n+    /// A training context is an object instantiable by a user to do various tasks relating to a particular\n+    /// \"area\" of machine learning. A subclass would represent a particular task in machine learning. The idea\n+    /// is that a user can instantiate that particular area, and get trainers and evaluators.\n+    /// </summary>\n+    public abstract class TrainContextBase\n+    {\n+        protected readonly IHost Host;\n+        internal IHostEnvironment Environment => Host;\n+\n+        protected TrainContextBase(IHostEnvironment env, string registrationName)\n+        {\n+            Contracts.CheckValue(env, nameof(env));\n+            env.CheckNonEmpty(registrationName, nameof(registrationName));\n+            Host = env.Register(registrationName);\n+        }\n+\n+        /// <summary>\n+        /// Subclasses of <see cref=\"TrainContext\"/> will provide little \"extension method\" hookable objects\n+        /// (e.g., something like <see cref=\"BinaryClassificationContext.Trainers\"/>). User code will only\n+        /// interact with these objects by invoking the extension methods. The actual component code can work\n+        /// through <see cref=\"TrainContextComponentUtils\"/> to get more \"hidden\" information from this object,\n+        /// e.g., the environment.\n+        /// </summary>\n+        public abstract class ContextInstantiatorBase\n+        {\n+            internal TrainContextBase Owner { get; }\n+\n+            protected ContextInstantiatorBase(TrainContextBase ctx)\n+            {\n+                Owner = ctx;\n+            }\n+        }\n+    }\n+\n+    /// <summary>\n+    /// Utilities for component authors that want to be able to instantiate components using these context\n+    /// objects. These utilities are not hidden from non-component authoring users per see, but are at least\n+    /// registered somewhat less obvious so that they are not confused by the presence.\n+    /// </summary>\n+    /// <seealso cref=\"TrainContextBase\"/>\n+    public static class TrainContextComponentUtils\n+    {\n+        /// <summary>\n+        /// Gets the environment hidden within the instantiator's context.\n+        /// </summary>\n+        /// <param name=\"obj\">The extension method hook object for a context.</param>\n+        /// <returns>An environment that can be used when instantiating components.</returns>\n+        public static IHostEnvironment GetEnvironment(TrainContextBase.ContextInstantiatorBase obj)\n+        {\n+            Contracts.CheckValue(obj, nameof(obj));\n+            return obj.Owner.Environment;\n+        }\n+\n+        /// <summary>\n+        /// Gets the environment hidden within the context.\n+        /// </summary>\n+        /// <param name=\"ctx\">The context.</param>\n+        /// <returns>An environment that can be used when instantiating components.</returns>\n+        public static IHostEnvironment GetEnvironment(TrainContextBase ctx)","path":"src/Microsoft.ML.Data/Training/TrainContext.cs","position":68,"original_position":68,"commit_id":"76239c806c5cc0219e0dd03a9105b0af62db580a","original_commit_id":"76239c806c5cc0219e0dd03a9105b0af62db580a","user":{"login":"eerhardt","id":8291187,"node_id":"MDQ6VXNlcjgyOTExODc=","avatar_url":"https://avatars3.githubusercontent.com/u/8291187?v=4","gravatar_id":"","url":"https://api.github.com/users/eerhardt","html_url":"https://github.com/eerhardt","followers_url":"https://api.github.com/users/eerhardt/followers","following_url":"https://api.github.com/users/eerhardt/following{/other_user}","gists_url":"https://api.github.com/users/eerhardt/gists{/gist_id}","starred_url":"https://api.github.com/users/eerhardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eerhardt/subscriptions","organizations_url":"https://api.github.com/users/eerhardt/orgs","repos_url":"https://api.github.com/users/eerhardt/repos","events_url":"https://api.github.com/users/eerhardt/events{/privacy}","received_events_url":"https://api.github.com/users/eerhardt/received_events","type":"User","site_admin":false},"body":"I'm not sure I understand the reasoning for hiding the `Environment` on the Context class. I (as a user) need to pass one in on the public constructor. I know you have one. Why hide the property, but make this static method to get it instead?","created_at":"2018-09-20T21:27:50Z","updated_at":"2018-09-20T21:27:50Z","html_url":"https://github.com/dotnet/machinelearning/pull/967#discussion_r219323467","pull_request_url":"https://api.github.com/repos/dotnet/machinelearning/pulls/967","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/machinelearning/pulls/comments/219323467"},"html":{"href":"https://github.com/dotnet/machinelearning/pull/967#discussion_r219323467"},"pull_request":{"href":"https://api.github.com/repos/dotnet/machinelearning/pulls/967"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/machinelearning/pulls/967","id":217091835,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3MDkxODM1","html_url":"https://github.com/dotnet/machinelearning/pull/967","diff_url":"https://github.com/dotnet/machinelearning/pull/967.diff","patch_url":"https://github.com/dotnet/machinelearning/pull/967.patch","issue_url":"https://api.github.com/repos/dotnet/machinelearning/issues/967","number":967,"state":"open","locked":false,"title":"WIP: Binary train context with evaluation and SDCA","user":{"login":"TomFinley","id":8295757,"node_id":"MDQ6VXNlcjgyOTU3NTc=","avatar_url":"https://avatars1.githubusercontent.com/u/8295757?v=4","gravatar_id":"","url":"https://api.github.com/users/TomFinley","html_url":"https://github.com/TomFinley","followers_url":"https://api.github.com/users/TomFinley/followers","following_url":"https://api.github.com/users/TomFinley/following{/other_user}","gists_url":"https://api.github.com/users/TomFinley/gists{/gist_id}","starred_url":"https://api.github.com/users/TomFinley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomFinley/subscriptions","organizations_url":"https://api.github.com/users/TomFinley/orgs","repos_url":"https://api.github.com/users/TomFinley/repos","events_url":"https://api.github.com/users/TomFinley/events{/privacy}","received_events_url":"https://api.github.com/users/TomFinley/received_events","type":"User","site_admin":false},"body":"Fixes #949. In which I provide a working sketch of the context object, for evaluation (both dynamic and otherwise). If we think this is a good idea then we can add more capabilities to it. (Either in this PR or future ones.)","created_at":"2018-09-20T20:08:25Z","updated_at":"2018-09-20T21:27:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"96c39fd3193456e6f4173a491dbb87a8d6437fbf","assignee":null,"assignees":[],"requested_reviewers":[{"login":"KrzysztofCwalina","id":9724236,"node_id":"MDQ6VXNlcjk3MjQyMzY=","avatar_url":"https://avatars0.githubusercontent.com/u/9724236?v=4","gravatar_id":"","url":"https://api.github.com/users/KrzysztofCwalina","html_url":"https://github.com/KrzysztofCwalina","followers_url":"https://api.github.com/users/KrzysztofCwalina/followers","following_url":"https://api.github.com/users/KrzysztofCwalina/following{/other_user}","gists_url":"https://api.github.com/users/KrzysztofCwalina/gists{/gist_id}","starred_url":"https://api.github.com/users/KrzysztofCwalina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrzysztofCwalina/subscriptions","organizations_url":"https://api.github.com/users/KrzysztofCwalina/orgs","repos_url":"https://api.github.com/users/KrzysztofCwalina/repos","events_url":"https://api.github.com/users/KrzysztofCwalina/events{/privacy}","received_events_url":"https://api.github.com/users/KrzysztofCwalina/received_events","type":"User","site_admin":false},{"login":"Zruty0","id":41337831,"node_id":"MDQ6VXNlcjQxMzM3ODMx","avatar_url":"https://avatars1.githubusercontent.com/u/41337831?v=4","gravatar_id":"","url":"https://api.github.com/users/Zruty0","html_url":"https://github.com/Zruty0","followers_url":"https://api.github.com/users/Zruty0/followers","following_url":"https://api.github.com/users/Zruty0/following{/other_user}","gists_url":"https://api.github.com/users/Zruty0/gists{/gist_id}","starred_url":"https://api.github.com/users/Zruty0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zruty0/subscriptions","organizations_url":"https://api.github.com/users/Zruty0/orgs","repos_url":"https://api.github.com/users/Zruty0/repos","events_url":"https://api.github.com/users/Zruty0/events{/privacy}","received_events_url":"https://api.github.com/users/Zruty0/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":923215346,"node_id":"MDU6TGFiZWw5MjMyMTUzNDY=","url":"https://api.github.com/repos/dotnet/machinelearning/labels/api","name":"api","color":"f9d0c4","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/machinelearning/pulls/967/commits","review_comments_url":"https://api.github.com/repos/dotnet/machinelearning/pulls/967/comments","review_comment_url":"https://api.github.com/repos/dotnet/machinelearning/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/machinelearning/issues/967/comments","statuses_url":"https://api.github.com/repos/dotnet/machinelearning/statuses/76239c806c5cc0219e0dd03a9105b0af62db580a","head":{"label":"TomFinley:tfinley/TrainContext","ref":"tfinley/TrainContext","sha":"76239c806c5cc0219e0dd03a9105b0af62db580a","user":{"login":"TomFinley","id":8295757,"node_id":"MDQ6VXNlcjgyOTU3NTc=","avatar_url":"https://avatars1.githubusercontent.com/u/8295757?v=4","gravatar_id":"","url":"https://api.github.com/users/TomFinley","html_url":"https://github.com/TomFinley","followers_url":"https://api.github.com/users/TomFinley/followers","following_url":"https://api.github.com/users/TomFinley/following{/other_user}","gists_url":"https://api.github.com/users/TomFinley/gists{/gist_id}","starred_url":"https://api.github.com/users/TomFinley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomFinley/subscriptions","organizations_url":"https://api.github.com/users/TomFinley/orgs","repos_url":"https://api.github.com/users/TomFinley/repos","events_url":"https://api.github.com/users/TomFinley/events{/privacy}","received_events_url":"https://api.github.com/users/TomFinley/received_events","type":"User","site_admin":false},"repo":{"id":133558426,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM1NTg0MjY=","name":"machinelearning","full_name":"TomFinley/machinelearning","private":false,"owner":{"login":"TomFinley","id":8295757,"node_id":"MDQ6VXNlcjgyOTU3NTc=","avatar_url":"https://avatars1.githubusercontent.com/u/8295757?v=4","gravatar_id":"","url":"https://api.github.com/users/TomFinley","html_url":"https://github.com/TomFinley","followers_url":"https://api.github.com/users/TomFinley/followers","following_url":"https://api.github.com/users/TomFinley/following{/other_user}","gists_url":"https://api.github.com/users/TomFinley/gists{/gist_id}","starred_url":"https://api.github.com/users/TomFinley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomFinley/subscriptions","organizations_url":"https://api.github.com/users/TomFinley/orgs","repos_url":"https://api.github.com/users/TomFinley/repos","events_url":"https://api.github.com/users/TomFinley/events{/privacy}","received_events_url":"https://api.github.com/users/TomFinley/received_events","type":"User","site_admin":false},"html_url":"https://github.com/TomFinley/machinelearning","description":"ML.NET is an open source and cross-platform machine learning framework for .NET.","fork":true,"url":"https://api.github.com/repos/TomFinley/machinelearning","forks_url":"https://api.github.com/repos/TomFinley/machinelearning/forks","keys_url":"https://api.github.com/repos/TomFinley/machinelearning/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TomFinley/machinelearning/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TomFinley/machinelearning/teams","hooks_url":"https://api.github.com/repos/TomFinley/machinelearning/hooks","issue_events_url":"https://api.github.com/repos/TomFinley/machinelearning/issues/events{/number}","events_url":"https://api.github.com/repos/TomFinley/machinelearning/events","assignees_url":"https://api.github.com/repos/TomFinley/machinelearning/assignees{/user}","branches_url":"https://api.github.com/repos/TomFinley/machinelearning/branches{/branch}","tags_url":"https://api.github.com/repos/TomFinley/machinelearning/tags","blobs_url":"https://api.github.com/repos/TomFinley/machinelearning/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TomFinley/machinelearning/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TomFinley/machinelearning/git/refs{/sha}","trees_url":"https://api.github.com/repos/TomFinley/machinelearning/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TomFinley/machinelearning/statuses/{sha}","languages_url":"https://api.github.com/repos/TomFinley/machinelearning/languages","stargazers_url":"https://api.github.com/repos/TomFinley/machinelearning/stargazers","contributors_url":"https://api.github.com/repos/TomFinley/machinelearning/contributors","subscribers_url":"https://api.github.com/repos/TomFinley/machinelearning/subscribers","subscription_url":"https://api.github.com/repos/TomFinley/machinelearning/subscription","commits_url":"https://api.github.com/repos/TomFinley/machinelearning/commits{/sha}","git_commits_url":"https://api.github.com/repos/TomFinley/machinelearning/git/commits{/sha}","comments_url":"https://api.github.com/repos/TomFinley/machinelearning/comments{/number}","issue_comment_url":"https://api.github.com/repos/TomFinley/machinelearning/issues/comments{/number}","contents_url":"https://api.github.com/repos/TomFinley/machinelearning/contents/{+path}","compare_url":"https://api.github.com/repos/TomFinley/machinelearning/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TomFinley/machinelearning/merges","archive_url":"https://api.github.com/repos/TomFinley/machinelearning/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TomFinley/machinelearning/downloads","issues_url":"https://api.github.com/repos/TomFinley/machinelearning/issues{/number}","pulls_url":"https://api.github.com/repos/TomFinley/machinelearning/pulls{/number}","milestones_url":"https://api.github.com/repos/TomFinley/machinelearning/milestones{/number}","notifications_url":"https://api.github.com/repos/TomFinley/machinelearning/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TomFinley/machinelearning/labels{/name}","releases_url":"https://api.github.com/repos/TomFinley/machinelearning/releases{/id}","deployments_url":"https://api.github.com/repos/TomFinley/machinelearning/deployments","created_at":"2018-05-15T18:40:13Z","updated_at":"2018-09-20T20:40:44Z","pushed_at":"2018-09-20T20:42:35Z","git_url":"git://github.com/TomFinley/machinelearning.git","ssh_url":"git@github.com:TomFinley/machinelearning.git","clone_url":"https://github.com/TomFinley/machinelearning.git","svn_url":"https://github.com/TomFinley/machinelearning","homepage":"http://dot.net/ml","size":22776,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"044a6d3cf35a8076ecbbcca5cdb61b2f722f94e1","user":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":132021166,"node_id":"MDEwOlJlcG9zaXRvcnkxMzIwMjExNjY=","name":"machinelearning","full_name":"dotnet/machinelearning","private":false,"owner":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dotnet/machinelearning","description":"ML.NET is an open source and cross-platform machine learning framework for .NET.","fork":false,"url":"https://api.github.com/repos/dotnet/machinelearning","forks_url":"https://api.github.com/repos/dotnet/machinelearning/forks","keys_url":"https://api.github.com/repos/dotnet/machinelearning/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/machinelearning/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/machinelearning/teams","hooks_url":"https://api.github.com/repos/dotnet/machinelearning/hooks","issue_events_url":"https://api.github.com/repos/dotnet/machinelearning/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/machinelearning/events","assignees_url":"https://api.github.com/repos/dotnet/machinelearning/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/machinelearning/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/machinelearning/tags","blobs_url":"https://api.github.com/repos/dotnet/machinelearning/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/machinelearning/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/machinelearning/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/machinelearning/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/machinelearning/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/machinelearning/languages","stargazers_url":"https://api.github.com/repos/dotnet/machinelearning/stargazers","contributors_url":"https://api.github.com/repos/dotnet/machinelearning/contributors","subscribers_url":"https://api.github.com/repos/dotnet/machinelearning/subscribers","subscription_url":"https://api.github.com/repos/dotnet/machinelearning/subscription","commits_url":"https://api.github.com/repos/dotnet/machinelearning/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/machinelearning/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/machinelearning/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/machinelearning/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/machinelearning/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/machinelearning/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/machinelearning/merges","archive_url":"https://api.github.com/repos/dotnet/machinelearning/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/machinelearning/downloads","issues_url":"https://api.github.com/repos/dotnet/machinelearning/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/machinelearning/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/machinelearning/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/machinelearning/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/machinelearning/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/machinelearning/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/machinelearning/deployments","created_at":"2018-05-03T16:20:42Z","updated_at":"2018-09-20T20:27:05Z","pushed_at":"2018-09-20T21:22:46Z","git_url":"git://github.com/dotnet/machinelearning.git","ssh_url":"git@github.com:dotnet/machinelearning.git","clone_url":"https://github.com/dotnet/machinelearning.git","svn_url":"https://github.com/dotnet/machinelearning","homepage":"https://dot.net/ml","size":22744,"stargazers_count":3654,"watchers_count":3654,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":588,"mirror_url":null,"archived":false,"open_issues_count":313,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":588,"open_issues":313,"watchers":3654,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/machinelearning/pulls/967"},"html":{"href":"https://github.com/dotnet/machinelearning/pull/967"},"issue":{"href":"https://api.github.com/repos/dotnet/machinelearning/issues/967"},"comments":{"href":"https://api.github.com/repos/dotnet/machinelearning/issues/967/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/machinelearning/pulls/967/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/machinelearning/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/machinelearning/pulls/967/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/machinelearning/statuses/76239c806c5cc0219e0dd03a9105b0af62db580a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"eerhardt"}}