I am using svd algorithm and I am using coldstart form in suggestion system in my dataset(book crosing).
for leveraging sparsity with MathNet.Numeric befor using svD in my form ,I am using This code in rating Table , But my code doesnt read a data set.
here is my code
var arrayOfDoubles = DenseMatrix.OfArray(To2D<double>
(dt1_rating.AsEnumerable().Select(x => new[] {
Convert.ToDouble(x[0]) }).ToArray()));
//Select(x => new[] { Convert.ToDouble(x[0]),
Convert.ToDouble(x[1]) }).ToArray()));
var S = arrayOfDoubles.Svd();
DataTable dt = new DataTable();
dt.Clear();
dt.Columns.Add("USERID");
dt.Columns.Add("ISBn");
dt.Columns.Add("BOOKRATING");
double[,] U = S.VT.ToArray();
for (int outerIndex = 0; outerIndex < S.VT.RowCount; outerIndex++)
{
for (int innerIndex = 0; innerIndex < S.VT.ColumnCount; innerIndex++)
{
DataRow newRow = dt.NewRow();
newRow["USERID"] = U[outerIndex, innerIndex];
newRow["ISBN"] = U[outerIndex, innerIndex];
newRow["BOOKRATING"] = U[outerIndex, innerIndex];
dt.Rows.Add(newRow);
}
}
dt1_rating = dt;///////////////////تا این جا
This is my error
Object cannot be Cast fromDbNull to other types or System Invalid CastExceptions