Git Product home page Git Product logo

aws-lambda-model-evaluation's Introduction

AWS Lambda Model Evaluation

Python 3.12 ๐Ÿšง Bump version ๐Ÿš€ Push Docker image to AWS ECR ๐Ÿงน Run linter Code style: black

A lambda to invoke an AWS SageMaker model endpoint with test data stored within an S3 Bucket. For analyzing a dataset to generate baseline constraints. Allowing for monitoring machine learning (ML) model quality to determine if new model predictions are accurate or not, additionally detect changes in properties

This repository does not create the AWS Simple Queue Service, this is created via Terraform found here terraform-aws-machine-learning-pipeline. Additionally, data uploaded for ML purposes can be found here ml-data-copy-to-aws-s3. For more details on the entire flow and how this lambda is deployed, see aws-automlops-serverless-deployment.

Flowchart

The diagram below demonstrates what happens when the lambda is trigger, when a new message is placed on the SQS.

graph LR
  S0(Start)
  T1(Check endpoint is available)
  T2(Configure Predictor for endpoint)
  T3(Pull test dataset from S3 Bucket)
  T4(Use test data as payload for invoking endpoint)
  E0(End)

  S0-->T1
  T1-->T2
  T2-->T3
  T3-->T4
  T4-->E0

Development

Dependencies

Usage

  1. Build the docker image locally:

    docker build --no-cache -t aws_lambda:local .
    
  2. Run the docker image built:

    docker run --platform linux/amd64 -p 9000:8080 aws_lambda:local
    
  3. Send an event to the lambda via curl:

    curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{<REPLACE_WITH_JSON_BELOW>}'
    
     {
       "Records": [
         {
           "messageId": "059f36b4-87a3-44ab-83d2-661975830a7d",
           "receiptHandle": "AQEBwJnKyrHigUMZj6rYigCgxlaS3SLy0a...",
           "body": "{\"endpointName\": \"example\", \"testDataS3BucketName\": \"example-bucket\", \"testDataS3Key\" : \"test-data.csv\"}",
           "attributes": {
             "ApproximateReceiveCount": "1",
             "SentTimestamp": "1545082649183",
             "SenderId": "AIDAIENQZJOLO23YVJ4VO",
             "ApproximateFirstReceiveTimestamp": "1545082649185"
           },
           "messageAttributes": {},
           "md5OfBody": "098f6bcd4621d373cade4e832627b4f6",
           "eventSource": "aws:sqs",
           "eventSourceARN": "arn:aws:sqs:us-east-1:111122223333:my-queue",
           "awsRegion": "us-east-1"
         }
       ]
     }

GitHub Action (CI/CD)

The GitHub Action "๐Ÿš€ Push Docker image to AWS ECR" will check out the repository and push a docker image to the chosen AWS ECR using configure-aws-credentials action. The following repository secrets need to be set:

Secret Description
AWS_REGION The AWS Region.
AWS_ACCOUNT_ID The AWS account ID.
AWS_ECR_REPOSITORY The AWS ECR repository name.

aws-lambda-model-evaluation's People

Contributors

github-actions[bot] avatar kwame-mintah avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.