I am using the ML.net model to do sentence similarity regression under the Natural language processing scenario. While using the predict() to get the predicted similarity am getting an exception System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
I have consumed the code generated as per the code snippet generated but am getting the above exception. The code I have written is as below
var userLostItem = new MatchFind.ModelInput()
{
Desc1 = actual,
Desc2 = foundItem.FDesc,
};
var result = new MatchFind.ModelOutput();
try
{
result = MatchFind.Predict(userLostItem);
double targetValue = 0.2;
double predictedValue = result.Score;
if (predictedValue >= targetValue)
{
matchedItems.Add(foundItem);
}
}
catch (Exception ex)
{
Response.Write(ex);
}