Hello everyone, I am building a project about product recomendation.
What I am trying to do is to Load data from a database (witch I checked and is connected fine) and then use the Field Aware Factorization algorithm to make some predictions.My problem is that when I am trying pipeline.Fit(trainingDataView) I am getting
this error: System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.
Inner Exception IndexOutOfRangeException: Label
//Here is my class :
public class WineRating
{
public bool Label;
public float customer_id { get; set; }
public float product_id { get; set; }
}
public class WineRatingPrediction
{
public bool PredictedLabel;
public float Score;
}
//And here is the part of the main program that gives me the error.
public static ITransformer BuildAndTrainModel(MLContext mlContext, IDataView trainingDataView)
{
var pipeline = mlContext.Transforms.Categorical.OneHotEncoding(outputColumnName: "customer_idEncoded", inputColumnName: "customer_id"))
.Append(mlContext.Transforms.Categorical.OneHotEncoding(outputColumnName: "product_idEncoded", inputColumnName: "product_id"))
.Append(mlContext.Transforms.Concatenate("Features", "customer_idEncoded", "product_idEncoded"))
.Append(mlContext.BinaryClassification.Trainers.FieldAwareFactorizationMachine(
new
string[] {
"Features"
}));
var model = pipeline.Fit(trainingDataView); //HERE IS THE ERROR
return model;
}
Please help?