{"id":1916,"date":"2022-02-11T15:03:58","date_gmt":"2022-02-11T06:03:58","guid":{"rendered":"https:\/\/aiacademy.jp\/media\/?p=1916"},"modified":"2025-06-18T10:57:41","modified_gmt":"2025-06-18T01:57:41","slug":"%e3%80%90%e5%88%9d%e5%bf%83%e8%80%85%e5%90%91%e3%81%91%e3%80%91%e6%a9%9f%e6%a2%b0%e5%ad%a6%e7%bf%92%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa-scikit-learn%ef%bc%88sklearn%ef%bc%89%e3%81%a8%e3%81%af","status":"publish","type":"post","link":"https:\/\/aiacademy.jp\/media\/?p=1916","title":{"rendered":"\u3010\u521d\u5fc3\u8005\u5411\u3051\u3011\u6a5f\u68b0\u5b66\u7fd2\u30e9\u30a4\u30d6\u30e9\u30ea scikit-learn\uff08sklearn\uff09\u3068\u306f\uff1f \u6a5f\u68b0\u5b66\u7fd2\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u4f53\u9a13\u3057\u3066\u307f\u3088\u3046\uff01\u3000\u3000"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\" id=\"i-0\">scikit-learn\u3068\u306f<\/h1>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"397\" src=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/chapter_000081_KdlTyrF7M5eT.png\" alt=\"\" class=\"wp-image-665\" srcset=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/chapter_000081_KdlTyrF7M5eT.png 800w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/chapter_000081_KdlTyrF7M5eT-300x149.png 300w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/chapter_000081_KdlTyrF7M5eT-768x381.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\"><\/figure>\n\n\n\n<p><a rel=\"noreferrer noopener nofollow\" href=\"https:\/\/scikit-learn.org\/stable\/\" target=\"_blank\">scikit-learn\uff08\u30b5\u30a4\u30ad\u30c3\u30c8\u30fb\u30e9\u30fc\u30f3\uff09<\/a>\u306fPython\u7528\u306e\u6a5f\u68b0\u5b66\u7fd2\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002scikit-learn\u306f\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u3067\u516c\u958b\u3055\u308c\u3066\u304a\u308a\u3001\u500b\u4eba\u30fb\u5546\u7528\u554f\u308f\u305a\u3001\u8ab0\u3067\u3082\u7121\u6599\u3067\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u307e\u305f\u3001\u6559\u5e2b\u3042\u308a\u5b66\u7fd2\u3001\u6559\u5e2b\u306a\u3057\u5b66\u7fd2\u306b\u95a2\u3059\u308b\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0(\u30b5\u30dd\u30fc\u30c8\u30d9\u30af\u30bf\u30fc\u30de\u30b7\u30f3\u3001\u30e9\u30f3\u30c0\u30e0\u30d5\u30a9\u30ec\u30b9\u30c8\u3001\u56de\u5e30\u3001\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0\u306a\u3069)\u304c\u4e00\u901a\u308a\u5229\u7528\u51fa\u6765\u308b\u4e0a\u3001\u30b5\u30f3\u30d7\u30eb\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\uff08\u30c8\u30a4\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3068\u547c\u3073\u307e\u3059\uff09\u304c\u8c4a\u5bcc\u306b\u63c3\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u306e\u305f\u3081scikit-learn\u3092\u7528\u3044\u308b\u3068\u3059\u3050\u3055\u307e\u6a5f\u68b0\u5b66\u7fd2\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u8a66\u3059\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002\u203b\u3088\u308a\u8a73\u3057\u3044\u5185\u5bb9\u306b\u95a2\u3057\u3066\u306f\u3001<a rel=\"noreferrer noopener nofollow\" href=\"http:\/\/scikit-learn.org\/stable\/\" target=\"_blank\">\u516c\u5f0f\u30b5\u30a4\u30c8(\u82f1\u8a9e)<\/a>\u306b\u8a18\u8f09\u3055\u308c\u3066\u304a\u308a\u307e\u3059\u306e\u3067\u3001scikit-learn\u306b\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u95a2\u6570\u304c\u51fa\u3066\u304d\u305f\u969b\u306b\u306f\u3001\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3068\u3057\u3066\u8aad\u3080\u4e8b\u3092\u30aa\u30b9\u30b9\u30e1\u81f4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u66f8\u7c4d\u3067\u5b66\u3073\u305f\u3044\u65b9\u306f<a href=\"https:\/\/amzn.to\/31ygCZH\" target=\"_blank\" rel=\"noopener nofollow\" title=\"\">\u3053\u3061\u3089\u306e\u66f8\u7c4d<\/a>\u304c\u304a\u3059\u3059\u3081\u3067\u3059\u3002<\/p>\n\n\n\n<p><span class=\"keiko_green\">\u3053\u306e\u30b5\u30a4\u30c8\u306f\u3001Python\u3084\u751f\u6210AI\u306a\u3069\u3092\u5b66\u3079\u308b\u30aa\u30f3\u30e9\u30a4\u30f3\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb AI Academy Bootcamp\u304c\u904b\u55b6\u3057\u3066\u3044\u307e\u3059\u3002<\/span><\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"i-1\">\u306a\u305cscikit-learn\u3092\u5b66\u3076\u306e\u304b<\/h1>\n\n\n\n<p>\u306a\u305cPython\u3092\u7528\u3044\u3066\u6a5f\u68b0\u5b66\u7fd2\u3092\u6d3b\u7528\u3059\u308b\u969b\u306b\u3001scikit-learn\u3092\u5b66\u3076\u306e\u3067\u3057\u3087\u3046\u304b\u3002\u305d\u308c\u306fscikit-learn\u306f\u3001Python\u3067(\u7d71\u8a08\u7684)\u6a5f\u68b0\u5b66\u7fd2\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u884c\u3046\u5834\u5408\u3001\u4e16\u754c\u7684\u306b\u3082\u30c7\u30d5\u30a1\u30af\u30c8\u30b9\u30bf\u30f3\u30c0\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u3089\u3067\u3059\u3002scikit-learn\u306f\u7121\u6599\u3067\u5229\u7528\u3059\u308b\u4e8b\u304c\u51fa\u6765\u307e\u3059\u306e\u3067\u3001\u6a5f\u68b0\u5b66\u7fd2\u3092\u6271\u3046\u306e\u3067\u3042\u308c\u3070\u3057\u3063\u304b\u308a\u3068\u4f7f\u3044\u3053\u306a\u305b\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"i-2\">scikit-learn\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n\n\n\n<p>scikit-learn\u3092\u5229\u7528\u3059\u308b\u306b\u306f\u300c<strong>Anaconda<\/strong>\u300d\u3092\u7528\u3044\u308b\u304b\u3001\u300c<strong>Anaconda<\/strong>\u300d\u3092\u4f7f\u3063\u3066\u3044\u306a\u3044\u74b0\u5883\u3067\u306fpip\u30b3\u30de\u30f3\u30c9\u306a\u3069\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u53ef\u80fd\u3067\u3059\u3002<strong>Anaconda\u7d4c\u7531\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u5834\u5408\u306f\u3001\u6700\u521d\u304b\u3089scikit-learn\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/strong><\/p>\n\n\n\n<p>\u4f8b\uff09pip\u30b3\u30de\u30f3\u30c9\u3092\u7528\u3044\u305f\u5b9f\u884c\u4f8b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install scikit-learn<\/code><\/pre>\n\n\n\n<p>Mac OS\u306e\u65b9\u306f\u300c\u30bf\u30fc\u30df\u30ca\u30eb\u300d\u304b\u3089\u5b9f\u884c\u3057\u3001Windows\u306e\u65b9\u306fPowerShell\u306a\u3069\u304b\u3089\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br><\/p>\n\n\n\n<p><a href=\"https:\/\/aiacademy.jp\/media\/?p=664\" target=\"_blank\" rel=\"noopener\" title=\"\">scikit-learn \u4ed8\u5c5e\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3084\u6a5f\u68b0\u5b66\u7fd2\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u30de\u30c3\u30d7\u306b\u95a2\u3057\u3066\u306f\u3053\u3061\u3089<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"toc\">    <div id=\"toc_container\" class=\"sgb-toc--no-bullets js-smooth-scroll\" data-dialog-title=\"Table of Contents\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">  <li class=\"first\">    <a href=\"#i-0\">scikit-learn\u3068\u306f<\/a>  <\/li>  <li>    <a href=\"#i-1\">\u306a\u305cscikit-learn\u3092\u5b66\u3076\u306e\u304b<\/a>  <\/li>  <li class=\"last\">    <a href=\"#i-2\">scikit-learn\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-3\">Google Colaboratory\u3067\u6a5f\u68b0\u5b66\u7fd2\u3092\u306f\u3058\u3081\u3088\u3046\uff01<\/a>      <\/li>      <li>        <a href=\"#i-4\">\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u306e\u4f5c\u6210<\/a>      <\/li>      <li>        <a href=\"#i-5\">GPU\u3092\u4f7f\u3063\u3066\u307f\u308b<\/a>      <\/li>      <li>        <a href=\"#i-6\">\u6559\u5e2b\u3042\u308a\u5b66\u7fd2<\/a>      <\/li>      <li>        <a href=\"#i-7\">\u6a5f\u68b0\u5b66\u7fd2\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u4f53\u9a13\uff08\u6982\u8981\uff09<\/a>      <\/li>      <li>        <a href=\"#i-8\">\u6a5f\u68b0\u5b66\u7fd2\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u4f53\u9a13\uff08\u5b9f\u88c5\uff09<\/a>      <\/li>      <li>        <a href=\"#i-9\">\u3010\u7121\u6599\u52d5\u753b\uff1a\u500d\u901f\u3067\u5b66\u3076\uff01\u751f\u6210AI\u3092\u6d3b\u7528\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u6cd5\uff08\u77ed\u7e2e\u7248\uff09\u3011<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-10\">\u2728AI\u4eba\u6750\u30b3\u30fc\u30b9 \u53d7\u8b1b\u304a\u7533\u8fbc\u307f\u53d7\u4ed8\u4e2d\uff01<\/a>      <\/li>    <\/ul>  <\/li><\/ul>\n      \n    <\/div><\/div><div class=\"toc\"><p><\/p>\n<\/div><h2 class=\"wp-block-heading\" id=\"i-3\">Google Colaboratory\u3067\u6a5f\u68b0\u5b66\u7fd2\u3092\u306f\u3058\u3081\u3088\u3046\uff01<\/h2>\n\n\n\n<p>\u307e\u305a\u524d\u534a\u3067\u306f\u3001Google\u304c\u6a5f\u68b0\u5b66\u7fd2\u306e\u6559\u80b2\u53ca\u3073\u7814\u7a76\u7528\u306b\u63d0\u4f9b\u3057\u3066\u3044\u308bGoogle Colaboratory\uff08\u30b0\u30fc\u30b0\u30eb\u30fb\u30b3\u30e9\u30dc\u30ec\u30a4\u30c8\u30ea\u30fc\uff09\u306e\u4f7f\u3044\u65b9\u3092\u8aac\u660e\u3057\u3001\u5f8c\u534a\u3067Python\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3068\u6a5f\u68b0\u5b66\u7fd2\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u884c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4eca\u56de\u4f7f\u3046<a href=\"https:\/\/aiacademy.jp\/texts\/show\/?id=857\" target=\"_blank\" rel=\"noopener\" title=\"\">Google\u306eColaboratory<\/a>\u306f\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u4e0d\u8981\u304b\u3064\u3001Python\u3092\u7528\u3044\u305f\u6a5f\u68b0\u5b66\u7fd2\u74b0\u5883\u304c\u6574\u3048\u3089\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u3059\u3050\u306bPython\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u59cb\u3081\u308b\u3053\u3068\u304c\u53ef\u80fd\u306a\u7121\u6599\u306e\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u8cbb\u7528\u306f\u7121\u6599\u3067CPU\u53ca\u3073<a href=\"https:\/\/aiacademy.jp\/texts\/show\/?context=subject-ml2_tutorial&amp;id=44&amp;section=CPU%E3%81%A8GPU\" target=\"_blank\" rel=\"noopener\" title=\"\">GPU<\/a>(1\u56de12\u6642\u9593)\u306e\u74b0\u5883\u304c\u5229\u7528\u53ef\u80fd\u3067\u3001\u7528\u610f\u3059\u308b\u3082\u306e\u306f\u3001Google\u30a2\u30ab\u30a6\u30f3\u30c8\u3055\u3048\u3042\u308c\u3070\u5229\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>&nbsp;<a rel=\"noreferrer noopener nofollow\" href=\"https:\/\/colab.research.google.com\/\" target=\"_blank\">Google Colaboratory\u306e\u30da\u30fc\u30b8\u3078<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/aiacademy.jp\/texts\/show\/?id=857\" target=\"_blank\" rel=\"noopener\" title=\"\">Google Colab\u5165\u9580\uff08Google Colaboratory\uff09<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-4\">\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u306e\u4f5c\u6210<\/h2>\n\n\n\n<p>\u300c\u6700\u8fd1\u306e\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u300d\u306e\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u306e\u3067\u3001\u753b\u9762\u306e\u5de6\u4e0b\u304b\u3089\u300cPYTHON3\u306e\u65b0\u3057\u3044\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u300d\u3092\u9078\u3073\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u307e\u305f\u306f\u3001\u5de6\u4e0a\u30e1\u30cb\u30e5\u30fc\u306e\u300ePython3 \u306e\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3092\u65b0\u898f\u4f5c\u6210\u300f\u3067\u3082\u540c\u3058\u3088\u3046\u306b\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/53225540-1e3d-0a31-e6b9-e1c7e20e78a8.png\" alt=\"\"><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/c12c88b1-d17b-5b2b-418e-647d8dfdc79a.png\" alt=\"\"><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/3e4ef4f9-9838-642d-4d5c-6f31a322dd08.png\" alt=\"\"><\/figure>\n\n\n\n<p>\u30fb\u5de6\u4e0a\u30e1\u30cb\u30e5\u30fc\u306e\u300ePython3 \u306e\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3092\u65b0\u898f\u4f5c\u6210\u300f\u306e\u5834\u5408<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/a49ad7ce-990f-58fb-6873-7f81ee627a2b.png\" alt=\"\"><\/figure>\n\n\n\n<p>Colaboratory\u306e\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3067\u3057\u3087\u3046\u304b\uff1f\u3055\u3066\u3001\u9ed2\u4e38\u306e\u4e09\u89d2\u306e\u5b9f\u884c\u30dc\u30bf\u30f3\u306e\u53f3\u6a2a\u306b\u3042\u308b\u80cc\u666f\u304c\u8584\u3044\u9752\u8272\u306e\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u305d\u3053\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002\uff08\u3053\u306e\u90e8\u5206\u3092\u30bb\u30eb\u3068\u547c\u3093\u3060\u308a\u3057\u307e\u3059\u3002\uff091<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">print(\"hello Python\")<\/pre>\n\n\n\n<p>\u554f\u984c\u3092\u5831\u544a\u3059\u308b\u59cb\u3081\u306f\u5c11\u3057\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\u304c\u3001\u5c11\u3057\u5f85\u3064\u3068\u7d50\u679c\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u3061\u306a\u307f\u306b\u4f5c\u6210\u3057\u305f\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u306f\u3001\u81ea\u52d5\u7684\u306bGoogle Drive\u306b\u4fdd\u5b58\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/a4802774-a67c-5bfc-eb92-5f6831abcb2b.png\" alt=\"\"><\/figure>\n\n\n\n<p>\u6b21\u306f\u3001Python\u306e\u30b0\u30e9\u30d5\u63cf\u753b\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3042\u308bMatplotlib\u3092\u4f7f\u3044\u3001\u30b0\u30e9\u30d5\u3092\u63cf\u753b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport matplotlib.pyplot as plt\n\nx = np.arange(0, 10, 0.1)\nplt.plot(x)\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/bfe0141d-7460-66dc-9acd-a81a39c84a18.png\" alt=\"\"><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-5\">GPU\u3092\u4f7f\u3063\u3066\u307f\u308b<\/h2>\n\n\n\n<p>\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u4f5c\u6210\u6642\u306b\u306f\u3001GPU\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u4e0b\u8a18\u64cd\u4f5c\u306b\u3066<a href=\"https:\/\/aiacademy.jp\/texts\/show\/?context=subject-ml2_tutorial&amp;id=44&amp;section=CPU%E3%81%A8GPU\">GPU<\/a>\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002&nbsp;\u4e0a\u90e8\u30e1\u30cb\u30e5\u30fc\u306e\u3000\u30e9\u30f3\u30bf\u30a4\u30e0 &gt; \u30e9\u30f3\u30bf\u30a4\u30e0\u306e\u30bf\u30a4\u30d7\u3092\u5909\u66f4\u3092\u9078\u629e\u3057\u3001\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u30a2\u30af\u30bb\u30e9\u30ec\u30fc\u30bf\u3092None \u304b\u3089GPU\u306b\u5909\u66f4\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/3b808540-7d1f-1053-9914-dd6fede30777.png\" alt=\"\"><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/dd14549b-fcb1-7489-db30-fda946a245c9.png\" alt=\"\"><\/figure>\n\n\n\n<p>\u3055\u3066\u3001\u4e0b\u8a18\u3092\u5b9f\u884c\u3057__\u2019\/device:GPU:0\u2019__\u3068\u51fa\u529b\u3055\u308c\u3066\u3044\u308c\u3070GPU\u304c\u5229\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/3def1337-3338-01e4-b2e6-0a324b7faac6.png\" alt=\"\"><\/figure>\n\n\n\n<p>\u307e\u305f\u3001<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">!cat \/proc\/cpuinfo<\/pre>\n\n\n\n<p>\u554f\u984c\u3092\u5831\u544a\u3059\u308b\u53ca\u3073\u3001<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">!cat \/proc\/meminfo<\/pre>\n\n\n\n<p>\u554f\u984c\u3092\u5831\u544a\u3059\u308b\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001Colaboratory\u306e\u30de\u30b7\u30f3\u30b9\u30da\u30c3\u30af\u3092\u8abf\u3079\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/d9af58e9-dd89-022f-4b5b-93b660aea506.png\" alt=\"\"><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-6\">\u6559\u5e2b\u3042\u308a\u5b66\u7fd2<\/h2>\n\n\n\n<p>\u6a5f\u68b0\u5b66\u7fd2\u306b\u306f\u3001\u6559\u5e2b\u3042\u308a\u5b66\u7fd2\u3001\u6559\u5e2b\u306a\u3057\u5b66\u7fd2\u3001\u5f37\u5316\u5b66\u7fd2\u306e\uff13\u3064\u306b\u5206\u3051\u3089\u308c\u3001\u3053\u306e\u30c6\u30ad\u30b9\u30c8\u3067\u306f\u6559\u5e2b\u3042\u308a\u5b66\u7fd2\u3092\u7528\u3044\u307e\u3059\u3002\u6559\u5e2b\u3042\u308a\u5b66\u7fd2\u306f\u5165\u529b\u30c7\u30fc\u30bf\u3068\u6b63\u89e3\u306e\u30da\u30a2(\u6559\u5e2b\u30c7\u30fc\u30bf)\u3092\u4e0e\u3048\u3066\u3001\u305d\u308c\u3092\u3082\u3068\u306b\u5b66\u7fd2\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/aiacademy.jp\/assets\/images_test\/162_16c36d4a55f.png\" alt=\"\"><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-7\">\u6a5f\u68b0\u5b66\u7fd2\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u4f53\u9a13\uff08\u6982\u8981\uff09<\/h2>\n\n\n\n<p>\u3053\u306e\u30c6\u30ad\u30b9\u30c8\u3067\u306f\u3001Iris\uff08\u30a2\u30e4\u30e1\uff09\u3068\u3044\u3046\u82b1\u306e\u54c1\u7a2e\u3092\u5224\u5b9a\u3067\u304d\u308b\u5206\u985e\u5668\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/camo.qiitausercontent.com\/cd7ccdda3d5538ab97b06ba986dabd9695f5c6d4\/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e616d617a6f6e6177732e636f6d2f302f3137313731352f38653838636131322d396530652d363738392d393333312d6139623732383331633236652e706e67\" alt=\"\"><\/figure>\n\n\n\n<p>\u4e0a\u8a18\u306e\u753b\u50cf\u3092\u898b\u3066\u5206\u304b\u308b\u901a\u308a\u30013\u7a2e\u985e\u3068\u3082\u3068\u3066\u3082\u3088\u304f\u4f3c\u3066\u304a\u308a\u307e\u3059\u3002\u3053\u306e3\u7a2e\u985e\u306e\u82b1\u306e\u3046\u3061\u3001\u3069\u306e\u82b1\u306a\u306e\u304b\u3092\u5224\u5b9a\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u6a5f\u68b0\u5b66\u7fd2\u3092\u4f7f\u3063\u3066\u3001\u5b9f\u88c5\u3057\u3066\u3044\u304d\u307e\u3059\u3002\u307e\u305f\u3001\u4eca\u56de\u306f\u6559\u5e2b\u3042\u308a\u5b66\u7fd2\u3092\u5229\u7528\u3057\u307e\u3059\u306e\u3067\u3001\u30c7\u30fc\u30bf\u306b\u306f\u305d\u308c\u305e\u308c\u3001Setosa(\u4e00\u756a\u53f3)\u306b\u306f0\u3001Versicolor(\u4e00\u756a\u5de6)\u306b\u306f1\u3001Versinica(\u4e2d\u592e)\u306b\u306f2\u306e\u6b63\u89e3\u30e9\u30d9\u30eb\u304c\u4e0e\u3048\u3089\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener nofollow\" href=\"http:\/\/dataaspirant.com\/2017\/01\/25\/svm-classifier-implemenation-python-scikit-learn\/\" target=\"_blank\">\u753b\u50cf\u5f15\u7528\u5143: SUPPORT VECTOR MACHINE (SVM CLASSIFIER) IMPLEMENATION IN PYTHON WITH SCIKIT-LEARN<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/camo.qiitausercontent.com\/38ba2b7178699dbf30c0dcac4ec8645667af673b\/68747470733a2f2f71696974612d696d6167652d73746f72652e73332e616d617a6f6e6177732e636f6d2f302f3137313731352f37356137636664352d313331372d616332632d346636312d3230343935613432336335372e706e67\" alt=\"\"><\/figure>\n\n\n\n<p><a href=\"http:\/\/sebastianraschka.com\/Articles\/2014_python_lda.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">\u753b\u50cf\u5f15\u7528\u5143: iris dataset<\/a>petal: \u82b1\u5f01sepal: \u304c\u304f&nbsp;\u30a2\u30e4\u30e1\u306e\u54c1\u7a2e\u5206\u985e\u30bf\u30b9\u30af\u306f\u3001\u82b1\u306e\u304c\u304f\u306e\u9577\u3055\u3068\u82b1\u306e\u304c\u304f\u306e\u5e45\u3001\u82b1\u306e\u82b1\u5f01\u306e\u9577\u3055\u3068\u82b1\u306e\u82b1\u5f01\u306e\u5e45\u306e4\u3064\u3092\u7528\u3044\u3066\u3001\u82b1\u306e\u54c1\u7a2e\u3092\u5206\u985e\u3057\u3088\u3046\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002\u3067\u3059\u306e\u3067\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u4e2d\u306b\u306f\u30014\u3064\u306e\u6e2c\u5b9a\u5024(\u7279\u5fb4\u91cf)\u30683\u7a2e\u985e\u306e\u82b1(Setosal\u3001Versicolor\u3001Versinica)\u304c\u30bb\u30c3\u30c8\u306b\u306a\u3063\u305f\u30c7\u30fc\u30bf\u304c150\u500b\u4e0e\u3048\u3089\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n<div id=\"id-61d30fd2-796f-49b9-9b17-9dc85f5b2841\">\n<figure class=\"wp-block-table\"><table><tbody><tr><th>\u756a\u53f7<\/th><th>\u9577\u3055\u30fb\u5e45(cm)<\/th><th>Petal\u3068Sepal<\/th><\/tr><tr><td>1<\/td><td>Sepal Length<\/td><td>Sepal\uff08\u304c\u304f\u306e\u9577\u3055\uff09\u306e\u9577\u3055<\/td><\/tr><tr><td>2<\/td><td>Sepal Width<\/td><td>Sepal\uff08\u304c\u304f\u306e\u9577\u3055\uff09\u306e\u5e45<\/td><\/tr><tr><td>3<\/td><td>Petal length<\/td><td>Petal\uff08\u82b1\u3073\u3089\uff09\u306e\u9577\u3055<\/td><\/tr><tr><td>4<\/td><td>petal Width<\/td><td>Petal\uff08\u82b1\u3073\u3089\uff09\u306e\u5e45<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p>\u305d\u3057\u3066\u3001\u6b63\u89e3\u5024(\u30e9\u30d9\u30eb: \u82b1\u306e\u540d\u79f0)\u306f\u3001\u305d\u308c\u305e\u308c\u4e0b\u8a18\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>0: Setosa<\/p>\n\n\n\n<p>1: Versicolor<\/p>\n\n\n\n<p>2: Versinica&nbsp;<\/p>\n\n\n\n<p>\u304f\u3069\u3044\u3088\u3046\u3067\u3059\u304c\u3001\u4eca\u56de\u306e\u76ee\u7684\u306f\u30014\u3064\u306e\u6e2c\u5b9a\u5024\u304c\u30e2\u30c7\u30eb\u306b\u5165\u529b\u3055\u308c\u305f\u3068\u304d\u3001\u82b1\u306e\u54c1\u7a2e\u30923\u7a2e\u985e(Setosa\u3001Versicolor\u3001Versinica)\u306e\u3046\u3061\u3001\u3069\u306e\u82b1\u306b\u8a72\u5f53\u3059\u308b\u306e\u304b\u3092\u5f53\u3066\u3089\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002&nbsp;\u6b21\u306f\u518d\u5ea6\u3001\u5165\u529b\u3068\u51fa\u529b\u306e\u95a2\u4fc2\u3092\u78ba\u8a8d\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/aiacademy.jp\/assets\/images\/iris.png\" alt=\"\"><\/figure>\n\n\n\n<p>\u4e0a\u306e\u753b\u50cf\u3067\u306f\u5165\u529b\u306b\u753b\u50cf\u3092\u5165\u529b\u3057\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u304c\u3001\u5b9f\u969b\u306f\u3001\u304c\u304f\u306e\u9577\u3055\u3084\u304c\u304f\u306e\u5e45\u3001\u82b1\u3073\u3089\u306e\u9577\u3055\u3001\u82b1\u3073\u3089\u306e\u5e45\u306e4\u3064\u306e\u6e2c\u5b9a\u5024\u306f\u3092\u5165\u529b\u3057\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u5165\u529b\u3068\u306a\u308b4\u3064\u306e\u5024\u304c\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002&nbsp;\u5165\u529b\u4f8b<\/p>\n\n\n<div id=\"id-9934ebc2-0956-4d41-a170-46ea8138d460\">\n<figure class=\"wp-block-table\"><table><tbody><tr><th>\u7279\u5fb4<\/th><th>cm<\/th><\/tr><tr><td>\u304c\u304f\u306e\u9577\u3055(Sepal Length)<\/td><td>1.4<\/td><\/tr><tr><td>\u304c\u304f\u306e\u5e45 (Sepal Width)<\/td><td>3.5<\/td><\/tr><tr><td>\u82b1\u3073\u3089\u306e\u9577\u3055 (Petal Length)<\/td><td>5.1<\/td><\/tr><tr><td>\u82b1\u3073\u3089\u306e\u5e45 (Petal Width)<\/td><td>0.2<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p><strong>Python\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306f\u6b21\u306e\u3088\u3046\u306b\u66f8\u304d\u307e\u3059\u3002<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"\"\"\n\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u6a5f\u68b0\u5b66\u7fd2\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u4f53\u9a13\uff08\u5b9f\u88c5\uff09\u3067\u5b9f\u88c5\u3057\u307e\u3059\u304c\u3001\n\u4ee5\u4e0b\u306e\u51e6\u7406\u307e\u3067\u306b\u306f\u3001\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\u3001\u30e2\u30c7\u30eb\u306e\u4f5c\u6210\u3001\u5b66\u7fd2\u3068\u3044\u3063\u305f\u6d41\u308c\u3092\u884c\u3044\u307e\u3059\u3002\n\"\"\"\n\nmodel.predict([[1.4, 3.5, 5.1, 0.2]])<\/code><\/pre>\n\n\n\n<p>\u51fa\u529b\u306f\u4f8b\u3048\u3070\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u4f8b\u3048\u3070\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u51fa\u529b\u5024\u304c2(\u3064\u307e\u308aVersinica\u3068\u5224\u5b9a\uff09\u3068\u8fd4\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[2]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-8\">\u6a5f\u68b0\u5b66\u7fd2\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u4f53\u9a13\uff08\u5b9f\u88c5\uff09<\/h2>\n\n\n\n<p>\u6982\u8aac\u306f\u4ee5\u4e0a\u306b\u3057\u3001\u5b9f\u88c5\u3092\u3057\u3066\u3044\u304d\u307e\u3059\u3002\u3055\u3066\u3001\u3053\u3053\u3067\u306f<a href=\"https:\/\/aiacademy.jp\/texts\/show\/?context=subject-ml2_tutorial&amp;id=178\" target=\"_blank\" rel=\"noopener\" title=\"\">SVM\uff08\u30b5\u30dd\u30fc\u30c8\u30d9\u30af\u30bf\u30fc\u30de\u30b7\u30f3\uff09<\/a>\u3068\u547c\u3070\u308c\u308b\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u4f7f\u3063\u3066\u5206\u985e\u3092\u884c\u306a\u3044\u307e\u3059\u3002\u307e\u305a\u306f\u3001sklearn\u304b\u3089\u3001Iris\u306edataset\u3068SVM\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from sklearn import datasets\nfrom sklearn import svm<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>\u6b21\u306b\u3001Iris\u304c\u6301\u3063\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306e\u5185\u5bb9\u3068Iris\u306e\u5f62\u72b6\u3092\u51fa\u529b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Iris\u306e\u6e2c\u5b9a\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\niris = datasets.load_iris()\n\nprint(iris.data)\nprint(iris.data.shape) # \u5f62\u72b6<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>\u51fa\u529b\u3059\u308b\u3068\u3001Iris\u306b\u306f150\u306e\u30c7\u30fc\u30bf\u304c\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306b\u30c7\u30fc\u30bf\u306e\u9577\u3055\u3092\u8abf\u3079\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>num = len(iris.data)\nprint(num)<\/code><\/pre>\n\n\n\n<p>\u3067\u306f\u3001\u30b5\u30dd\u30fc\u30c8\u30d9\u30af\u30bf\u30fc\u30de\u30b7\u30f3\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002\u3055\u304d\u307b\u3069\u306e\u3001print\u306e\u51e6\u7406\u306f\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"\"\"\n\u5192\u982d\u306e\u306f\u3058\u3081\u306b\u306b\u3082\u66f8\u304d\u307e\u3057\u305f\u901a\u308a\u3001\u73fe\u5728\u306e\u30c6\u30ad\u30b9\u30c8\u306e\u30b3\u30fc\u30c9\u3067\u30ef\u30fc\u30cb\u30f3\u30b0\u304c\u51fa\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\n\u30ef\u30fc\u30cb\u30f3\u30b0\u306f\u81f4\u547d\u7684\u306a\u30a8\u30e9\u30fc\u3067\u306f\u306a\u3044\u306e\u3067\u3001\u52d5\u4f5c\u306b\u306f\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002\u305d\u306e\u305f\u3081\u4e00\u65e6\u6c17\u306b\u305b\u305a\u9032\u3081\u3066\u304f\u3060\u3055\u3044\u3002\n\"\"\"\nclf = svm.SVC(gamma=\"auto\")\nclf.fit(iris.data, iris.target)<\/code><\/pre>\n\n\n\n<p>\u3053\u3053\u3067\u3001svm.SVC()\u3068fit()\u306b\u95a2\u3057\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u3001svm.SVC()\u306f\u3001SVM(\u30b5\u30dd\u30fc\u30c8\u30d9\u30af\u30bf\u30fc\u30de\u30b7\u30f3)\u3068\u3044\u3046\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3067\u3059\u3002Scikit-learn\u3067\u306f\u5206\u985e\u306b\u95a2\u3059\u308bSVM\u306f3\u7a2e\u985e(SVC,LinearSVC,NuSVC)\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u4e2d\u306eSVC()\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306b\u3001fit()\u3067\u3059\u304c\u3001fit()\u3092\u4f7f\u3046\u4e8b\u3067\u5b66\u7fd2(\u6a5f\u68b0\u5b66\u7fd2)\u304c\u884c\u3048\u307e\u3059\u3002fit()\u306e\u7b2c1\u5f15\u6570\u306b\u7279\u5fb4\u91cfX\u3092\u4e0e\u3048\u3001\u7b2c2\u5f15\u6570\u306b\u30e9\u30d9\u30eb\u30c7\u30fc\u30bfY\u3092\u4e0e\u3048\u5229\u7528\u3057\u307e\u3059\u3002\u7d9a\u3044\u3066\u3001\u4f5c\u3063\u305f\u30e2\u30c7\u30eb\u306b\u95a2\u3057\u3066\u3001\u4e88\u6e2c\u3092\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u4e0e\u3048\u305f\u3082\u306e\u3068\u3057\u3066\u306f\u3001\u304c\u304f\u306e\u9577\u3055\u304c1.4\u3001\u304c\u304f\u306e\u5e45\u304c1.8\u3001\u82b1\u3073\u3089\u306e\u9577\u3055\u304c3.9\u3001\u82b1\u3073\u3089\u306e\u5e45\u304c0.5\u3067\u3001\u305d\u308c\u3089\u306e\u5024\u304b\u3089\uff13\u7a2e\u985e\u306e\u3069\u306e\u82b1\u304b\u3092\u4e88\u6e2c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print(clf.predict([[1.4, 1.8, 3.9, 0.5]]))<\/code><\/pre>\n\n\n\n<p>\u51fa\u529b\u306f0,1,2(\u82b1\u306e\u30e9\u30d9\u30eb)\u306e\u3069\u308c\u304b\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u3053\u307e\u3067\u306e\u6d41\u308c\u3092\u3088\u308a\u6c4e\u7528\u7684\u306b\u66f8\u304d\u76f4\u3059\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"\"\"\nfrom sklearn import datasets\nfrom sklearn import svm\n\n# Iris\u306e\u6e2c\u5b9a\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\niris = datasets.load_iris()\nclf = svm.SVC()\nclf.fit(iris.data, iris.target)\nprint(clf.predict([[1.4, 3.5, 5.1, 0.2], [6.5, 2.6, 4.4, 1.4], [5.9, 3.0, 5.2, 1.5]]))\n\"\"\"\n\nfrom sklearn.model_selection import train_test_split\nfrom sklearn import svm\nfrom sklearn.metrics import accuracy_score\n\n# \u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\niris = datasets.load_iris()\nx, y = iris.data, iris.target\n\n# \u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30c7\u30fc\u30bf\u3068\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u306b\u5206\u3051\u308b\nx_train, x_test, y_train, y_test = train_test_split(x, y, random_state=1)\n\n# \u30e2\u30c7\u30eb\u306e\u9078\u629e\nmodel = svm.SVC()\n\n# \u5b66\u7fd2\nmodel.fit(x_train, y_train)\n\n# \u8a55\u4fa1\npred = model.predict(x_test)\nprint(accuracy_score(y_test, pred))\n\n# \u5b66\u7fd2\u6e08\u307f\u30e2\u30c7\u30eb\u3092\u4f7f\u3046\nprint(model.predict([[1.4, 3.5, 5.1, 0.2]]))\n\n# \u6b21\u306e\u3088\u3046\u306b\u3001\u8907\u6570\u6e21\u3059\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002\n# print(model.predict([[1.4, 3.5, 5.1, 0.2], [6.5, 2.6, 4.4, 1.4], [5.9, 3.0, 5.2, 1.5]]))<\/code><\/pre>\n\n\n\n<p>\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u672c\u8a18\u4e8b\u3067\u89e3\u8aac\u3057\u3066\u3044\u306a\u3044\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u8a18\u8f09\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u73fe\u6bb5\u968e\u3067\u306f\u6a5f\u68b0\u5b66\u7fd2\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3067\u306f\u4e0a\u8a18\u306e\u3088\u3046\u306a\u6d41\u308c\u3067\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u306e\u3060\u306a\u3068\u8003\u3048\u3066\u9802\u3051\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-9\">\u3010\u7121\u6599\u52d5\u753b\uff1a<strong>\u500d\u901f\u3067\u5b66\u3076\uff01\u751f\u6210AI\u3092\u6d3b\u7528\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u6cd5\uff08\u77ed\u7e2e\u7248\uff09\u3011<\/strong><\/h2>\n\n\n\n<p>\u751f\u6210AI\u3092\u6d3b\u7528\u3057\u3066\u52b9\u7387\u7684\u306b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u5b66\u3076\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002\u751f\u6210AI\u306e\u57fa\u672c\u7684\u306a\u4ed5\u7d44\u307f\u3084\u52b9\u679c\u7684\u306a\u6d3b\u7528\u6cd5\u3001\u6ce8\u610f\u70b9\u306b\u3064\u3044\u3066\u3082\u8a73\u3057\u304f\u8aac\u660e\u3002\u52c9\u5f37\u6cd5\u3068\u3068\u3082\u306b\u751f\u6210AI\u305d\u306e\u3082\u306e\u306b\u3064\u3044\u3066\u3082\u5b66\u3079\u308b\u5185\u5bb9\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u305c\u3072\u3054\u89a7\u304f\u3060\u3055\u3044\uff01<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-vimeo wp-block-embed-vimeo wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" src=\"https:\/\/player.vimeo.com\/video\/1069835048?h=e43b17d6de&amp;dnt=1&amp;app_id=122963\" width=\"880\" height=\"495\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><strong>\u5168\u7de8\u306f\u3001AI Academy\u516c\u5f0fLINE\u3067\u914d\u4fe1\u4e2d\u3067\u3059\u3002<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/lin.ee\/3E4GzWk\" target=\"_blank\" rel=\" noreferrer noopener nofollow\"><img loading=\"lazy\" decoding=\"async\" width=\"910\" height=\"517\" src=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2019\/11\/LINE_Buttom.png\" alt=\"\" class=\"wp-image-6799\" style=\"width:158px;height:auto\" srcset=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2019\/11\/LINE_Buttom.png 910w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2019\/11\/LINE_Buttom-300x170.png 300w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2019\/11\/LINE_Buttom-768x436.png 768w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\"><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-10\">\u2728AI\u4eba\u6750\u30b3\u30fc\u30b9 \u53d7\u8b1b\u304a\u7533\u8fbc\u307f\u53d7\u4ed8\u4e2d\uff01<\/h2>\n\n\n\n<p>Python\u306e\u57fa\u790e\u304b\u3089\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30b9\u3001\u6a5f\u68b0\u5b66\u7fd2\u3001LLM\u30a2\u30d7\u30ea\u958b\u767a\u307e\u3067\u309240\u6642\u9593\u4ee5\u4e0a\u306e\u5b9f\u8df5\u52d5\u753b\u3067\u4f53\u7cfb\u7684\u306b\u5b66\u3079\u307e\u3059 <br>\u521d\u5fc3\u8005\u304b\u3089\u30d7\u30ed\u3092\u76ee\u6307\u3059\u65b9\u307e\u3067\u5bfe\u5fdc\u3059\u308b\u30d7\u30e9\u30f3\u304c\u63c3\u3063\u3066\u304a\u308a\u3001\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u672a\u7d4c\u9a13\u8005\u306b\u3082\u5b89\u5fc3\u306e\u5185\u5bb9\u3067\u3059 \u3002<\/p>\n\n\n\n<p><strong>AI\u4eba\u6750\u30b3\u30fc\u30b9<\/strong>\u306e\u30ab\u30ea\u30ad\u30e5\u30e9\u30e0\u3084\u6599\u91d1\u3001\u30b5\u30dd\u30fc\u30c8\u4f53\u5236\u306e\u9055\u3044\u3092\u3001\u3072\u3068\u76ee\u3067\u628a\u63e1\u3067\u304d\u308b<strong>\u53d7\u8b1b\u30ac\u30a4\u30c9<\/strong>\u3092\u3054\u7528\u610f\u3057\u307e\u3057\u305f\u3002\u3044\u307e\u306a\u3089\u3001\u5272\u5f15\u30af\u30fc\u30dd\u30f3\u4ed8\u304d\u3067\u516c\u5f0fLINE\u304b\u3089\u53d7\u3051\u53d6\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/lin.ee\/3E4GzWk\" target=\"_blank\" rel=\" noreferrer noopener nofollow\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"571\" src=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2025\/04\/aigeneral3-2-1024x571.jpg\" alt=\"\" class=\"wp-image-7629\" srcset=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2025\/04\/aigeneral3-2-1024x571.jpg 1024w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2025\/04\/aigeneral3-2-300x167.jpg 300w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2025\/04\/aigeneral3-2-768x429.jpg 768w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2025\/04\/aigeneral3-2-1536x857.jpg 1536w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2025\/04\/aigeneral3-2-2048x1143.jpg 2048w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2025\/04\/aigeneral3-2-940x524.jpg 940w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\"><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>scikit-learn\u3068\u306f scikit-learn\uff08\u30b5\u30a4\u30ad\u30c3\u30c8\u30fb\u30e9\u30fc\u30f3\uff09\u306fPython\u7528\u306e\u6a5f\u68b0\u5b66\u7fd2\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002scikit-learn\u306f\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u3067\u516c\u958b\u3055\u308c\u3066\u304a\u308a\u3001\u500b\u4eba\u30fb\u5546\u7528\u554f\u308f\u305a\u3001\u8ab0\u3067\u3082\u7121\u6599\u3067\u5229\u7528\u3059\u308b\u3053\u3068\u304c &#8230; <\/p>\n","protected":false},"author":1,"featured_media":5961,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[130,176],"tags":[],"class_list":{"0":"post-1916","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-130","8":"category-sklearn"},"_links":{"self":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/1916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1916"}],"version-history":[{"count":34,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/1916\/revisions"}],"predecessor-version":[{"id":7664,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/1916\/revisions\/7664"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/media\/5961"}],"wp:attachment":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}