DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

How does AI transform chaos engineering from an experiment into a critical capability? Learn how to effectively operationalize the chaos.

Data quality isn't just a technical issue: It impacts an organization's compliance, operational efficiency, and customer satisfaction.

Are you a front-end or full-stack developer frustrated by front-end distractions? Learn to move forward with tooling and clear boundaries.

Developer Experience: Demand to support engineering teams has risen, and there is a shift from traditional DevOps to workflow improvements.

Related

  • From ETL to ELT to Real-Time: Modern Data Engineering with Databricks Lakehouse
  • Toward Indigenous AI: A Critical Analysis of BharatGen’s Role in Data Sovereignty and Language Equity
  • Data Storage and Indexing in PostgreSQL: Practical Guide With Examples and Performance Insights
  • Guide to Optimizing Your Snowflake Data Warehouse for Performance, Cost Efficiency, and Scalability

Trending

  • Memory Leak Due to Uncleared ThreadLocal Variables
  • Enhancing SQL Server Security With AI-Driven Anomaly Detection
  • Integrating Apache Spark With Drools: A Loan Approval Demo
  • The Truth About AI and Job Loss
  1. DZone
  2. Data Engineering
  3. Data
  4. Andrews Curves

Andrews Curves

By 
Giuseppe Vettigli user avatar
Giuseppe Vettigli
·
Jan. 29, 15 · Interview
Likes (6)
Comment
Save
Tweet
Share
13.7K Views

Join the DZone community and get the full member experience.

Join For Free

Andrews curves are a method for visualizing multidimensional data by mapping each observation onto a function. This function is defined as

It has been shown the Andrews curves are able to preserve means, distance (up to a constant) and variances. Which means that Andrews curves that are represented by functions close together suggest that the corresponding data points will also be close together. Now, we will demonstrate the effectiveness of the Andrew curves on the iris dataset (which we already used here). Let's create a function to compute the values of the functions give a single sample:

import numpy as np
def andrew_curve4(x,theta):# iris has 4 four dimensions
    base_functions =[lambda x : x[0]/np.sqrt(2.),lambda x : x[1]*np.sin(theta),lambda x : x[2]*np.cos(theta),lambda x : x[3]*np.sin(2.*theta)]
    curve = np.zeros(len(theta))for f in base_functions:
        curve = curve + f(x)return curve

At this point we can load the dataset and plot the curves for a subset of samples:

samples = np.loadtxt('iris.csv', usecols=[0,1,2,3], delimiter=',')#samples = samples - np.mean(samples)#samples = samples / np.std(samples)
classes = np.loadtxt('iris.csv', usecols=[4], delimiter=',',dtype=np.str)
theta = np.linspace(-np.pi,np.pi,100)import pylab as pl
for s in samples[:20]:# setosa
    pl.plot(theta, andrew_curve4(s,theta),'r')for s in samples[50:70]:# versicolor
    pl.plot(theta, andrew_curve4(s,theta),'b')for s in samples[100:120]:# virginica
    pl.plot(theta, andrew_curve4(s,theta),'g')

pl.xlim(-np.pi,np.pi)
pl.show()

In the plot above, the each color used represents a class and we can easily note that the lines that represent samples from the same class have similar curves.

Data (computing) IRIS (transportation software) Subset

Published at DZone with permission of Giuseppe Vettigli, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • From ETL to ELT to Real-Time: Modern Data Engineering with Databricks Lakehouse
  • Toward Indigenous AI: A Critical Analysis of BharatGen’s Role in Data Sovereignty and Language Equity
  • Data Storage and Indexing in PostgreSQL: Practical Guide With Examples and Performance Insights
  • Guide to Optimizing Your Snowflake Data Warehouse for Performance, Cost Efficiency, and Scalability

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: