VectorType attribute with dynamic dimension
See original GitHub issueThe VectorType
attribute can be added to an array-valued field when the length of the array is known at compile time, e.g.,
public class Data
{
[ColumnName("Features")]
[VectorType(2)]
public float[] Features;
[ColumnName("Label")]
public bool Label;
}
However, what if the length of the array is only known at run time?
For example, given IEnumerable<Data> data
where the length of the Features
array is given by int numFeatures
, I need to be able to pass numFeatures
to CollectionDataSource.Create(data)
somehow, and remove the static 2
argument to the VectorType
attribute on the Features
field.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:20 (5 by maintainers)
Top Results From Across the Web
VectorType attribute with dynamic dimension ML.NET
I am working on training and evaluation in ML.NET. The data comes from a .csv file. According to the requirements, there may be...
Read more >VectorTypeAttribute Constructor (Microsoft.ML.Data)
Parameters. Dimensions of array. All values should be non-negative. A zero value indicates that the vector type is considered to have unknown length...
Read more >Quick reference guide
RowsAtCompileTime and ColsAtCompileTime are the number of rows and columns of the matrix as known at compile-time or Dynamic . Options can be...
Read more >How to Initialize Vector in C++ [6 Different Ways]
Syntax. The syntax to declare a vector in C++ is: vector <type> vector_name(size). Description of the syntax. Keyword “ ...
Read more >Matrix< Scalar_, Rows_, Cols_, Options_, MaxRows_, ...
Dynamic -size means that the numbers of rows or columns are not necessarily known at compile-time. In this case they are runtime variables,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Anaschouihdi
Create a schema definition and pass it as the 2nd parameter in the LoadFromEnumerable method:
One thing I forgot to mention is that you’ll also need to pass the same schema definition as an additional parameter
inputSchemaDefinition
in the prediction engine: