Practical Anomaly Detection using Python and scikit-learn

Practical Anomaly Detection using Python and scikit-learn Introduction Anomaly detection is a critical task in various domains, including finance, healthcare, and cybersecurity. It involves identifying data points, events, or patterns that deviate from the norm within a given dataset. In this article, we will explore how to build an anomaly detection system using Python and scikit-learn. Prerequisites To follow this article, you should have: Familiarity with Python and basic data structures (e.g., lists, dictionaries) Understanding of basic machine learning concepts (e.g., supervised vs. unsupervised learning) Installations: Python, scikit-learn, and relevant libraries (e.g., NumPy, Pandas) Main Sections 1. Data Preparation and Preprocessing Data preparation is a crucial step in anomaly detection. It involves cleaning, transforming, and normalizing the data to make it suitable for analysis. ...

March 29, 2025 · 3 min · Scott

Detecting Anomalies with Machine Learning and Python

Detecting Anomalies with Machine Learning and Python Introduction Anomaly detection is a critical task in data analysis, enabling the identification of suspicious transactions, credit card inconsistencies, and irregularities in medical records. In this post, we will delve into the practical implementation of anomaly detection using machine learning in Python, focusing on real-world security applications and challenges. Prerequisites To follow along with this tutorial, you will need: A basic understanding of Python and machine learning concepts (e.g., supervised and unsupervised learning) Familiarity with popular Python libraries for machine learning (e.g., scikit-learn, TensorFlow) Access to a Python environment for code execution Preparing the Data Before training a machine learning model, we need to prepare our dataset. This includes selecting relevant data, handling missing values, and scaling numerical features. ...

March 28, 2025 · 3 min · Scott

Build Secure Python Pipelines: Adding Tests and Hooks in Action

As we continue this series started in my Getting Started with Secure CI/CD: Essential Practices for Beginners post, I’ll be securing my Python code with automated testing and hooks. While some of this information builds on some previous posts I’ve created in the past, Adding pre-commit Hooks to Python Repo Writing Tests For Your Python Project I still wanted to incorporate these together in a meaningful way. My goal is to help anyone that is trying to figure out how to piece together their own pipeline. ...

February 18, 2024 · 20 min · Scott

Getting Started with Secure CI/CD: Essential Practices for Beginners

I think it’s time to focus on a few key practices for beginners to implement secure CI/CD. I’ve been building the idea on the idea of a CI/CD pipeline in a bunch of the below posts: Securing Your CI/CD Pipeline: A Beginner’s Guide to Implementing Essential Security Measures Automate Your Database Changes with a CI/CD Pipeline How to Build a CI/CD Pipeline for Your Database Infrastructure as Code with Terraform and GitHub Actions: A Kubernetes Case Study Adding pre-commit Hooks to Python Repo Writing Tests For Your Python Project All of these articles are a scattering of topics based upon some of the daily randomness that I’ve faced in my work life. After looking at all of these articles, I realized that they are a good basis for building out a secure CI/CD pipeline but the steps aren’t connected very well. ...

February 4, 2024 · 7 min · Scott

How to Use Terraform to Deploy a Python Script to AWS Lambda

I recently decided to deploy a Python script to AWS Lambda with Terraform. I had to create this Python code so that I could expose a simple API to the Internet. So that I didn’t have to maintain infrastructure, I figured the best approach was to deploy it as a Lambda function and API Gateway. Deploying as a Lambda and API Gateway sounded like a great way to go. While not maintaining infrastructure, I figured it was also a good idea to make the deployment easy. Me using Terraform to bundle everything was how I would make deployment easier. ...

April 20, 2023 · 8 min · Scott