0
$\begingroup$

How do I make Predict function accept a sequence of data inputs as a feature while training? I am unable to use this : trainingdata = { 5 -> {{1,4},{2,3}}, 6 -> {{2,4},{3,3}} , .... } as training data for Predict inbuilt function.

This is the code I tried.

trainingset = {4 -> {{1, 3}, {2, 2}}, 
5 -> {{2, 3}, {1, 4}}, 6 -> {{3, 3}, {1, 5}}, 
7 -> {{4, 3}, {2, 5}}};

p = Predict[trainingset, 
Method ->"LinearRegression"]

ERROR MSG : Predict:: Incompatible variable type (Numerical) and variable value ({{1,3},{2,2}}).

$\endgroup$
3
  • 3
    $\begingroup$ Can you show the entire code you have developed so far, including the call to Predict? $\endgroup$
    – MarcoB
    Commented Aug 29, 2023 at 17:33
  • 1
    $\begingroup$ p = NetTrain[NetChain[{4, ReshapeLayer[{2, 2}]}, "Input" -> "Real"], trainingset] effectively does the same as what I guess you are trying to do. $\endgroup$ Commented Aug 30, 2023 at 0:55
  • $\begingroup$ Thank you. This seems to work. Need to read more about these capabilities. $\endgroup$ Commented Aug 30, 2023 at 2:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.