We had a grocery web product that allows users to make predictions about the future value (or demand) of goods, historical data contains about 100 thousand examples, each example has about 5 parameters;
Consider a data class called prediciton:
prediction {
id: int
predictor: int
predictionDate: date
predictedProductId: int
predictedDirection: byte (0 for decrease, 1 for increase)
valueAtPrediciton: float
}
and a paired result class that measures the prediction result:
predictionResult {
id: int
valueTenDaysAfterPrediction: float
valueTwentyDaysAfterPrediction: float
valueThirtyDaysAfterPrediction: float
}
we can define a test case, such as success, where if any two of the control points of the future value are favorable in the direction and value of the cone during the prediction.
success(p: prediction, r: predictionResult): bool =
count: int
count = 0
// value is predicted to fall
if p.predictedDirection = 0 then
if p.valueAtPrediciton > r.valueTenDaysAfterPrediction then count = count + 1
if p.valueAtPrediciton > r.valueTwentyDaysAfterPrediction then count = count + 1
if p.valueAtPrediciton > r.valueThirtyDaysAfterPrediction then count = count + 1
// value is predicted to increase
else
if p.valueAtPrediciton < r.valueTenDaysAfterPrediction then count = count + 1
if p.valueAtPrediciton < r.valueTwentyDaysAfterPrediction then count = count + 1
if p.valueAtPrediciton < r.valueThirtyDaysAfterPrediction then count = count + 1
// success if count = 2 or count = 3
return (count > 1)
, , Result ; , , , ( Y/N ).
, . , - , , .