Sample of using LoadFromEnumerable with a SchemaDefinition - #3696
Conversation
| @@ -0,0 +1,83 @@ | |||
| using System; | |||
There was a problem hiding this comment.
Please add headers #Resolved
There was a problem hiding this comment.
Do we need headers for samples? whatever we put here, will show up in the docs verbatim, so we didn't include the license header in any of the samples. .NET samples don't have headers either (example below). So I suggest not including headers for samples files.
https://docs.microsoft.com/en-us/dotnet/api/system.io.file?view=netframework-4.8
In reply to: 282706294 [](ancestors = 282706294)
There was a problem hiding this comment.
i forgot, i'll remove them. #Resolved
Codecov Report
@@ Coverage Diff @@
## master #3696 +/- ##
==========================================
+ Coverage 72.77% 72.78% +<.01%
==========================================
Files 808 808
Lines 145588 145589 +1
Branches 16250 16250
==========================================
+ Hits 105956 105968 +12
+ Misses 35207 35199 -8
+ Partials 4425 4422 -3
|
| }; | ||
|
|
||
| // The feature dimension retrievable at runtime. | ||
| int featureDimension = 3; |
There was a problem hiding this comment.
is this a misplaced comment ? .. featureDimension is not used until line 61 for setting , not retrieving .. #Resolved
There was a problem hiding this comment.
The sample is for cases when we don't know the size at compile time, so this is is set to a constant, but in real life would be the size of some array.
But good point, i don't have all that language there, and i don't think it is necessary; so I'll remove the comment :)
In reply to: 283514291 [](ancestors = 283514291)
|
|
||
| namespace Samples.Dynamic | ||
| { | ||
| public static class LoadFromEnumerable |
There was a problem hiding this comment.
LoadFromEnumerable [](start = 24, length = 18)
Add comment explaining that you are not only loading from enumerable but also setting vector metadata properties. Why whould this be useful IRL? #Resolved
| var vectorItemType = ((VectorDataViewType)definedSchema[0].ColumnType).ItemType; | ||
| definedSchema[0].ColumnType = new VectorDataViewType(vectorItemType, featureDimension); | ||
|
|
||
| // Read the data into an IDataView with the schema supplied in |
There was a problem hiding this comment.
| // Read the data into an IDataView with the schema supplied in | |
| // Read the data into an IDataView with the modified schema supplied in |
I have seen a few asks for how to bypass having to define the size of the vector in the data models.
Adding an example for it.