2
$\begingroup$

I am attempting to use Predict[] to fill in the missing data in the dataset below;

 training = {{1.3, 1, 4, 5, 2, 6, 87, 5, 3, 4, 6, 7, 4, 2, 4, 7, 7, 
"P"} -> 1, {1.8, 3, 4, 5, 6, 7, 8, 5, 2, 2, 5, 7, 8, 2, 2, 0, 1, 
"Q"} -> 2.5}


p = Predict[training, Method -> "NearestNeighbors"]

Heres a test set

test = {1.8, Missing[], 2, 4, 5, 6, 7, 8, 3, 4, 5, Missing[], 4, 2, 5,6, Missing[], "P"}

When try to use the function p for the test set;

p[test]

only the first value is returned; 1

How can i use Predict[] to find all the missing data values within the test set?

$\endgroup$

1 Answer 1

2
$\begingroup$

There are a couple of problems.

There is an extra level of nesting in regressionInput so Flatten it first.

Predict[regressionInput // Flatten, Method -> "LinearRegression"]

That reveals the second problem

Predict::mlincfttp: Incompatible variable type (Numerical) and variable value ().

The input is a mix of numeric values and an RGBColor. Predict cannot handle mixed data types as inputs. You can try Predict on the numerics and the colors independently, but of course that will not work if they are correlated in some way.

$\endgroup$
1
  • $\begingroup$ Thank you Rohit, your reply does make sense. I've updated the question so that its a more suitable problem $\endgroup$
    – isaac5122
    Commented Mar 2, 2020 at 8:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.