machinelearning-samples
machinelearning-samples copied to clipboard
Need example how to load using IDataView using IEnumerable
I need an sample how to load IDataView from an IEnumerable, all examples are using a text csv file, i need to load the IDataView from a context object or a database table. Please help providing an sample.
CollectionDataSource can take in an IEnumerable, here's an example of Collection Data Source in action.
public class ProductEntry
{
[KeyType(Contiguous = true, Count = 262111, Min = 0)]
public uint ProductID { get; set; }
[KeyType(Contiguous = true, Count = 262111, Min = 0)]
public uint ProductID_Copurchased { get; set; }
}
var dataMatrix = new List<OneClassMatrixElementZeroBasedForScore>();
dataMatrix.Add(new OneClassMatrixElementZeroBasedForScore() { ProductID = 0,
ProductID_Copurchased = 1,
Value = 1 });
var testdata = ComponentCreation.CreateDataView(ctx, dataMatrix);
Does this help?
Closing the issue as sample code was provided by Ankit. 👍