{"id":2916,"date":"2026-09-01T10:00:25","date_gmt":"2026-09-01T00:30:25","guid":{"rendered":"https:\/\/softasia.jp\/blog\/?p=2916"},"modified":"2026-07-27T09:27:58","modified_gmt":"2026-07-26T23:57:58","slug":"%e3%80%90python%e5%85%a5%e9%96%80%e3%80%91scikit-learn%ef%bc%88sklearn%ef%bc%89%e3%81%a8%e3%81%af%ef%bc%9f%e6%a9%9f%e6%a2%b0%e5%ad%a6%e7%bf%92%e8%b6%85%e5%85%a5%e9%96%80%e3%82%ac%e3%82%a4%e3%83%89","status":"publish","type":"post","link":"https:\/\/softasia.jp\/blog\/offshore\/2916\/","title":{"rendered":"\u3010Python\u5165\u9580\u3011scikit-learn\uff08sklearn\uff09\u3068\u306f\uff1f\u6a5f\u68b0\u5b66\u7fd2\u8d85\u5165\u9580\u30ac\u30a4\u30c9"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"size-full wp-image-2918 aligncenter\" src=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-2.png\" alt=\"\" width=\"1000\" height=\"1000\" srcset=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-2.png 1000w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-2-300x300.png 300w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-2-150x150.png 150w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-2-768x768.png 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">Python \u3067\u6a5f\u68b0\u5b66\u7fd2\u3092\u59cb\u3081\u308b\u3068\u304d\u3001\u6700\u521d\u306b\u5fc5\u305a\u540d\u524d\u304c\u6319\u304c\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u308c\u304c <strong><span style=\"color: #ff0000;\">scikit-learn\uff08\u30b5\u30a4\u30ad\u30c3\u30c8\u30e9\u30fc\u30f3\uff09<\/span><\/strong>\u3067\u3001\u591a\u304f\u306e\u5165\u9580\u66f8\u3084\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u767b\u5834\u3059\u308b\u6a5f\u68b0\u5b66\u7fd2\u306e\u5b9a\u756a\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u300c<strong>AI\u3063\u3066\u96e3\u3057\u305d\u3046\u2026<\/strong>\u300d<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u300c<strong>\u79c1\u306b\u6a5f\u68b0\u5b66\u7fd2\u306a\u3093\u3066\u3067\u304d\u308b\u3060\u308d\u3046\u304b\uff1f<\/strong>\u300d<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u305d\u3093\u306a\u4e0d\u5b89\u3092\u62b1\u304f\u521d\u5fc3\u8005\u306e\u65b9\u3082\u591a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<span style=\"text-decoration: underline;\">scikit-learn \u306f\u3001\u521d\u5fc3\u8005\u3053\u305d\u6700\u521d\u306b\u89e6\u308c\u308b\u3079\u304d\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3001\u8907\u96d1\u306a\u6570\u5b66\u3092\u77e5\u3089\u306a\u304f\u3066\u3082\u3001\u6570\u884c\u306e\u30b3\u30fc\u30c9\u3067\u5206\u985e\u30fb\u56de\u5e30\u30fb\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0\u304c\u5b9f\u88c5\u3067\u304d\u308b\u3088\u3046\u306b\u4f5c\u3089\u308c\u3066\u3044\u307e\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u672c\u8a18\u4e8b\u3067\u306f\u3001Python\u521d\u5fc3\u8005\u3067\u3082\u7121\u7406\u306a\u304f\u6a5f\u68b0\u5b66\u7fd2\u3092\u59cb\u3081\u3089\u308c\u308b scikit-learn\uff08sklearn\uff09\u306b\u3064\u3044\u3066\u3001\u57fa\u790e\u304b\u3089\u5b9f\u8df5\u307e\u3067\u89e3\u8aac\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u672c\u8a18\u4e8b\u3067\u308f\u304b\u308b\u3053\u3068<\/span><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>scikit-learn \u304c\u3069\u3093\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u304b<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u4f55\u304c\u3067\u304d\u308b\u306e\u304b\uff08\u3067\u304d\u308b\u3053\u3068\u4e00\u89a7\uff09<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u5b9f\u969b\u306b\u52d5\u304b\u3059\u307e\u3067\u306e\u6d41\u308c\uff086\u30b9\u30c6\u30c3\u30d7\uff09<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u521d\u5fc3\u8005\u304c\u307e\u305a\u53d6\u308a\u7d44\u3080\u3079\u304d\u5b9f\u4f8b<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u5b66\u7fd2\u306e\u3064\u307e\u305a\u304d\u30dd\u30a4\u30f3\u30c8\u3068\u89e3\u6c7a\u65b9\u6cd5<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u5b9f\u52d9\u3067\u306f\u3069\u306e\u3088\u3046\u306b\u4f7f\u308f\u308c\u3066\u3044\u308b\u304b<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3081\u3070\u3001\u6a5f\u68b0\u5b66\u7fd2\u306e\u57fa\u790e\u304b\u3089\u5b9f\u8df5\u307e\u3067\u306e\u9053\u7b4b\u304c\u3059\u3079\u3066\u898b\u3048\u308b\u306f\u305a\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">\u76ee\u6b21<\/p><ul class=\"toc_list\"><li><a href=\"#scikit-learnsklearn\"><span class=\"toc_number toc_depth_1\">1<\/span> scikit-learn\uff08sklearn\uff09\u3068\u306f<\/a><ul><li><a href=\"#i\"><span class=\"toc_number toc_depth_2\">1.1<\/span> \u3068\u306b\u304b\u304f\u4f7f\u3044\u3084\u3059\u3044<\/a><\/li><li><a href=\"#i-2\"><span class=\"toc_number toc_depth_2\">1.2<\/span> \u7d71\u4e00\u3055\u308c\u305f\u4f7f\u3044\u65b9\u3067\u899a\u3048\u3084\u3059\u3044<\/a><\/li><li><a href=\"#i-3\"><span class=\"toc_number toc_depth_2\">1.3<\/span> \u5b66\u7fd2\u301c\u5b9f\u52d9\u307e\u3067\u9577\u304f\u4f7f\u3048\u308b<\/a><\/li><\/ul><\/li><li><a href=\"#scikit-learn\"><span class=\"toc_number toc_depth_1\">2<\/span> scikit-learn\u3067\u3067\u304d\u308b\u3053\u3068<\/a><ul><li><a href=\"#Classification\"><span class=\"toc_number toc_depth_2\">2.1<\/span> \u5206\u985e\uff08Classification\uff09<\/a><\/li><li><a href=\"#Regression\"><span class=\"toc_number toc_depth_2\">2.2<\/span> \u56de\u5e30\uff08Regression\uff09<\/a><\/li><li><a href=\"#Clustering\"><span class=\"toc_number toc_depth_2\">2.3<\/span> \u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0\uff08Clustering\uff09<\/a><\/li><li><a href=\"#Dimensionality_Reduction\"><span class=\"toc_number toc_depth_2\">2.4<\/span> \u6b21\u5143\u524a\u6e1b\uff08Dimensionality Reduction\uff09<\/a><\/li><li><a href=\"#Preprocessing\"><span class=\"toc_number toc_depth_2\">2.5<\/span> \u30c7\u30fc\u30bf\u524d\u51e6\u7406\uff08Preprocessing\uff09<\/a><\/li><\/ul><\/li><li><a href=\"#scikit-learn-2\"><span class=\"toc_number toc_depth_1\">3<\/span> scikit-learn\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<\/a><ul><li><a href=\"#STEP1\"><span class=\"toc_number toc_depth_2\">3.1<\/span> STEP1. \u30c7\u30fc\u30bf\u3092\u7528\u610f\u3059\u308b<\/a><\/li><li><a href=\"#STEP2\"><span class=\"toc_number toc_depth_2\">3.2<\/span> STEP2. \u8a13\u7df4\u30c7\u30fc\u30bf\u3068\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u306b\u5206\u5272<\/a><\/li><li><a href=\"#STEP3\"><span class=\"toc_number toc_depth_2\">3.3<\/span> STEP3. \u30e2\u30c7\u30eb\u3092\u9078\u3076<\/a><\/li><li><a href=\"#STEP4_fit\"><span class=\"toc_number toc_depth_2\">3.4<\/span> STEP4. \u5b66\u7fd2\uff08fit\uff09<\/a><\/li><li><a href=\"#STEP5_predict\"><span class=\"toc_number toc_depth_2\">3.5<\/span> STEP5. \u4e88\u6e2c\uff08predict\uff09<\/a><\/li><li><a href=\"#STEP6\"><span class=\"toc_number toc_depth_2\">3.6<\/span> STEP6. \u7cbe\u5ea6\u3092\u8a55\u4fa1<\/a><\/li><\/ul><\/li><li><a href=\"#Iris\"><span class=\"toc_number toc_depth_1\">4<\/span> \u5b9f\u4f8b\uff1aIris\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3067\u5206\u985e\u30e2\u30c7\u30eb\u3092\u4f5c\u308b<\/a><\/li><li><a href=\"#i-4\"><span class=\"toc_number toc_depth_1\">5<\/span> \u307e\u3068\u3081<\/a><\/li><\/ul><\/div>\n<h2><span id=\"scikit-learnsklearn\"><span style=\"font-weight: 400;\">scikit-learn\uff08sklearn\uff09\u3068\u306f<\/span><\/span><\/h2>\n<p><img loading=\"lazy\" class=\"size-full wp-image-2921 aligncenter\" src=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-9.png\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-9.png 640w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-9-300x200.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">scikit-learn\u3068\u306f\u3001Python\u3067\u6a5f\u68b0\u5b66\u7fd2\u3092\u884c\u3046\u305f\u3081\u306e \u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea \u3067\u3059<\/span>\u3002<strong><span style=\"color: #ff0000;\">\u5206\u985e\u30fb\u56de\u5e30\u30fb\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0<\/span><\/strong>\u3068\u3044\u3063\u305f\u6a5f\u68b0\u5b66\u7fd2\u306e\u57fa\u672c\u6a5f\u80fd\u304c\u6700\u521d\u304b\u3089\u307e\u3068\u3081\u3066\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u8907\u96d1\u306a\u8a2d\u5b9a\u3092\u3057\u306a\u304f\u3066\u3082\u3059\u3050\u306b\u4f7f\u3044\u59cb\u3081\u3089\u308c\u308b\u306e\u304c\u5927\u304d\u306a\u7279\u5fb4\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i\"><span style=\"font-weight: 400;\">\u3068\u306b\u304b\u304f\u4f7f\u3044\u3084\u3059\u3044<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">scikit-learn\u306e\u6700\u5927\u306e\u9b45\u529b\u306f\u3001\u30b3\u30fc\u30c9\u91cf\u306e\u5c11\u306a\u3055\u3067\u3059<\/span>\u3002<strong><span style=\"color: #ff0000;\">\u6c7a\u5b9a\u6728<\/span><\/strong>\u3084<strong><span style=\"color: #ff0000;\">\u30e9\u30f3\u30c0\u30e0\u30d5\u30a9\u30ec\u30b9\u30c8<\/span><\/strong>\u3001<strong><span style=\"color: #ff0000;\">SVM<\/span><\/strong>\u3068\u3044\u3063\u305f\u4e00\u898b\u96e3\u3057\u305d\u3046\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3067\u3082\u3001\u6570\u884c\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3060\u3051\u3067\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u9ad8\u5ea6\u306a\u30e2\u30c7\u30eb\u3082\u3001\u521d\u5fc3\u8005\u304c\u6271\u3048\u308b\u30ec\u30d9\u30eb\u3067\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>\u6c7a\u5b9a\u6728\uff08Decision Tree\uff09<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u30e9\u30f3\u30c0\u30e0\u30d5\u30a9\u30ec\u30b9\u30c8\uff08Random Forest\uff09<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>SVM\uff08\u30b5\u30dd\u30fc\u30c8\u30d9\u30af\u30bf\u30fc\u30de\u30b7\u30f3\uff09<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u300c<span style=\"text-decoration: underline;\">\u3068\u308a\u3042\u3048\u305a\u52d5\u304b\u3057\u3066\u307f\u308b<\/span>\u300d\u3053\u3068\u304c\u3067\u304d\u308b\u305f\u3081\u3001\u5b66\u7fd2\u306e\u30cf\u30fc\u30c9\u30eb\u304c\u975e\u5e38\u306b\u4f4e\u3044\u306e\u304c\u7279\u5fb4\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-2\"><span style=\"font-weight: 400;\">\u7d71\u4e00\u3055\u308c\u305f\u4f7f\u3044\u65b9\u3067\u899a\u3048\u3084\u3059\u3044<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">scikit-learn\u3067\u306f\u3001\u3069\u306e\u30e2\u30c7\u30eb\u3092\u4f7f\u3063\u3066\u3082\u57fa\u672c\u7684\u306a\u6d41\u308c\u304c\u540c\u3058\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">model.fit(X_train, y_train)<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">model.predict(X_test)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3053\u306e\u3088\u3046\u306b\u3001\u300c<\/span><span style=\"text-decoration: underline;\">fit() \u3067\u5b66\u7fd2<\/span><strong>\u300d\u300c<\/strong><span style=\"text-decoration: underline;\">predict() \u3067\u4e88\u6e2c<\/span><strong>\u300d<\/strong><span style=\"font-weight: 400;\">\u3068\u3044\u3046<strong><span style=\"color: #ff0000;\">\u5171\u901a\u306eAPI<\/span><\/strong>\u304c\u63a1\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3072\u3068\u3064\u306e\u30e2\u30c7\u30eb\u3092\u899a\u3048\u308c\u3070\u3001\u5225\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u3082\u7c21\u5358\u306b\u5fdc\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u30e2\u30c7\u30eb\u304c\u5909\u308f\u308b\u305f\u3073\u306b\u4f7f\u3044\u65b9\u3092\u899a\u3048\u76f4\u3059\u5fc5\u8981\u304c\u306a\u3044\u3068\u3044\u3046\u70b9\u306f\u3001\u521d\u5fc3\u8005\u306b\u3068\u3063\u3066\u5927\u304d\u306a\u30e1\u30ea\u30c3\u30c8\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"i-3\"><span style=\"font-weight: 400;\">\u5b66\u7fd2\u301c\u5b9f\u52d9\u307e\u3067\u9577\u304f\u4f7f\u3048\u308b<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">scikit-learn\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5e45\u5e83\u3044\u30b7\u30fc\u30f3\u3067\u6d3b\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>\u521d\u5fc3\u8005\u306e\u6a5f\u68b0\u5b66\u7fd2\u5b66\u7fd2<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u30c7\u30fc\u30bf\u5206\u6790\u30fb\u7d71\u8a08\u89e3\u6790<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>AI\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\uff08MVP\uff09\u958b\u767a<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u5c0f\u898f\u6a21\u306aAI\u30b7\u30b9\u30c6\u30e0\u306e\u672c\u756a\u904b\u7528<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">\u4e00\u5ea6\u8eab\u306b\u3064\u3051\u308c\u3070\u3001\u5b66\u7fd2\u7528\u9014\u3060\u3051\u3067\u7d42\u308f\u3089\u305a\u3001\u5b9f\u52d9\u30b9\u30ad\u30eb\u3068\u3057\u3066\u9577\u304f\u4f7f\u3048\u308b\u70b9\u3082\u5927\u304d\u306a\u9b45\u529b\u3067\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span id=\"scikit-learn\"><span style=\"font-weight: 400;\">scikit-learn\u3067\u3067\u304d\u308b\u3053\u3068<\/span><\/span><\/h2>\n<p><img loading=\"lazy\" class=\"size-full wp-image-2923 aligncenter\" src=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-10.png\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-10.png 640w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-10-300x200.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">scikit-learn\u306f\u3001\u6a5f\u68b0\u5b66\u7fd2\u306e\u4e3b\u8981\u5206\u91ce\u3092\u307b\u307c\u3059\u3079\u3066\u30ab\u30d0\u30fc\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u4ee3\u8868\u7684\u306a\u6a5f\u80fd\u3092\u5206\u91ce\u3054\u3068\u306b\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"Classification\"><span style=\"font-weight: 400;\">\u5206\u985e\uff08Classification\uff09<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">\u5206\u985e\u3068\u306f\u3001\u30c7\u30fc\u30bf\u3092\u3042\u3089\u304b\u3058\u3081\u6c7a\u3081\u3089\u308c\u305f\u30ab\u30c6\u30b4\u30ea\u306b\u632f\u308a\u5206\u3051\u308b\u624b\u6cd5\u3067\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u6d3b\u7528\u4f8b<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>\u30e1\u30fc\u30eb\u304c\u30b9\u30d1\u30e0\u304b\u3069\u3046\u304b\u3092\u5224\u5b9a<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u753b\u50cf\u306b\u5199\u3063\u3066\u3044\u308b\u6570\u5b57\u3092\u8a8d\u8b58<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u6587\u66f8\u3084\u8cc7\u6599\u3092\u30b8\u30e3\u30f3\u30eb\u5225\u306b\u5206\u985e<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>\u4ee3\u8868\u7684\u306a\u30e2\u30c7\u30eb<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>SVM<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u6c7a\u5b9a\u6728<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u30e9\u30f3\u30c0\u30e0\u30d5\u30a9\u30ec\u30b9\u30c8<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>K\u8fd1\u508d\u6cd5\uff08KNN\uff09<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u521d\u5fc3\u8005\u304c\u6700\u521d\u306b\u5b66\u3076\u30c6\u30fc\u30de\u3068\u3057\u3066\u3082\u4eba\u6c17\u304c\u3042\u308a\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"Regression\"><span style=\"font-weight: 400;\">\u56de\u5e30\uff08Regression\uff09<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">\u56de\u5e30\u306f\u3001\u5c06\u6765\u306e\u6570\u5024\u3084\u9023\u7d9a\u5024\u3092\u4e88\u6e2c\u3059\u308b\u305f\u3081\u306e\u624b\u6cd5\u3067\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u6d3b\u7528\u4f8b<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>\u58f2\u4e0a\u3084\u6765\u5ba2\u6570\u306e\u4e88\u6e2c<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u6c17\u6e29\u3084\u9700\u8981\u306e\u4e88\u6e2c<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u5bb6\u8cc3\u30fb\u4fa1\u683c\u76f8\u5834\u306e\u4e88\u6e2c<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>\u4ee3\u8868\u7684\u306a\u30e2\u30c7\u30eb<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>\u7dda\u5f62\u56de\u5e30<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u30e9\u30c3\u30bd\u56de\u5e30\u30e9\u30f3\u30c0\u30e0\u30d5\u30a9\u30ec\u30b9\u30c8\u56de\u5e30<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>SVR<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u30d3\u30b8\u30cd\u30b9\u30b7\u30fc\u30f3\u3067\u306e\u6d3b\u7528\u304c\u975e\u5e38\u306b\u591a\u3044\u5206\u91ce\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"Clustering\"><span style=\"font-weight: 400;\">\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0\uff08Clustering\uff09<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0\u306f\u3001\u6b63\u89e3\u30e9\u30d9\u30eb\u304c\u306a\u3044\u30c7\u30fc\u30bf\u3092 \u7279\u5fb4\u306e\u4f3c\u305f\u30b0\u30eb\u30fc\u30d7\u306b\u5206\u3051\u308b\u624b\u6cd5\u3067\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u6d3b\u7528\u4f8b<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>\u9867\u5ba2\u3092\u8cfc\u8cb7\u50be\u5411\u3054\u3068\u306b\u5206\u985e<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u753b\u50cf\u3084\u6587\u7ae0\u3092\u985e\u4f3c\u5ea6\u3067\u30b0\u30eb\u30fc\u30d7\u5316<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>\u4ee3\u8868\u7684\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>K-means<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u968e\u5c64\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u5206\u6790\u3084\u9867\u5ba2\u5206\u6790\u3067\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"Dimensionality_Reduction\"><span style=\"font-weight: 400;\">\u6b21\u5143\u524a\u6e1b\uff08Dimensionality Reduction\uff09<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">\u30c7\u30fc\u30bf\u91cf\u304c\u5927\u304d\u3059\u304e\u308b\u3068\u6271\u3044\u306b\u304f\u3044\u305f\u3081\u3001\u5c11\u306a\u3044\u7279\u5fb4\u306b\u5727\u7e2e\u3059\u308b\u624b\u6cd5\u3067\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u4f8b:<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>PCA\uff08\u4e3b\u6210\u5206\u5206\u6790\uff09<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>t-SNE<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3><span id=\"Preprocessing\"><span style=\"font-weight: 400;\">\u30c7\u30fc\u30bf\u524d\u51e6\u7406\uff08Preprocessing\uff09<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u5b9f\u52d9\u3067\u306f\u30e2\u30c7\u30eb\u9078\u3073\u4ee5\u4e0a\u306b\u524d\u51e6\u7406\u304c\u91cd\u8981 \u3068\u8a00\u308f\u308c\u307e\u3059\u3002<span style=\"text-decoration: underline;\">scikit-learn\u306b\u306f\u3001\u524d\u51e6\u7406\u7528\u306e\u6a5f\u80fd\u3082\u8c4a\u5bcc\u306b\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u4e3b\u306a\u6a5f\u80fd<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>\u6a19\u6e96\u5316\uff08StandardScaler\uff09<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u6b63\u898f\u5316\uff08MinMaxScaler\uff09<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>One-Hot\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>\u6b20\u640d\u5024\u88dc\u5b8c\uff08SimpleImputer\uff09<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">scikit-learn\u3060\u3051\u3067\u3001\u524d\u51e6\u7406\u304b\u3089\u5b66\u7fd2\u3001\u8a55\u4fa1\u307e\u3067\u3092\u4e00\u8cab\u3057\u3066\u884c\u3048\u308b\u306e\u304c\u5927\u304d\u306a\u5f37\u307f\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span id=\"scikit-learn-2\"><span style=\"font-weight: 400;\">scikit-learn\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<\/span><\/span><\/h2>\n<p><img loading=\"lazy\" class=\"size-full wp-image-2925 aligncenter\" src=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-11.png\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-11.png 640w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-11-300x200.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">scikit-learn\u3092\u4f7f\u3063\u305f\u6a5f\u68b0\u5b66\u7fd2\u306f\u3001\u5b9f\u306f\u3068\u3066\u3082\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002\u57fa\u672c\u306e\u6d41\u308c\u306f \u305f\u3063\u305f6\u30b9\u30c6\u30c3\u30d7\u3060\u3051\u3067\u3059\u3002\u3053\u306e\u578b\u3092\u899a\u3048\u3066\u3057\u307e\u3048\u3070\u3001\u5206\u985e\u30fb\u56de\u5e30\u30fb\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0\u306a\u3069\u3001\u307b\u307c\u3059\u3079\u3066\u306e\u30e2\u30c7\u30eb\u306b\u5fdc\u7528\u3067\u304d\u307e\u3059\u3002<\/span><span style=\"font-weight: 400;\">\u3053\u3053\u3067\u306f\u3001\u521d\u5fc3\u8005\u304c\u6700\u521d\u306b\u7406\u89e3\u3059\u3079\u304d scikit-learn\u306e\u738b\u9053\u30d5\u30ed\u30fc \u3092\u3001\u30b3\u30fc\u30c9\u4f8b\u3064\u304d\u3067\u89e3\u8aac\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"STEP1\"><span style=\"font-weight: 400;\">STEP1. \u30c7\u30fc\u30bf\u3092\u7528\u610f\u3059\u308b<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u6a5f\u68b0\u5b66\u7fd2\u306f\u30c7\u30fc\u30bf\u304c\u3059\u3079\u3066\u3067\u3059\u3002\u307e\u305a\u306f\u3001\u5b66\u7fd2\u306b\u4f7f\u3046\u30c7\u30fc\u30bf\uff08\u7279\u5fb4\u91cf\uff09\u3068\u6b63\u89e3\u30e9\u30d9\u30eb\u3092\u7528\u610f\u3057\u307e\u3059\u3002<span style=\"text-decoration: underline;\">scikit-learn\u306b\u306f\u3001\u5b66\u7fd2\u7528\u306b\u6700\u9069\u306a \u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8 \u304c\u6700\u521d\u304b\u3089\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3053\u3053\u3067\u306f\u5b9a\u756a\u306e Iris\uff08\u30a2\u30e4\u30e1\uff09\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u4f7f\u3044\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">from sklearn.datasets import load_iris<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">data = load_iris()<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">X = data.data\u00a0 \u00a0 \u00a0 # \u7279\u5fb4\u91cf\uff08\u5165\u529b\u30c7\u30fc\u30bf\uff09<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">y = data.target\u00a0 \u00a0 # \u6b63\u89e3\u30e9\u30d9\u30eb<\/span><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>X\uff1a\u82b1\u3073\u3089\u306e\u9577\u3055\u3084\u5e45\u306a\u3069\u306e\u6570\u5024\u30c7\u30fc\u30bf<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>y\uff1a\u30a2\u30e4\u30e1\u306e\u7a2e\u985e\uff08\u30af\u30e9\u30b9\uff09<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u521d\u5fc3\u8005\u306f\u3001\u307e\u305a\u300cX\u304c\u5165\u529b\u3001y\u304c\u7b54\u3048\u300d\u3068\u899a\u3048\u308c\u3070OK\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"STEP2\"><span style=\"font-weight: 400;\">STEP2. \u8a13\u7df4\u30c7\u30fc\u30bf\u3068\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u306b\u5206\u5272<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u6b21\u306b\u3001\u30c7\u30fc\u30bf\u3092\u300c<\/span><span style=\"text-decoration: underline;\">\u5b66\u7fd2\u7528\uff08train\uff09<\/span><strong>\u300d\u300c<\/strong><span style=\"text-decoration: underline;\">\u8a55\u4fa1\u7528\uff08test\uff09<\/span><strong>\u300d<\/strong><span style=\"font-weight: 400;\">\u306b\u5206\u5272\u3057\u307e\u3059\u3002<\/span><span style=\"font-weight: 400;\">\u3053\u308c\u306f\u899a\u3048\u305f\u554f\u984c\u3068\u521d\u898b\u306e\u554f\u984c\u3092\u5206\u3051\u308b\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">from sklearn.model_selection import train_test_split<\/span><\/p>\n<p><span style=\"color: #0000ff;\"><span style=\"font-weight: 400;\">X_train, X_test, y_train, y_test = train_test_split(<\/span><span style=\"font-weight: 400;\">X, y, test_size=0.3)<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>train\uff1a\u30e2\u30c7\u30eb\u306b\u5b66\u7fd2\u3055\u305b\u308b\u30c7\u30fc\u30bf<\/strong><\/li>\n<li style=\"font-weight: 400;\"><strong>test\uff1a\u5b66\u7fd2\u7d50\u679c\u3092\u8a55\u4fa1\u3059\u308b\u30c7\u30fc\u30bf<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">test_size=0.3 \u306f30%\u3092\u30c6\u30b9\u30c8\u7528\u306b\u4f7f\u3046\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"STEP3\"><span style=\"font-weight: 400;\">STEP3. \u30e2\u30c7\u30eb\u3092\u9078\u3076<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u6b21\u306b\u3001\u3069\u306e\u6a5f\u68b0\u5b66\u7fd2\u30e2\u30c7\u30eb\u3092\u4f7f\u3046\u304b\u3092\u9078\u3073\u307e\u3059\u3002<span style=\"text-decoration: underline;\">\u521d\u5fc3\u8005\u306b\u6700\u3082\u304a\u3059\u3059\u3081\u306a\u306e\u304c \u30e9\u30f3\u30c0\u30e0\u30d5\u30a9\u30ec\u30b9\u30c8 \u3067\u3059<\/span>\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">from sklearn.ensemble import RandomForestClassifier<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">model = RandomForestClassifier()<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u30e9\u30f3\u30c0\u30e0\u30d5\u30a9\u30ec\u30b9\u30c8\u306f\u3001\u4ee5\u4e0b\u306e\u7279\u5fb4\u304c\u3042\u308a\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">\u7cbe\u5ea6\u304c\u9ad8\u3044<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">\u8a2d\u5b9a\u304c\u5c11\u306a\u304f\u6271\u3044\u3084\u3059\u3044<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">\u591a\u304f\u306e\u554f\u984c\u3067\u5b89\u5b9a\u3057\u3066\u52d5\u304f<\/span><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3068\u308a\u3042\u3048\u305a\u4f7f\u3046\u30e2\u30c7\u30eb<\/span><span style=\"font-weight: 400;\">\u3068\u3057\u3066\u975e\u5e38\u306b\u512a\u79c0\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"STEP4_fit\"><span style=\"font-weight: 400;\">STEP4. \u5b66\u7fd2\uff08fit\uff09<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u30e2\u30c7\u30eb\u306b\u8a13\u7df4\u30c7\u30fc\u30bf\u3092\u4e0e\u3048\u3066\u3001\u5b66\u7fd2\u3055\u305b\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">model.fit(X_train, y_train)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3053\u306e1\u884c\u3067\u3001\u300c<span style=\"text-decoration: underline;\">\u5165\u529b\u30c7\u30fc\u30bf\uff08X\uff09\u3068\u6b63\u89e3\uff08y\uff09\u306e\u95a2\u4fc2<\/span>\u300d\u3092\u30e2\u30c7\u30eb\u304c\u81ea\u52d5\u3067\u5b66\u7fd2\u3057\u307e\u3059\u3002<\/span><span style=\"font-weight: 400;\">scikit-learn\u3067\u306f\u3001\u3069\u306e\u30e2\u30c7\u30eb\u3067\u3082 fit() \u3092\u4f7f\u3046 \u3068\u3044\u3046\u5171\u901a\u30eb\u30fc\u30eb\u304c\u3042\u308b\u305f\u3081\u3001\u899a\u3048\u3084\u3059\u3044\u306e\u3082\u30dd\u30a4\u30f3\u30c8\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"STEP5_predict\"><span style=\"font-weight: 400;\">STEP5. \u4e88\u6e2c\uff08predict\uff09<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u5b66\u7fd2\u304c\u7d42\u308f\u3063\u305f\u3089\u3001\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u4f7f\u3063\u3066\u4e88\u6e2c\u3092\u884c\u3044\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">pred = model.predict(X_test)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3053\u308c\u3067\u3001\u300c\u3053\u306e\u30c7\u30fc\u30bf\u306f\u3069\u306e\u30af\u30e9\u30b9\u304b\uff1f\u300d\u3068\u3044\u3046\u4e88\u6e2c\u7d50\u679c\u304c pred \u306b\u683c\u7d0d\u3055\u308c\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"STEP6\"><span style=\"font-weight: 400;\">STEP6. \u7cbe\u5ea6\u3092\u8a55\u4fa1<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u6700\u5f8c\u306b\u3001\u4e88\u6e2c\u7d50\u679c\u304c\u3069\u308c\u304f\u3089\u3044\u6b63\u3057\u304b\u3063\u305f\u306e\u304b\u3092\u8a55\u4fa1\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">from sklearn.metrics import accuracy_score<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">accuracy_score(y_test, pred)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">accuracy_score \u306f\u300c\u6b63\u89e3\u7387\u300d\u3092\u8868\u3057\u307e\u3059\u30020.9 \u306a\u3089\u300c90%\u6b63\u3057\u304f\u5f53\u3066\u3089\u308c\u305f\u300d\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002\u6a5f\u68b0\u5b66\u7fd2\u3067\u306f\u3001\u5fc5\u305a\u8a55\u4fa1\u307e\u3067\u884c\u3046\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span id=\"Iris\"><span style=\"font-weight: 400;\">\u5b9f\u4f8b\uff1aIris\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3067\u5206\u985e\u30e2\u30c7\u30eb\u3092\u4f5c\u308b<\/span><\/span><\/h2>\n<p><img loading=\"lazy\" class=\"size-full wp-image-2928 aligncenter\" src=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-12.png\" alt=\"\" width=\"640\" height=\"427\" srcset=\"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-12.png 640w, https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT-_ASIA-12-300x200.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3053\u3053\u307e\u3067\u306e\u30b9\u30c6\u30c3\u30d7\u3092\u307e\u3068\u3081\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u00a0<strong>\u5b8c\u6210\u30b3\u30fc\u30c9<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">from sklearn.datasets import load_iris<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">from sklearn.model_selection import train_test_split<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">from sklearn.ensemble import RandomForestClassifier<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">from sklearn.metrics import accuracy_score<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\"># \u30c7\u30fc\u30bf\u8aad\u307f\u8fbc\u307f<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">iris = load_iris()<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">X = iris.data<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">y = iris.target<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\"># \u30c7\u30fc\u30bf\u5206\u5272<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\"># \u30e2\u30c7\u30eb\u4f5c\u6210<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">model = RandomForestClassifier()<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\"># \u5b66\u7fd2<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">model.fit(X_train, y_train)<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\"># \u4e88\u6e2c<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">pred = model.predict(X_test)<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\"># \u8a55\u4fa1<\/span><\/p>\n<p><span style=\"font-weight: 400; color: #0000ff;\">print(&#8220;\u6b63\u89e3\u7387:&#8221;, accuracy_score(y_test, pred))<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u3053\u306e\u3088\u3046\u306b\u3001\u305f\u3063\u305f18\u884c\u3067\u672c\u683c\u7684\u306a\u5206\u985e\u30e2\u30c7\u30eb\u304c\u5b8c\u6210\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><b>\u521d\u5fc3\u8005\u306b\u3068\u3063\u3066scikit-learn\u304c\u6700\u5f37\u306a\u7406\u7531<\/b><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">\u624b\u9806\u304c\u6c7a\u307e\u3063\u3066\u3044\u3066\u8ff7\u308f\u306a\u3044<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">\u30b3\u30fc\u30c9\u91cf\u304c\u5c11\u306a\u304f\u9054\u6210\u611f\u304c\u3042\u308b<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">\u7d50\u679c\u304c\u3059\u3050\u6570\u5024\u3067\u898b\u3048\u308b<\/span><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">\u300c\u6a5f\u68b0\u5b66\u7fd2\u3063\u3066\u52d5\u304f\u307e\u3067\u304c\u5927\u5909\u305d\u3046\u2026\u300d\u3068\u611f\u3058\u3066\u3044\u308b\u4eba\u3067\u3082\u3001\u6700\u521d\u306e\u6210\u529f\u4f53\u9a13\u3092\u5f97\u3084\u3059\u3044\u306e\u304c\u7279\u5fb4\u3067\u3059\u3002\u307e\u305a\u306f\u3053\u306e\u57fa\u672c\u30d5\u30ed\u30fc\u3092\u4e38\u3054\u3068\u771f\u4f3c\u3057\u3066\u52d5\u304b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002scikit-learn\u306e\u5168\u4f53\u50cf\u304c\u4e00\u6c17\u306b\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span id=\"i-4\"><span style=\"font-weight: 400;\">\u307e\u3068\u3081<\/span><\/span><\/h2>\n<p class=\"isSelectedEnd\">\u672c\u8a18\u4e8b\u3067\u306f\u3001Python\u521d\u5fc3\u8005\u3067\u3082\u7121\u7406\u306a\u304f\u6a5f\u68b0\u5b66\u7fd2\u3092\u59cb\u3081\u3089\u308c\u308b scikit-learn\uff08sklearn\uff09\u306b\u3064\u3044\u3066\u3001\u57fa\u790e\u304b\u3089\u5b9f\u8df5\u307e\u3067\u89e3\u8aac\u3057\u3066\u304d\u307e\u3057\u305f\u3002scikit-learn\u306f\u3001\u300c\u6a5f\u68b0\u5b66\u7fd2\u3063\u3066\u96e3\u3057\u305d\u3046\u2026\u300d\u300c\u6570\u5b66\u304c\u3067\u304d\u306a\u3044\u3068\u7121\u7406\u306a\u306e\u3067\u306f\uff1f\u300d\u3068\u611f\u3058\u3066\u3044\u308b\u4eba\u307b\u3069\u3001\u6700\u521d\u306e\u4e00\u6b69\u3068\u3057\u3066\u6700\u9069\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p class=\"isSelectedEnd\">\u307e\u305a\u306f\u3001\u672c\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u305f\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u305d\u306e\u307e\u307e\u5b9f\u884c\u3057\u3001\u300c\u52d5\u304f\u4f53\u9a13\u300d\u3092\u5f97\u308b\u3053\u3068\u304b\u3089\u59cb\u3081\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u306e\u5c0f\u3055\u306a\u6210\u529f\u4f53\u9a13\u304c\u3001\u6b21\u306e\u30b9\u30c6\u30c3\u30d7\u3078\u306e\u5927\u304d\u306a\u539f\u52d5\u529b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p class=\"isSelectedEnd\">\u4e00\u65b9\u3067\u3001\u300c\u5b9f\u52d9\u3067\u3069\u3046\u6d3b\u304b\u305b\u3070\u3044\u3044\u306e\u304b\u5206\u304b\u3089\u306a\u3044\u300d\u300c\u81ea\u793e\u306e\u30c7\u30fc\u30bf\u3067AI\u3092\u6d3b\u7528\u3057\u305f\u3044\u304c\u9032\u3081\u65b9\u306b\u4e0d\u5b89\u304c\u3042\u308b\u300d\u3068\u3044\u3063\u305f\u60a9\u307f\u3092\u611f\u3058\u308b\u65b9\u3082\u5c11\u306a\u304f\u3042\u308a\u307e\u305b\u3093\u3002\u305d\u3046\u3057\u305f\u5834\u5408\u306f\u3001\u5c02\u9580\u5bb6\u306e\u77e5\u898b\u3092\u53d6\u308a\u5165\u308c\u308b\u3053\u3068\u3067\u3001\u5b66\u7fd2\u304b\u3089\u5b9f\u52d9\u3078\u306e\u79fb\u884c\u3092\u30b9\u30e0\u30fc\u30ba\u306b\u9032\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>scikit-learn\u3092\u306f\u3058\u3081\u3068\u3057\u305f\u6a5f\u68b0\u5b66\u7fd2\u306e\u5c0e\u5165\u3084\u6d3b\u7528\u306b\u3064\u3044\u3066\u304a\u60a9\u307f\u306e\u65b9\u306f\u3001\u305c\u3072<em><strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/softasia.jp\/#contact\">3ink<\/a><\/span><\/strong><\/em>\u307e\u3067\u304a\u6c17\u8efd\u306b\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002\u76ee\u7684\u3084\u8ab2\u984c\u306b\u5fdc\u3058\u305f\u6700\u9069\u306a\u6d3b\u7528\u65b9\u6cd5\u3092\u3054\u63d0\u6848\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Python \u3067\u6a5f\u68b0\u5b66\u7fd2\u3092\u59cb\u3081\u308b\u3068\u304d\u3001\u6700\u521d\u306b\u5fc5\u305a\u540d\u524d\u304c\u6319\u304c\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u308c\u304c scikit-learn\uff08\u30b5\u30a4\u30ad\u30c3\u30c8\u30e9\u30fc\u30f3\uff09\u3067\u3001\u591a\u304f\u306e\u5165\u9580\u66f8\u3084\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u767b\u5834\u3059\u308b\u6a5f\u68b0\u5b66\u7fd2\u306e\u5b9a\u756a\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002 [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":2918,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[4,1],"tags":[],"jetpack_featured_media_url":"https:\/\/softasia.jp\/blog\/wp-content\/uploads\/2025\/12\/SOFT_ASIA_\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1-1000-x-1000-px-2.png","_links":{"self":[{"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/posts\/2916"}],"collection":[{"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/comments?post=2916"}],"version-history":[{"count":19,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/posts\/2916\/revisions"}],"predecessor-version":[{"id":3474,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/posts\/2916\/revisions\/3474"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/media\/2918"}],"wp:attachment":[{"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/media?parent=2916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/categories?post=2916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softasia.jp\/blog\/wp-json\/wp\/v2\/tags?post=2916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}