{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Draws some Box Plot diagrams on data distribution" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### NuGet package installation" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Installing package Microsoft.ML, version 1.4.0.............done!" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Successfully added reference to package Microsoft.ML, version 1.4.0" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Installing package XPlot.Plotly, version 3.0.1.....done!" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Successfully added reference to package XPlot.Plotly, version 3.0.1" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "#r \"nuget:Microsoft.ML, 1.4.0\"\n", "#r \"nuget:XPlot.Plotly, 3.0.1\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Namespaces" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "using Microsoft.ML;\n", "using Microsoft.ML.Data;\n", "using XPlot.Plotly;" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Simple start: well prepared data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Read the raw data" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "scrolled": true }, "outputs": [], "source": [ "var mlContext = new MLContext(seed: null);\n", "\n", "var reader = mlContext.Data.CreateTextLoader(\n", " new TextLoader.Options()\n", " {\n", " Separators = new[] { ',' },\n", " HasHeader = true,\n", " Columns = new[]\n", " {\n", " new TextLoader.Column(\"Age\", DataKind.Single, 2),\n", " new TextLoader.Column(\"AnnualIncome\", DataKind.Single, 3),\n", " new TextLoader.Column(\"SpendingScore\", DataKind.Single, 4),\n", " }\n", " });\n", " \n", "var dataView = reader.Load(\"./Mall_Customers.csv\");" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Visualize the data" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "var graph = new Graph.Box()\n", "{\n", " y = dataView.GetColumn