{ "cells": [ { "cell_type": "markdown", "id": "285a3796-e7d9-45ba-8b11-418c0535a8c9", "metadata": {}, "source": [ "# Andrewscurves" ] }, { "cell_type": "code", "execution_count": null, "id": "d8d7bf92-ae63-4122-9457-10c9ada6c6f1", "metadata": {}, "outputs": [], "source": [ "import hvplot.pandas # noqa" ] }, { "cell_type": "markdown", "id": "915da73a-0a5f-4a40-aa4b-a65a6002c3e9", "metadata": {}, "source": [ "Andrews curves provides a mechanism for visualising clusters of multivariate data.\n", "\n", "Andrews curves have the functional form:\n", "\n", " f(t) = x_1/sqrt(2) + x_2 sin(t) + x_3 cos(t) + x_4 sin(2t) + x_5 cos(2t) + ...\n", "\n", "Where *x* coefficients correspond to the values of each dimension and *t* is\n", "linearly spaced between *-pi* and *+pi*. Each row of frame then corresponds to\n", "a single curve." ] }, { "cell_type": "code", "execution_count": null, "id": "d85a9c83-bd5d-4ac2-b1a0-0bb451a484e9", "metadata": {}, "outputs": [], "source": [ "from bokeh.sampledata import iris\n", "\n", "iris = iris.flowers" ] }, { "cell_type": "code", "execution_count": null, "id": "780fc986-819b-4882-9c44-113b9a211d97", "metadata": {}, "outputs": [], "source": [ "iris.head()" ] }, { "cell_type": "code", "execution_count": null, "id": "4c721441-ecf3-4178-a55f-d43eed7d00a5", "metadata": {}, "outputs": [], "source": [ "hvplot.plotting.andrews_curves(\n", " iris,\n", " class_column='species',\n", " samples=20,\n", ")" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 5 }