in frauddetector/frauddetector.py [0:0]
def predict(self, event_timestamp, event_variables, entity_id="unknown"):
"""Predict using your Amazon Forecast model
Args:
:event_timestamp: A string indicating the timestamp key
:event_variables: A dict with your event variables
:entity_id: The unique ID of your entity if known
Returns:
:score: {'credit_card_model_insightscore': 14.0, 'ruleResults': ['verify_outcome']} dict
"""
response = self.fd.get_event_prediction(
detectorId=self.detector_name,
detectorVersionId=self.detector_version,
eventId=str(uuid.uuid4()),
eventTypeName=self.event_type,
entities=[
{
'entityType': self.entity_type,
'entityId': entity_id
},
],
eventTimestamp=event_timestamp,
eventVariables = event_variables
)
score = response['modelScores'][0]["scores"]
score["ruleResults"] = response['ruleResults']
return score