예제 #1
0
def createPredictionModel(dataFrame):
    with open(MODEL_PARAMS_PATH, "r") as dataIn:
        modelParams = json.loads(dataIn.read())
    minInput, maxInput = getMinMax(dataFrame)

    # RDSE - resolution calculation
    valueEncoderParams = \
      modelParams["modelParams"]["sensorParams"]["encoders"]["value"]
    numBuckets = float(valueEncoderParams.pop("numBuckets"))
    resolution = max(0.001, (maxInput - minInput) / numBuckets)
    valueEncoderParams["resolution"] = resolution

    model = ModelFactory.create(modelParams)
    model.enableInference({"predictedField": "value"})
    return model
def createPredictionModel(dataFrame):
  with open(MODEL_PARAMS_PATH, "r") as dataIn:
    modelParams = json.loads(dataIn.read())
  minInput, maxInput = getMinMax(dataFrame)

  # RDSE - resolution calculation
  valueEncoderParams = \
    modelParams["modelParams"]["sensorParams"]["encoders"]["value"]
  numBuckets = float(valueEncoderParams.pop("numBuckets"))
  resolution = max(0.001, (maxInput - minInput) / numBuckets)
  valueEncoderParams["resolution"] = resolution

  model = ModelFactory.create(modelParams)
  model.enableInference({"predictedField": "value"})
  return model
예제 #3
0
def createPredictionModel(dataFrame):
  with open(MODEL_PARAMS_PATH, "r") as dataIn:
    modelParams = json.loads(dataIn.read())
  minInput, maxInput = getMinMax(dataFrame) # min: 8   max: 39197

  # RDSE - resolution calculation
  valueEncoderParams = \
    modelParams["modelParams"]["sensorParams"]["encoders"]["value"]
    # {'type': 'RandomDistributedScalarEncoder', 
    # 'seed': 42, 'fieldname': 'value', 'name': 'value', 'numBuckets': 130.0}

  numBuckets = float(valueEncoderParams.pop("numBuckets"))
  resolution = max(0.001, (maxInput - minInput) / numBuckets) # 301.45
  valueEncoderParams["resolution"] = resolution

  model = ModelFactory.create(modelParams)
  model.enableInference({"predictedField": "value"})
  return model