我们有一个基于生产网络的产品,允许用户对商品的未来价值(或需求)做出预测,历史数据包含大约10万个例子,每个例子有大约5个参数;
考虑一类称为谓词的数据:
prediction {
id: int
predictor: int
predictionDate: date
predictedProductId: int
predictedDirection: byte (0 for decrease, 1 for increase)
valueAtPrediciton: float
}
Run Code Online (Sandbox Code Playgroud)
以及测量预测结果的配对结果类:
predictionResult {
id: int
valueTenDaysAfterPrediction: float
valueTwentyDaysAfterPrediction: float
valueThirtyDaysAfterPrediction: float
}
Run Code Online (Sandbox Code Playgroud)
我们可以定义一个成功的测试用例,其中如果任何两个未来的值检查点在预测时考虑方向和值时是有利的.
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 …Run Code Online (Sandbox Code Playgroud) pattern-recognition classification machine-learning data-mining