1
$\begingroup$

I can use the function Predict[] with pre-defined dataset successfully.

A = {1, 2, 3, 4, 5, 6, 7, 8, 9} -> {1, 2, 3, 4, 5, 6, 7, 8, 9}^3;
p = Predict[A]

However, when the length of dataset is unknown. How can I to build the dataset in runtime?

e.g.

(* There are 125 items, the length is unknown until runtime *)
data = {123.5, 123,1, 123.2, 123.3, 123.6,......}  

(* "Argument {1,8,27,64,125,216,343,512,729} should be a rule or a list of rules" *)
p = predict[data] 

Please feel free to comments.

$\endgroup$
  • $\begingroup$ I'm not sure I understand. What do you want to provide to a Predict assuming you have data = {1.1, 2.1, 3.1} and assuming the length of data isn't known a priori. $\endgroup$ – Kuba Apr 11 '16 at 11:25
  • 1
    $\begingroup$ Predict[] is a build-in function. (reference.wolfram.com/language/ref/Predict.html) $\endgroup$ – madeinQuant Apr 11 '16 at 11:32
  • $\begingroup$ I know, my question was what do you want to put there as an argument. $\endgroup$ – Kuba Apr 11 '16 at 11:35
  • $\begingroup$ e.g. there are 125 items, A = {1,2,3,4,5,.....,125}->{123.5, 123,1, 123.2, 123.3, 123.6,......,160.123} , how to build the array with "->" rules. $\endgroup$ – madeinQuant Apr 11 '16 at 11:50
  • $\begingroup$ Like (Range@Length@# -> #) &@data? $\endgroup$ – Kuba Apr 11 '16 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.