{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "id": "TQu6OACsn1Y2" }, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from sklearn.datasets import make_blobs\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "yLDb-YRYn1ZE" }, "outputs": [], "source": [ "# make 3-class dataset for classification\n", "centers = [[-5, 0], [0, 1.5], [5, -1]]\n", "X, y = make_blobs(n_samples=1000, centers=centers, random_state=40)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "VbQvM6p2n1ZH", "outputId": "3d208ede-7b1e-424a-b660-6f385c53f038" }, "outputs": [], "source": [ "color = \"rbg\"\n", "color = [color[y[i]] for i in range(len(y))]\n", "plt.scatter(X[:, 0], X[:, 1], c=color)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "KpNVD2gBn1ZL", "outputId": "5074f19b-66f3-4947-b59f-31e24153d661" }, "outputs": [], "source": [ "y" ] } ], "metadata": { "colab": { "name": "create_dataset_through_Scikit_Learn_Example.ipynb", "provenance": [] }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.2" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }