ml.net LoadFromEnumerable always give System.ArgumentOutOfRangeException

I’m getting the following exception:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>System.ArgumentOutOfRangeException: 'Could not determine an IDataView type and registered custom types for member ValueType (Parameter 'rawType')'
</code>
<code>System.ArgumentOutOfRangeException: 'Could not determine an IDataView type and registered custom types for member ValueType (Parameter 'rawType')' </code>
System.ArgumentOutOfRangeException: 'Could not determine an IDataView type and registered custom types for member ValueType (Parameter 'rawType')'

For those 2 cases:

Case 1 : (could be normal to me to get the exception here):

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>MLContext mlContext = new MLContext();
var dataViewDateTimeValues = mlContext.Data.LoadFromEnumerable(dateTimeValues.Data.Values);
</code>
<code>MLContext mlContext = new MLContext(); var dataViewDateTimeValues = mlContext.Data.LoadFromEnumerable(dateTimeValues.Data.Values); </code>
MLContext mlContext = new MLContext();
var dataViewDateTimeValues = mlContext.Data.LoadFromEnumerable(dateTimeValues.Data.Values);

Case 2 : exception either here? Why and how to solve it? (does not like ‘ValueType’ where is not in the schema here:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>MLContext mlContext = new MLContext();
var dataViewDateTimeValues = mlContext.Data.LoadFromEnumerable(dateTimeValues.Data.Values);
var builder = new DataViewSchema.Builder();
builder.AddColumn("DateTimeOffset", Microsoft.ML.Data.DateTimeOffsetDataViewType.Instance);
builder.AddColumn("Value", Microsoft.ML.Data.NumberDataViewType.Single);
DataViewSchema schema = builder.ToSchema();
</code>
<code>MLContext mlContext = new MLContext(); var dataViewDateTimeValues = mlContext.Data.LoadFromEnumerable(dateTimeValues.Data.Values); var builder = new DataViewSchema.Builder(); builder.AddColumn("DateTimeOffset", Microsoft.ML.Data.DateTimeOffsetDataViewType.Instance); builder.AddColumn("Value", Microsoft.ML.Data.NumberDataViewType.Single); DataViewSchema schema = builder.ToSchema(); </code>
MLContext mlContext = new MLContext();
var dataViewDateTimeValues = mlContext.Data.LoadFromEnumerable(dateTimeValues.Data.Values);
var builder = new DataViewSchema.Builder();
builder.AddColumn("DateTimeOffset", Microsoft.ML.Data.DateTimeOffsetDataViewType.Instance);
builder.AddColumn("Value", Microsoft.ML.Data.NumberDataViewType.Single);
DataViewSchema schema = builder.ToSchema();

For my class:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.ML.Data;
using System.Reflection.Metadata.Ecma335;
namespace CommanDER.Forecast
{
public class DateTimeValue : ObservableObject
{
public DateTimeValue()
{
DateTimeOffset = default;
Value = 0;
}
public DateTimeValue(DateTimeOffset dateTime, float value)
{
DateTimeOffset = dateTime;
Value = value;
}
public DateTimeValue(DateTimeOffset dateTime, double value)
{
DateTimeOffset = dateTime;
ValueDouble = value;
}
public const string DateTimeValueFormat = "yyyy-MM-dd HH:mm";
[Display(AutoGenerateField = false)]
[Browsable(false)]
[LoadColumn(0)] // EO: For ML.net, for file usage in CSV or TSV (tab separarted value)
public DateTimeOffset DateTimeOffset { get; set; }
[LoadColumn(1)] // EO: for file usage in CSV ot TSV (tab separarted value) (used also in ml.net ???)
public float Value { get; set; } // Float seems to be required by ml.net
public double ValueDouble { get => Value; set => Value = (float)value; }
private double[]? _mlPrediction;
[VectorType(7)]
public double[]? MlPrediction { get => _mlPrediction; set => SetProperty(ref _mlPrediction, value); } // = new double[TotalGuessOfCount];
public string MlPredictionDisplay
{
get => MlPrediction is null ? "{null}" : string.Join(", ", MlPrediction);
}
private ValueTypeEnum _valueType = ValueTypeEnum.Raw;
[Browsable(false)]
public ValueTypeEnum ValueType { get => _valueType; set => SetProperty(ref _valueType, value); }
private DateTimeOffset _dateTimeValueCopied = default;
[Browsable(false)]
public DateTimeOffset DateTimeValueCopied { get => _dateTimeValueCopied; set => SetProperty(ref _dateTimeValueCopied, value); } // Usually not used otherwise should be a multiple of 7 at same time in order to get same day of week.
public override string ToString()
{
return $"Date: {DateTimeOffset.ToString(DateTimeValueFormat)}, Value: {Value}";
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CommanDER.Forecast
{
public enum ValueTypeEnum
{
Raw = 0,
Interpolated = 1,
CopiedFromAnotherDateTime = 2,
OutOfRange = 3,
}
}
</code>
<code>using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using CommunityToolkit.Mvvm.ComponentModel; using Microsoft.ML.Data; using System.Reflection.Metadata.Ecma335; namespace CommanDER.Forecast { public class DateTimeValue : ObservableObject { public DateTimeValue() { DateTimeOffset = default; Value = 0; } public DateTimeValue(DateTimeOffset dateTime, float value) { DateTimeOffset = dateTime; Value = value; } public DateTimeValue(DateTimeOffset dateTime, double value) { DateTimeOffset = dateTime; ValueDouble = value; } public const string DateTimeValueFormat = "yyyy-MM-dd HH:mm"; [Display(AutoGenerateField = false)] [Browsable(false)] [LoadColumn(0)] // EO: For ML.net, for file usage in CSV or TSV (tab separarted value) public DateTimeOffset DateTimeOffset { get; set; } [LoadColumn(1)] // EO: for file usage in CSV ot TSV (tab separarted value) (used also in ml.net ???) public float Value { get; set; } // Float seems to be required by ml.net public double ValueDouble { get => Value; set => Value = (float)value; } private double[]? _mlPrediction; [VectorType(7)] public double[]? MlPrediction { get => _mlPrediction; set => SetProperty(ref _mlPrediction, value); } // = new double[TotalGuessOfCount]; public string MlPredictionDisplay { get => MlPrediction is null ? "{null}" : string.Join(", ", MlPrediction); } private ValueTypeEnum _valueType = ValueTypeEnum.Raw; [Browsable(false)] public ValueTypeEnum ValueType { get => _valueType; set => SetProperty(ref _valueType, value); } private DateTimeOffset _dateTimeValueCopied = default; [Browsable(false)] public DateTimeOffset DateTimeValueCopied { get => _dateTimeValueCopied; set => SetProperty(ref _dateTimeValueCopied, value); } // Usually not used otherwise should be a multiple of 7 at same time in order to get same day of week. public override string ToString() { return $"Date: {DateTimeOffset.ToString(DateTimeValueFormat)}, Value: {Value}"; } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CommanDER.Forecast { public enum ValueTypeEnum { Raw = 0, Interpolated = 1, CopiedFromAnotherDateTime = 2, OutOfRange = 3, } } </code>
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.ML.Data;
using System.Reflection.Metadata.Ecma335;

namespace CommanDER.Forecast
{
    public class DateTimeValue : ObservableObject
    {
        public DateTimeValue()
        {
            DateTimeOffset = default;
            Value = 0;
        }

        public DateTimeValue(DateTimeOffset dateTime, float value)
        {
            DateTimeOffset = dateTime;
            Value = value;
        }

        public DateTimeValue(DateTimeOffset dateTime, double value)
        {
            DateTimeOffset = dateTime;
            ValueDouble = value;
        }

        public const string DateTimeValueFormat = "yyyy-MM-dd HH:mm";

        [Display(AutoGenerateField = false)]
        [Browsable(false)]
        [LoadColumn(0)] // EO: For ML.net, for file usage in CSV or TSV (tab separarted value)
        public DateTimeOffset DateTimeOffset { get; set; }

        [LoadColumn(1)] // EO: for file usage in CSV ot TSV (tab separarted value) (used also in ml.net ???)
        public float Value { get; set; }  // Float seems to be required by ml.net

        public double ValueDouble { get => Value; set => Value = (float)value; }

        private double[]? _mlPrediction;

        [VectorType(7)]
        public double[]? MlPrediction { get => _mlPrediction; set => SetProperty(ref _mlPrediction, value); } //  = new double[TotalGuessOfCount];

        public string MlPredictionDisplay
        {
            get => MlPrediction is null ? "{null}" : string.Join(", ", MlPrediction);
        }

        private ValueTypeEnum _valueType = ValueTypeEnum.Raw;

        [Browsable(false)]
        public ValueTypeEnum ValueType { get => _valueType; set => SetProperty(ref _valueType, value); }


        private DateTimeOffset _dateTimeValueCopied = default;

        [Browsable(false)]
        public DateTimeOffset DateTimeValueCopied { get => _dateTimeValueCopied; set => SetProperty(ref _dateTimeValueCopied, value); } // Usually not used otherwise should be a multiple of 7 at same time in order to get same day of week.


        public override string ToString()
        {
            return $"Date: {DateTimeOffset.ToString(DateTimeValueFormat)}, Value: {Value}";
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CommanDER.Forecast
{
    public enum ValueTypeEnum

    {
        Raw = 0,
        Interpolated = 1,
        CopiedFromAnotherDateTime = 2, 
        OutOfRange = 3,
    }
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật