Clean SamplesUtils - #3594
Conversation
| Console.WriteLine($"Mean Squared Error: {metrics.MeanSquaredError:F2}"); | ||
| Console.WriteLine($"Root Mean Squared Error: {metrics.RootMeanSquaredError:F2}"); | ||
| Console.WriteLine($"RSquared: {metrics.RSquared:F2}"); | ||
| } |
There was a problem hiding this comment.
for trainers, we should modify the .ttinclude template file, not the cs file directly. #Resolved
There was a problem hiding this comment.
*Advanced.cs are not API samples. They are legacy end-to-end pipelines saved for future use. #Resolved
| data.Add(new SampleSentimentData { Sentiment = true, SentimentText = "Best game I've ever played." }); | ||
| data.Add(new SampleSentimentData { Sentiment = false, SentimentText = "==RUDE== Dude, 2" }); | ||
| data.Add(new SampleSentimentData { Sentiment = true, SentimentText = "Until the next game, this is the best Xbox game!" }); | ||
| return data; |
There was a problem hiding this comment.
let's use initializer, instead of Add one-by-one, remove the function-call, and just move the list up in the Example().
var data = new List{
datapoint1,
datapoint2,
....
} #Resolved
| data.Add(new SampleVectorOfNumbersData | ||
| { | ||
| Features = new float[10] { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 } | ||
| }); |
There was a problem hiding this comment.
similar change. please create the data inline with initializers, similar to NgramExtraction.
In reply to: 278763353 [](ancestors = 278763353)
|
|
||
| // Get a small dataset as an IEnumerable and convert to IDataView. | ||
| var data = Microsoft.ML.SamplesUtils.DatasetUtils.GetSentimentData(); | ||
| var data = GetSentimentData(); |
There was a problem hiding this comment.
var [](start = 12, length = 3)
You have IEnumerable<SampleSentimentData> in the NGram sample. Let's adopt a consistent scheme, either var everywhere or the concrete type everywhere.
There was a problem hiding this comment.
I thought we had decided to not use tuples, at least in the API. Is it okay for samples? @shmoradims Refers to: docs/samples/Microsoft.ML.Samples/Dynamic/DataOperations/Cache.cs:42 in 70a3a18. [](commit_id = 70a3a18, deletion_comment = False) |
I think they are fine. It's a part of C# language and this is a C# sample. I remember one reason not to use tuple is that F# doesn't support it well. In reply to: 486880743 [](ancestors = 486880743) Refers to: docs/samples/Microsoft.ML.Samples/Dynamic/DataOperations/Cache.cs:42 in 70a3a18. [](commit_id = 70a3a18, deletion_comment = False) |
Codecov Report
@@ Coverage Diff @@
## master #3594 +/- ##
=========================================
Coverage ? 72.9%
=========================================
Files ? 807
Lines ? 145214
Branches ? 16237
=========================================
Hits ? 105867
Misses ? 34924
Partials ? 4423
|
it's ok here. but since it's just a util, it would be cleaner to make the function void, and print the values in the function instead of returning the stats and printing in the main example. The user can still see the produced output, from the proceeding comments. So this is just simpler and we don't have to worry if users know about tuples or not. In reply to: 487105281 [](ancestors = 487105281,486880743) Refers to: docs/samples/Microsoft.ML.Samples/Dynamic/DataOperations/Cache.cs:42 in 70a3a18. [](commit_id = 70a3a18, deletion_comment = False) |
55b723d to
936c406
Compare
This PR cleans SampleUtils a bit. Toward #3584.
Currently, we can't not remove SamplesUtils entirely because some samples are still using it.