-
Notifications
You must be signed in to change notification settings - Fork 2k
Reformatting ModelOperations and DataOperations samples to width 85 #3923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
f880b7b
4f06b84
0c16632
3ce38a3
10f40fd
00acf2a
acdf665
842765f
fe9c188
2f91a6d
7a27578
cd05ce0
61de1fb
5d2e8af
063a651
958633b
01a5390
0eb6065
2db2bde
8c1989f
f39823a
90ed060
2a5e8c3
f9d91e6
5daecb8
c436498
49d7a09
d2315f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,8 @@ public class SaveLoadModelFile | |
| { | ||
| public static void Example() | ||
| { | ||
| // Create a new ML context, for ML.NET operations. It can be used for exception tracking and logging, | ||
| // as well as the source of randomness. | ||
| // Create a new ML context, for ML.NET operations. It can be used for | ||
| // exception tracking and logging, as well as the source of randomness. | ||
| var mlContext = new MLContext(); | ||
|
|
||
| // Generate sample data. | ||
|
|
@@ -25,7 +25,8 @@ public static void Example() | |
| var outputColumnName = nameof(Transformation.Key); | ||
|
|
||
| // Transform. | ||
| ITransformer model = mlContext.Transforms.Conversion.MapValueToKey(outputColumnName, inputColumnName).Fit(dataView); | ||
| ITransformer model = mlContext.Transforms.Conversion.MapValueToKey( | ||
| outputColumnName, inputColumnName).Fit(dataView); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For cases like this, I would rather we break per method call, than to break between a method and its parameter list. For example: // If you have chained method calls, line-break each method call
Enumerable.Range(0, numRows)
.Select(i => i.ToString())
.ToArray();That is much more readable than: object o = foo.methodCall(
methodCallArg1, methodCallArg2).OtherMethodCall(arg3) |
||
|
|
||
| // Save model. | ||
| mlContext.Model.Save(model, dataView.Schema, "model.zip"); | ||
|
|
@@ -34,11 +35,15 @@ public static void Example() | |
| model = mlContext.Model.Load("model.zip", out DataViewSchema schema); | ||
|
|
||
| // Create a prediction engine from the model for feeding new data. | ||
| var engine = mlContext.Model.CreatePredictionEngine<Data, Transformation>(model); | ||
| var engine = mlContext.Model.CreatePredictionEngine<Data, | ||
| Transformation>(model); | ||
|
|
||
| var transformation = engine.Predict(new Data() { Value = "abc" }); | ||
|
|
||
| // Print transformation to console. | ||
| Console.WriteLine("Value: {0}\t Key:{1}", transformation.Value, transformation.Key); | ||
| Console.WriteLine("Value: {0}\t Key:{1}", transformation.Value, | ||
| transformation.Key); | ||
|
|
||
| // Value: abc Key:1 | ||
|
|
||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ public static class Program | |
|
|
||
| internal static void RunAll() | ||
| { | ||
| // Samples counter. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the usefulness of this comment? If those words make a better name, it would be better to rename the variable with those words, than to add a comment like this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, I meant to delete that. That was for an earlier test. |
||
| int samples = 0; | ||
| foreach (var type in Assembly.GetExecutingAssembly().GetTypes()) | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eerhardt Is it ok to break generics like this or should all of it be in the same line as its corresponding class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC: @natke
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix it so that I split before the "<" in a later pull request. Thanks!