/andrewscurves

Official repository for acdata: andrews curves data frame generator for pythonic plotting methods

Primary LanguagePython

andrewscurves PyPI version Downloads Downloads

Official repository to create high quality andrews function data and high quality plots

https://towardsdatascience.com/simple-introduction-to-andrews-curves-with-python-e20d0620ed6b

Installation

pip install andrewscurves

Importing

from andrewscurves import *

Usage

andrewscurves(data, class_column, samples)

plotly_andrews_curves(data, class_columns, samples)

seaborn_andrews_curves(data, class_columns, samples)

mpl_andrews_curves(data, class_columns, samples)

hvplot_andrews_curves(data, class_columns, samples)

Parameters

  • data : pandas.DataFrame -- input a pandas dataframe
  • class_column : str -- target or class column of your pandas dataframe
  • samples : int -- integer representing number representative samples to generate

Returns: andrewscurves()

  • df : pandas.DataFrame -- output a pandas dataframe with andrews function spacing and covariates along with feature columns

Returns: plotly_andrews_curves(), seaborn_andrews_curves(), mpl_andrews_curves(), hvplot_andrews_curves()

  • fig : flexible -- output plot object plotly, seaborn, matplotlib, or hvplot format

Examples

Data frame generation

from andrewscurves import andrewscurves
import pandas as pd

csv_url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data'
col_names = ['Sepal_Length','Sepal_Width','Petal_Length','Petal_Width','Class']
iris =  pd.read_csv(csv_url, names = col_names)

ac_df = andrewscurves(iris, 'Class', 1000)

image

Plotly chart

from andrewscurves import plotly_andrews_curves

plotly_andrews_curves(iris, 'Class',100)

image

Seaborn chart

from andrewscurves import seaborn_andrews_curves

seaborn_andrews_curves(iris, 'Class',50)

image

Matplotlib chart

from andrewscurves import mpl_andrews_curves
import matplotlib.pyplot as plt
plt.figure(figsize=(15,8)) ##set figsize with plt like a typical mpl plot

mpl_andrews_curves(iris, 'Class',100)

image

Holoviews chart

from andrewscurves import hvplot_andrews_curves

hvplot_andrews_curves(iris, 'Class',100)

image