{"id":564537,"date":"2025-05-02T07:14:17","date_gmt":"2025-05-02T06:14:17","guid":{"rendered":"https:\/\/blog.jetbrains.com\/pycharm\/2025\/01\/anomaly-detection-in-machine-learning\/"},"modified":"2025-05-02T07:14:23","modified_gmt":"2025-05-02T06:14:23","slug":"anomaly-detection-in-machine-learning","status":"publish","type":"pycharm","link":"https:\/\/blog.jetbrains.com\/ja\/pycharm\/2025\/05\/anomaly-detection-in-machine-learning\/","title":{"rendered":"Python \u306b\u3088\u308b\u6a5f\u68b0\u5b66\u7fd2\u3092\u4f7f\u3063\u305f\u7570\u5e38\u691c\u77e5\u624b\u6cd5"},"content":{"rendered":"<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-564541 size-full\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/05\/pc-featured_blog_1280x720_jp.png\" alt=\"Python \u306b\u3088\u308b\u6a5f\u68b0\u5b66\u7fd2\u3092\u4f7f\u3063\u305f\u7570\u5e38\u691c\u77e5\u624b\u6cd5\" width=\"2560\" height=\"1440\" \/><\/figure>\n<p>\u8fd1\u5e74\u306f\u591a\u304f\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u304c\u6d3b\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u306f\u53ce\u96c6\u30fb\u51e6\u7406\u53ef\u80fd\u306a\u3082\u306e\u3067\u3059\u3002 \u79c1\u305f\u3061\u304c\u30c7\u30fc\u30bf\u6642\u4ee3\u306b\u751f\u304d\u3066\u3044\u308b\u3068\u8a00\u3046\u4eba\u3082\u3044\u308b\u3067\u3057\u3087\u3046\u3002 \u3053\u306e\u3088\u3046\u306a\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u969b\u306b\u306f\u3001<strong>\u7570\u5e38\u691c\u77e5<\/strong>\u304c\u6b20\u304b\u305b\u307e\u305b\u3093\u3002\u3053\u308c\u306f\u3001\u60f3\u5b9a\u306e\u7bc4\u56f2\u5916\u3067\u3042\u308a\u3001\u901a\u5e38\u3068\u306f\u7570\u306a\u308b\u6319\u52d5\u3092\u793a\u3057\u3066\u3044\u308b\u30c7\u30fc\u30bf\uff08\u5916\u308c\u5024\uff09\u3092\u7279\u5b9a\u53ef\u80fd\u306b\u3059\u308b\u30d7\u30ed\u30bb\u30b9\u3067\u3059\u3002 \u79d1\u5b66\u7814\u7a76\u306e\u5206\u91ce\u3067\u306f\u3001\u7570\u5e38\u306a\u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\u306f\u6280\u8853\u7684\u306a\u554f\u984c\u306e\u767a\u751f\u8981\u56e0\u3068\u306a\u308b\u305f\u3081\u3001\u7d50\u8ad6\u3092\u5c0e\u304f\u969b\u306b\u306f\u7834\u68c4\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u65b0\u305f\u306a\u767a\u898b\u306b\u3064\u306a\u304c\u308b\u3082\u306e\u306b\u306a\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30d6\u30ed\u30b0\u8a18\u4e8b\u3067\u306f\u3001\u7570\u5e38\u691c\u77e5\u306b\u6a5f\u68b0\u5b66\u7fd2\u3092\u4f7f\u7528\u3059\u308b\u306e\u304c\u6709\u7528\u3067\u3042\u308b\u7406\u7531\u3092\u78ba\u8a8d\u3057\u3001Python \u3092\u4f7f\u3063\u3066\u7570\u5e38\u3092\u691c\u77e5\u3059\u308b\u4e3b\u306a\u624b\u6cd5\u3092\u63a2\u308a\u307e\u3059\u3002 OneClassSVM \u3084 Isolation Forest \u306a\u3069\u306e\u4e00\u822c\u7684\u306a\u624b\u6cd5\u3092\u5b9f\u8df5\u3059\u308b\u65b9\u6cd5\u3092\u5b66\u3073\u3001\u3053\u308c\u3089\u306e\u7d50\u679c\u3092\u53ef\u8996\u5316\u3059\u308b\u65b9\u6cd5\u306e\u4f8b\u3092\u78ba\u8a8d\u3057\u3066\u5b9f\u4e16\u754c\u306e\u554f\u984c\u306b\u5fdc\u7528\u3059\u308b\u65b9\u6cd5\u3092\u7406\u89e3\u3057\u307e\u3059\u3002<\/p>\n<h2 class=\"wp-block-heading\">\u7570\u5e38\u691c\u77e5\u304c\u4f7f\u7528\u3055\u308c\u308b\u5206\u91ce<\/h2>\n<p>\u7570\u5e38\u691c\u77e5\u306f\u554f\u984c\u3068\u306a\u308a\u5f97\u308b\u3082\u306e\u306b\u3064\u3044\u3066\u30a4\u30f3\u30b5\u30a4\u30c8\u3092\u63d0\u4f9b\u3057\u3001\u6f5c\u5728\u7684\u306a\u554f\u984c\u3092\u7279\u5b9a\u3057\u3046\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u305f\u3081\u3001\u73fe\u4ee3\u306e\u30d3\u30b8\u30cd\u30b9\u30a4\u30f3\u30c6\u30ea\u30b8\u30a7\u30f3\u30b9\u3067\u91cd\u8981\u306a\u5f79\u5272\u3092\u679c\u305f\u3057\u3066\u3044\u307e\u3059\u3002 \u7570\u5e38\u691c\u77e5\u306f\u73fe\u4ee3\u306e\u30d3\u30b8\u30cd\u30b9\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4f7f\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><strong>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8b66\u544a<\/strong><\/p>\n<p>\u7570\u5e38\u691c\u77e5\u306b\u3088\u3063\u3066\u691c\u51fa\u3067\u304d\u308b\u53ef\u80fd\u6027\u306e\u3042\u308b\u30b5\u30a4\u30d0\u30fc\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u653b\u6483\u306f\u3044\u304f\u3064\u304b\u5b58\u5728\u3057\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u91cf\u304c\u6025\u5897\u3057\u305f\u5834\u5408\u306b\u306f <a href=\"https:\/\/ja.wikipedia.org\/wiki\/DoS%E6%94%BB%E6%92%83\" target=\"_blank\" rel=\"noopener\">DDoS \u653b\u6483<\/a>\u3092\u793a\u3057\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u3001\u4e0d\u5be9\u306a\u30ed\u30b0\u30a4\u30f3\u884c\u52d5\uff08\u4f55\u5ea6\u3082\u8a66\u884c\u306b\u5931\u6557\u3059\u308b\u306a\u3069\uff09\u304c\u898b\u3089\u308c\u305f\u5834\u5408\u306b\u306f\u4e0d\u6b63\u30a2\u30af\u30bb\u30b9\u3092\u793a\u3057\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 \u4e0d\u5be9\u306a\u30e6\u30fc\u30b6\u30fc\u884c\u52d5\u304c\u691c\u51fa\u3055\u308c\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u6f5c\u5728\u7684\u306a\u30b5\u30a4\u30d0\u30fc\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8105\u5a01\u304c\u767a\u751f\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u305f\u3081\u3001\u4f01\u696d\u306f\u9069\u5b9c\u306b\u5bfe\u5fdc\u3057\u3001\u640d\u5bb3\u3092\u9632\u6b62\u3057\u305f\u308a\u6700\u5c0f\u9650\u306b\u6291\u3048\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>\u4e0d\u6b63\u884c\u70ba\u691c\u51fa<\/strong><\/p>\n<p>\u9280\u884c\u306a\u3069\u306e\u91d1\u878d\u7d44\u7e54\u3067\u306f\u3001\u4e0d\u5be9\u306a\u53e3\u5ea7\u53d6\u5f15\u3092\u660e\u78ba\u5316\u3059\u308b\u76ee\u7684\u3067\u7570\u5e38\u691c\u77e5\u304c\u7528\u3044\u3089\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306a\u53d6\u5f15\u306f\u3001\u30de\u30cd\u30fc\u30ed\u30f3\u30c0\u30ea\u30f3\u30b0\u3084\u500b\u4eba\u60c5\u5831\u306e\u76d7\u96e3\u306a\u3069\u306e\u4e0d\u6b63\u306a\u6d3b\u52d5\u3092\u793a\u3057\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 \u4e0d\u5be9\u306a\u53d6\u5f15\u306f\u30af\u30ec\u30b8\u30c3\u30c8\u30ab\u30fc\u30c9\u306e\u4e0d\u6b63\u5229\u7528\u3092\u793a\u3057\u3066\u3044\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><strong>\u53ef\u89b3\u6e2c\u6027<\/strong><\/p>\n<p>\u30a6\u30a7\u30d6\u30b5\u30fc\u30d3\u30b9\u3067\u306f\u3001\u30b7\u30b9\u30c6\u30e0\u304c\u7570\u5e38\u52d5\u4f5c\u3092\u8d77\u3053\u3057\u3066\u3044\u308b\u5834\u5408\u306b\u30b5\u30fc\u30d3\u30b9\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30e1\u30c8\u30ea\u30af\u30b9\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u53ce\u96c6\u3059\u308b\u306e\u304c\u4e00\u822c\u7684\u3067\u3059\u3002 \u305f\u3068\u3048\u3070\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u7387\u306e\u6025\u5897\u306f\u30b7\u30b9\u30c6\u30e0\u306e\u6a5f\u80fd\u306b\u4e0d\u5177\u5408\u304c\u767a\u751f\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u305f\u3081\u3001\u30a8\u30f3\u30b8\u30cb\u30a2\u306f\u76f4\u3061\u306b\u305d\u306e\u4e0d\u5177\u5408\u306b\u5bfe\u51e6\u3057\u3066\u30b5\u30fc\u30d3\u30b9\u306e\u4e2d\u65ad\u3092\u56de\u907f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2 class=\"wp-block-heading\">\u7570\u5e38\u691c\u77e5\u306b\u6a5f\u68b0\u5b66\u7fd2\u3092\u4f7f\u7528\u3059\u308b\u7406\u7531<\/h2>\n<p>\u5f93\u6765\u306e\u7d71\u8a08\u624b\u6cd5\u3067\u3082\u5916\u308c\u5024\u3092\u767a\u898b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u3059\u304c\u3001\u7570\u5e38\u691c\u77e5\u306b\u6a5f\u68b0\u5b66\u7fd2\u3092\u5229\u7528\u3059\u308b\u3068\u3001\u4f5c\u696d\u304c\u5927\u304d\u304f\u5909\u308f\u308a\u307e\u3059\u3002 \u6a5f\u68b0\u5b66\u7fd2\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u4f7f\u7528\u3059\u308c\u3070\u3001\u6bd4\u8f03\u7684\u8907\u96d1\u306a\u30c7\u30fc\u30bf\uff08\u8907\u6570\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u6301\u3064\u30c7\u30fc\u30bf\u306a\u3069\uff09\u3092\u3059\u3079\u3066\u307e\u3068\u3081\u3066\u89e3\u6790\u3067\u304d\u308b\u305f\u3081\u3067\u3059\u3002 \u6a5f\u68b0\u5b66\u7fd2\u306e\u624b\u6cd5\u3067\u306f\u3001\u3069\u3061\u3089\u304b\u3068\u8a00\u3048\u3070\u6570\u5024\u30c7\u30fc\u30bf\u306b\u9069\u3057\u3066\u3044\u308b\u5f93\u6765\u306e\u7d71\u8a08\u624b\u6cd5\u3067\u306f\u5bb9\u6613\u306b\u89e3\u6790\u3067\u304d\u306a\u3044\u30ab\u30c6\u30b4\u30ea\u30c7\u30fc\u30bf\u3092\u89e3\u6790\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306a\u7570\u5e38\u691c\u77e5\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306f\u5f80\u3005\u306b\u3057\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u5316\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066\u30c7\u30d7\u30ed\u30a4\uff08\u300c<a href=\"https:\/\/blog.jetbrains.com\/pycharm\/2024\/09\/how-to-use-fastapi-for-machine-learning\/\">\u6a5f\u68b0\u5b66\u7fd2\u306e\u305f\u3081\u306e FastAPI<\/a>\u300d\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u53c2\u7167\uff09\u3057\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u30d9\u30fc\u30b9\u304b\u6307\u5b9a\u9593\u9694\u3067\u5b9f\u884c\u3057\u3066\u7570\u5e38\u3092\u691c\u77e5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u3064\u307e\u308a\u3001\u793e\u5185\u3067\u8fc5\u901f\u306a\u5bfe\u5fdc\u3092\u4fc3\u3059\u306e\u306b\u5f79\u7acb\u3064\u3060\u3051\u3067\u306a\u304f\u3001\u30d3\u30b8\u30cd\u30b9\u30a4\u30f3\u30c6\u30ea\u30b8\u30a7\u30f3\u30b9\u30c1\u30fc\u30e0\u304c\u6226\u7565\u306e\u898b\u76f4\u3057\u3068\u8abf\u6574\u3092\u884c\u3046\u305f\u3081\u306e\u30ec\u30dd\u30fc\u30c8\u4f5c\u6210\u30c4\u30fc\u30eb\u3068\u3057\u3066\u3082\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2 class=\"wp-block-heading\">\u7570\u5e38\u691c\u77e5\u624b\u6cd5\u306e\u7a2e\u985e\u3068\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0<\/h2>\n<p>\u4e00\u822c\u7684\u306b\u3001\u7570\u5e38\u691c\u77e5\u306b\u306f\u4e3b\u306b\u5916\u308c\u5024\u691c\u51fa\u3068\u65b0\u898f\u6027\u691c\u77e5\u306e 2 \u7a2e\u985e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><strong>\u5916\u308c\u5024\u691c\u51fa<\/strong><\/p>\n<p>\u5916\u308c\u5024\u691c\u51fa\u306f\u3001\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30c7\u30fc\u30bf\u306b\u672a\u691c\u77e5\u306e\u7570\u5e38\uff08\u30e9\u30d9\u30eb\u304c\u4ed8\u3044\u3066\u3044\u306a\u3044\u7570\u5e38\uff09\u304c\u3042\u308b\u3068\u4eee\u5b9a\u3057\u3001\u6559\u5e2b\u306a\u3057\u6a5f\u68b0\u5b66\u7fd2\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u4f7f\u7528\u3057\u3066\u305d\u306e\u7570\u5e38\u3092\u8b58\u5225\u3059\u308b\u30a2\u30d7\u30ed\u30fc\u30c1\u3067\u3042\u308b\u305f\u3081\u3001<strong>\u6559\u5e2b\u306a\u3057<\/strong>\u7570\u5e38\u691c\u77e5\u3068\u547c\u3070\u308c\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002 \u3053\u306e\u3088\u3046\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u306f\u3001<a href=\"https:\/\/scikit-learn.org\/stable\/modules\/outlier_detection.html\" target=\"_blank\" rel=\"noopener\">One-Class Support Vector Machines\uff08SVM\uff09\u3001Isolation Forest\u3001Local Outlier Factor\u3001Elliptic Envelope<\/a> \u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><strong>\u65b0\u898f\u6027\u691c\u77e5<\/strong><\/p>\n<p>\u4e00\u65b9\u3001\u65b0\u898f\u6027\u691c\u77e5\u306f<strong>\u534a\u6559\u5e2b\u3042\u308a<\/strong>\u7570\u5e38\u691c\u77e5\u3068\u547c\u3070\u308c\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002 \u3059\u3079\u3066\u306e\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30c7\u30fc\u30bf\u306b\u306f\u307e\u3063\u305f\u304f\u7570\u5e38\u304c\u542b\u307e\u308c\u306a\u3044\u3068\u4eee\u5b9a\u3059\u308b\u305f\u3081\u3001\u3059\u3079\u3066\u6b63\u5e38\u3068\u3057\u3066\u30e9\u30d9\u30eb\u4ed8\u3051\u3055\u308c\u307e\u3059\u3002 \u305d\u306e\u76ee\u6a19\u306f\u3001\u65b0\u3057\u3044\u30c7\u30fc\u30bf\u304c\u7570\u5e38\uff08\u65b0\u898f\u6027\u3068\u3082\u547c\u3070\u308c\u308b\uff09\u3067\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u691c\u51fa\u3059\u308b\u3053\u3068\u3067\u3059\u3002 \u5916\u308c\u5024\u691c\u51fa\u3067\u4f7f\u7528\u3055\u308c\u308b\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306f\u3001\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30c7\u30fc\u30bf\u306b\u7570\u5e38\u304c\u306a\u3044\u5834\u5408\u306b\u9650\u3063\u3066\u65b0\u898f\u6027\u691c\u77e5\u306b\u3082\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u524d\u8ff0\u306e\u5916\u308c\u5024\u691c\u51fa\u3068\u65b0\u898f\u6027\u691c\u77e5\u4ee5\u5916\u306b\u3001\u6642\u7cfb\u5217\u30c7\u30fc\u30bf\u306e\u7570\u5e38\u691c\u77e5\u304c\u5fc5\u8981\u306b\u306a\u308b\u3053\u3068\u3082\u3088\u304f\u3042\u308a\u307e\u3059\u3002 \u305f\u3060\u3057\u3001\u6642\u7cfb\u5217\u30c7\u30fc\u30bf\u306b\u4f7f\u7528\u3055\u308c\u308b\u30a2\u30d7\u30ed\u30fc\u30c1\u3068\u624b\u6cd5\u306f\u524d\u8ff0\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3068\u306f\u7570\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u591a\u3044\u305f\u3081\u3001\u3053\u308c\u3089\u306b\u3064\u3044\u3066\u306f\u5f8c\u65e5\u8a73\u3057\u304f\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2 class=\"wp-block-heading\">\u30b3\u30fc\u30c9\u4f8b: \u990a\u8702\u7bb1\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3067\u7570\u5e38\u3092\u691c\u51fa\u3059\u308b<\/h2>\n<p>\u3053\u306e\u30d6\u30ed\u30b0\u8a18\u4e8b\u3067\u306f\u3001\u3053\u3061\u3089\u306e<a href=\"https:\/\/www.kaggle.com\/datasets\/vivovinco\/beehives\/data\" target=\"_blank\" rel=\"noopener\">\u990a\u8702\u7bb1\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8<\/a>\u3092\u4f8b\u306b\u990a\u8702\u7bb1\u306e\u7570\u5e38\u3092\u691c\u51fa\u3057\u307e\u3059\u3002 \u3053\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306b\u306f\u3001\u3055\u307e\u3056\u307e\u306a\u6642\u9593\u3067\u306e\u990a\u8702\u7bb1\u306e\u3055\u307e\u3056\u307e\u306a\u6e2c\u5b9a\u5024\uff08\u990a\u8702\u7bb1\u306e\u6e29\u5ea6\u3084\u76f8\u5bfe\u6e7f\u5ea6\u306a\u3069\uff09\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u3053\u3067\u306f\u3001\u307e\u3063\u305f\u304f\u7570\u306a\u308b 2 \u3064\u306e\u7570\u5e38\u691c\u51fa\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u6c7a\u5b9a\u5883\u754c\u3092\u5f15\u304f\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b\u30b5\u30dd\u30fc\u30c8\u30d9\u30af\u30bf\u30fc\u30de\u30b7\u30f3\u30c6\u30af\u30ce\u30ed\u30b8\u30fc\u306b\u57fa\u3065\u304f One-Class SVM \u3068\u3001Random Forest \u306b\u985e\u4f3c\u3057\u305f\u30a2\u30f3\u30b5\u30f3\u30d6\u30eb\u624b\u6cd5\u3067\u3042\u308b Isolation Forest \u3067\u3059\u3002<\/p>\n<h3 class=\"wp-block-heading\">\u4f8b: One-Class SVM<\/h3>\n<p>\u3053\u306e\u6700\u521d\u306e\u4f8b\u3067\u306f\u3001\u990a\u8702\u7bb1 17 \u756a\u306e\u30c7\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3001\u30df\u30c4\u30d0\u30c1\u304c\u5de3\u3092\u30b3\u30ed\u30cb\u30fc\u306b\u3068\u3063\u3066\u5e38\u306b\u5feb\u9069\u306a\u74b0\u5883\u306b\u4fdd\u3064\u3068\u4eee\u5b9a\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u3053\u306e\u4eee\u5b9a\u304c\u771f\u3067\u3042\u308b\u304b\u3069\u3046\u304b\u3068\u3001\u990a\u8702\u7bb1\u306e\u6e29\u5ea6\u3068\u76f8\u5bfe\u6e7f\u5ea6\u30ec\u30d9\u30eb\u304c\u7570\u5e38\u306a\u72b6\u614b\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u8abf\u3079\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.svm.OneClassSVM.html\" target=\"_blank\" rel=\"noopener\">One-Class SVM<\/a> \u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u3092\u9069\u5408\u3055\u305b\u3001\u6563\u5e03\u56f3\u4e0a\u306e\u610f\u601d\u6c7a\u5b9a\u5883\u754c\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>One-Class SVM \u306e SVM \u306f<a href=\"https:\/\/scikit-learn.org\/stable\/modules\/svm.html#svm\" target=\"_blank\" rel=\"noopener\">\u30b5\u30dd\u30fc\u30c8\u30d9\u30af\u30bf\u30fc\u30de\u30b7\u30f3<\/a>\u306e\u7565\u3067\u3042\u308a\u3001\u5206\u985e\u3068\u56de\u5e30\u306b\u4f7f\u7528\u3055\u308c\u308b\u4e00\u822c\u7684\u306a\u6a5f\u68b0\u5b66\u7fd2\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3067\u3059\u3002 \u30b5\u30dd\u30fc\u30c8\u30d9\u30af\u30bf\u30fc\u30de\u30b7\u30f3\u306f<a href=\"https:\/\/scikit-learn.org\/stable\/modules\/svm.html#mathematical-formulation\" target=\"_blank\" rel=\"noopener\">\u9ad8\u6b21\u5143\u306e\u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\u3092\u5206\u985e<\/a>\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3067\u304d\u307e\u3059\u304c\u3001\u30ab\u30fc\u30cd\u30eb\u3068\u30b9\u30ab\u30e9\u30fc\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u9078\u629e\u3057\u3066\u5883\u754c\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u3067\u3001\u307b\u3068\u3093\u3069\u306e\u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\uff08\u6b63\u5e38\u30c7\u30fc\u30bf\uff09\u3092\u542b\u3080\u6c7a\u5b9a\u5883\u754c\u3092\u4f5c\u6210\u3057\u3001\u5c11\u6570\u306e\u7570\u5e38\u3092\u5883\u754c\u306e\u5916\u5074\u306b\u7dad\u6301\u3057\u3066\u65b0\u3057\u3044\u7570\u5e38\u3092\u898b\u3064\u3051\u308b\u78ba\u7387\uff08nu\uff09\u3092\u8868\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u7570\u5e38\u691c\u77e5\u306b\u30b5\u30dd\u30fc\u30c8\u30d9\u30af\u30bf\u30fc\u30de\u30b7\u30f3\u3092\u4f7f\u7528\u3059\u308b\u624b\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001Scholkopf et al \u306b\u3088\u308b\u300e<a href=\"https:\/\/www.microsoft.com\/en-us\/research\/wp-content\/uploads\/2016\/02\/tr-99-87.pdf\" target=\"_blank\" rel=\"noopener\"><em>Estimating the Support of a High-Dimensional Distribution<\/em><\/a>\u300f\u3068\u3044\u3046\u30bf\u30a4\u30c8\u30eb\u306e\u8ad6\u6587\u3067\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h4 class=\"wp-block-heading\"><strong>1. Jupyter \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u958b\u59cb\u3059\u308b<\/strong><\/h4>\n<p>PyCharm\uff08Profefssional 2024.2.2\uff09\u3067<a href=\"https:\/\/pleiades.io\/help\/pycharm\/creating-and-running-your-first-python-project.html\" target=\"_blank\" rel=\"noopener\">\u65b0\u898f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8<\/a>\u3092\u958b\u59cb\u3059\u308b\u969b\u306b\u3001<em>Python<\/em> \u306e\u4e0b\u306b\u3042\u308b <em>Jupyter<\/em> \u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n<div class=\"buttons\">\n<div class=\"buttons__row\"><a class=\"btn\" href=\"https:\/\/www.jetbrains.com\/ja-jp\/pycharm\/data-science\/\" target=\"\" rel=\"noopener\">PyCharm Pro \u3092\u7121\u6599\u3067\u4f7f\u3044\u59cb\u3081\u308b<\/a><\/div>\n<\/div>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-537600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/image-34.png\" alt=\"PyCharm \u3067 Jupyter \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u958b\u59cb\u3059\u308b\" width=\"1592\" height=\"1292\" \/><\/figure>\n<p>PyCharm \u3067 <a href=\"https:\/\/pleiades.io\/help\/pycharm\/scientific-mode.html\" target=\"_blank\" rel=\"noopener\">Jupyter \u30d7\u30ed\u30b8\u30a7\u30af\u30c8<\/a>\uff08\u65e7\u79f0\u300c\u79d1\u5b66\u8a08\u7b97\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u300d\uff09\u3092\u4f7f\u7528\u3059\u308b\u30e1\u30ea\u30c3\u30c8\u306f\u3001\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u30d5\u30a9\u30eb\u30c0\u30fc\u3084\u3059\u3079\u3066\u306e <a href=\"https:\/\/pleiades.io\/help\/pycharm\/jupyter-notebook-support.html\" target=\"_blank\" rel=\"noopener\">Jupyter \u30ce\u30fc\u30c8\u30d6\u30c3\u30af<\/a>\u3092\u4fdd\u5b58\u3059\u308b\u30d5\u30a9\u30eb\u30c0\u30fc\u306a\u3069\u306e\u30d5\u30a1\u30a4\u30eb\u69cb\u9020\u304c\u81ea\u52d5\u7684\u306b\u751f\u6210\u3055\u308c\u308b\u305f\u3081\u3001\u3059\u3079\u3066\u306e\u5b9f\u9a13\u3092 1 \u304b\u6240\u306b\u307e\u3068\u3081\u3089\u308c\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-537611\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/image-35.png\" alt=\"PyCharm \u306e Jupyter \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\" width=\"996\" height=\"886\" \/><\/figure>\n<p><a href=\"https:\/\/matplotlib.org\/index.html\" target=\"_blank\" rel=\"noopener\">Matplotlib<\/a> \u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30b0\u30e9\u30d5\u3092\u975e\u5e38\u306b\u7c21\u5358\u306b\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3067\u304d\u308b\u3068\u3044\u3046\u5927\u304d\u306a\u30e1\u30ea\u30c3\u30c8\u3082\u3042\u308a\u307e\u3059\u3002 \u3053\u308c\u306f\u4ee5\u4e0b\u306e\u624b\u9806\u3067\u304a\u898b\u305b\u3057\u307e\u3059\u3002<\/p>\n<h4 class=\"wp-block-heading\"><strong>2. \u4f9d\u5b58\u95a2\u4fc2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/strong><\/h4>\n<p>\u95a2\u9023\u3059\u308b GitHub \u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089\u3053\u3061\u3089\u306e <a href=\"https:\/\/github.com\/Cheukting\/anomaly-detection\/blob\/main\/requirements.txt\" target=\"_blank\" rel=\"noopener\">requirements.txt<\/a> \u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002 \u3053\u308c\u3092\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u914d\u7f6e\u3057\u3066 PyCharm \u3067\u958b\u304f\u3068\u3001\u6b20\u843d\u3057\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3088\u3046\u306b\u6c42\u3081\u3089\u308c\u307e\u3059\u3002<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-537625\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/dependencies.png\" alt=\"PyCharm \u3067\u4f9d\u5b58\u95a2\u4fc2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\" width=\"1600\" height=\"524\" \/><\/figure>\n<p><em>Install requirements<\/em>\uff08requirements \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\uff09\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u3059\u3079\u3066\u306e requirements \u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\u3002 \u3053\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306f\u3001Python 3.11.1 \u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h4 class=\"wp-block-heading\"><strong>3. \u30c7\u30fc\u30bf\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u691c\u67fb\u3059\u308b<\/strong><\/h4>\n<p><a href=\"https:\/\/www.kaggle.com\/datasets\/vivovinco\/beehives\/data\" target=\"_blank\" rel=\"noopener\">Kaggle \u304b\u3089\u300cBeehives\u300d\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8<\/a>\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\uff08\u3053\u3061\u3089\u306e <a href=\"https:\/\/github.com\/Cheukting\/anomaly-detection\/tree\/main\/data\" target=\"_blank\" rel=\"noopener\">GitHub \u30ea\u30dd\u30b8\u30c8\u30ea<\/a>\u304b\u3089\u3082\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059\uff09\u3002 3 \u3064\u3059\u3079\u3066\u306e CSV \u3092 <em>Data<\/em> \u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u5165\u308c\u307e\u3059\u3002 \u6b21\u306b\u3001main.py \u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import pandas as pd\n\ndf = pd.read_csv('data\/Hive17.csv', sep=\";\")\ndf = df.dropna()\nprint(df.head())<\/pre>\n<p>\u6700\u5f8c\u306b\u3001\u753b\u9762\u306e\u53f3\u4e0a\u306b\u3042\u308b <em>Run<\/em>\uff08\u5b9f\u884c\uff09\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\u3001Python \u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u30b3\u30fc\u30c9\u304c\u5b9f\u884c\u3055\u308c\u3001\u3069\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u304b\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-537636\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/image-1.gif\" alt=\"PyCharm \u3067\u30c7\u30fc\u30bf\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b\" width=\"1230\" height=\"938\" \/><\/figure>\n<h4 class=\"wp-block-heading\"><strong>4. \u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\u3092\u9069\u5408\u3057\u3066\u30b0\u30e9\u30d5\u3067\u691c\u67fb\u3059\u308b<\/strong><\/h4>\n<p>scikit-learn \u306e OneClassSVM \u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066 DecisionBoundaryDisplay \u3068 Matplotlib \u3092\u4e00\u7dd2\u306b\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from sklearn.svm import OneClassSVM\nfrom sklearn.inspection import DecisionBoundaryDisplay\n\nimport matplotlib.pyplot as plt<\/pre>\n<p>\u30c7\u30fc\u30bf\u306e\u8aac\u660e\u3092\u898b\u308b\u3068\u3001\u5217 T17 \u306f\u990a\u8702\u7bb1\u306e\u6e29\u5ea6\u3092\u3001RH17 \u306f\u5de3\u306e\u76f8\u5bfe\u6e7f\u5ea6\u3092\u8868\u3059\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u3002 \u3053\u308c\u3089\u306e 2 \u3064\u306e\u5217\u306e\u5024\u3092\u5165\u529b\u3068\u3057\u3066\u62bd\u51fa\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">X = df[[\"T17\", \"RH17\"]].values<\/pre>\n<p>\u6b21\u306b\u3001\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u3066\u9069\u5408\u3057\u307e\u3059\u3002 \u306a\u304a\u3001\u6700\u521d\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8a2d\u5b9a\u3092\u8a66\u3057\u307e\u3059\u3002\u3054\u4e86\u627f\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">estimator = OneClassSVM().fit(X)<\/pre>\n<p>\u6b21\u306b\u3001\u6c7a\u5b9a\u5883\u754c\u3068\u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\u3092\u4e00\u7dd2\u306b\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">disp = DecisionBoundaryDisplay.from_estimator(\n    estimator,\n    X,\n    response_method=\"decision_function\",\n    plot_method=\"contour\",\n    xlabel=\"Temperature\", ylabel=\"Humidity\",\n    levels=[0],\n)\ndisp.ax_.scatter(X[:, 0], X[:, 1])\nplt.show()<\/pre>\n<p>\u4fdd\u5b58\u3057\u3066\u3082\u3046\u4e00\u5ea6 <em>Run<\/em>\uff08\u5b9f\u884c\uff09\u3092\u62bc\u3059\u3068\u3001\u30d7\u30ed\u30c3\u30c8\u304c\u691c\u67fb\u7528\u306e\u5225\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u3067\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-537647\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/image-36.png\" alt=\"PyCharm \u3067\u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\u3092\u9069\u5408\u3057\u3066\u30b0\u30e9\u30d5\u3067\u691c\u67fb\u3059\u308b\" width=\"1600\" height=\"1049\" \/><\/figure>\n<h4 class=\"wp-block-heading\"><strong>5. \u30cf\u30a4\u30d1\u30fc\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u30d5\u30a1\u30a4\u30f3\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u3059\u308b<\/strong><\/h4>\n<p>\u4e0a\u8a18\u306e\u30d7\u30ed\u30c3\u30c8\u304b\u3089\u308f\u304b\u308b\u3088\u3046\u306b\u3001\u6c7a\u5b9a\u5883\u754c\u306f\u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\u306b\u3042\u307e\u308a\u3088\u304f\u9069\u5408\u3057\u3066\u3044\u307e\u305b\u3093\u3002 \u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\u306f\u6955\u5186\u3067\u306f\u306a\u304f\u3001\u3044\u304f\u3064\u304b\u306e\u4e0d\u898f\u5247\u306a\u5f62\u72b6\u3067\u69cb\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002 \u30e2\u30c7\u30eb\u3092\u30d5\u30a1\u30a4\u30f3\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u3059\u308b\u306b\u306f\u3001\u7279\u5b9a\u5024\u306e <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.linear_model.SGDOneClassSVM.html\" target=\"_blank\" rel=\"noopener\">\u300cnu\u300d\u3068\u300cgamma\u300d\u3092 OneClassSVM \u30e2\u30c7\u30eb<\/a>\u306b\u63d0\u4f9b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 \u81ea\u5206\u3067\u8a66\u3057\u3066\u307f\u3066\u3082\u3044\u3044\u3067\u3059\u304c\u3001\u4f55\u5ea6\u304b\u30c6\u30b9\u30c8\u3057\u305f\u9650\u308a\u3067\u306f\u3001\u201cnu=0.1, gamma=0.05\u201d \u3067\u6700\u9069\u306a\u7d50\u679c\u304c\u5f97\u3089\u308c\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-537777\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/fine-tune-hyperparameters.png\" alt=\"PyCharm \u3067\u30cf\u30a4\u30d1\u30fc\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u30d5\u30a1\u30a4\u30f3\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u3059\u308b\" width=\"1274\" height=\"957\" \/><\/figure>\n<h3 class=\"wp-block-heading\">\u4f8b: Isolation Forest<\/h3>\n<p><a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.ensemble.IsolationForest.html\" target=\"_blank\" rel=\"noopener\">Isolation Forest<\/a> \u306f\u3001\u3088\u308a\u4e00\u822c\u7684\u306a <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/ensemble.html#forest\" target=\"_blank\" rel=\"noopener\">Random Forrest<\/a> \u5206\u985e\u624b\u6cd5\u306b\u985e\u4f3c\u3059\u308b<a href=\"https:\/\/scikit-learn.org\/stable\/api\/sklearn.ensemble.html\" target=\"_blank\" rel=\"noopener\">\u30a2\u30f3\u30b5\u30f3\u30d6\u30eb\u624b\u6cd5<\/a>\u3067\u3059\u3002 \u7279\u5fb4\u91cf\u3068\u5024\u3092\u30e9\u30f3\u30c0\u30e0\u306b\u9078\u629e\u3057\u3066\u30c7\u30fc\u30bf\u3092\u5206\u5272\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u3001\u591a\u6570\u306e\u6c7a\u5b9a\u6728\u304c\u4f5c\u6210\u3055\u308c\u3001\u305d\u306e\u6728\u306e\u30eb\u30fc\u30c8\u304b\u3089\u6c7a\u5b9a\u3092\u884c\u3046\u30ce\u30fc\u30c9\u307e\u3067\u306e\u30d1\u30b9\u306e\u9577\u3055\u304c\u3059\u3079\u3066\u306e\u6728\uff08\u305d\u306e\u305f\u3081\u300c\u68ee\uff08Forest\uff09\u300d\uff09\u306b\u308f\u305f\u3063\u3066\u5e73\u5747\u5316\u3055\u308c\u307e\u3059\u3002 \u30d1\u30b9\u306e\u9577\u3055\u306e\u5e73\u5747\u304c\u77ed\u3044\u5834\u5408\u3001\u7570\u5e38\u304c\u3042\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-537669\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/isolation-forest.png\" alt=\"Isolation Forest\" width=\"1600\" height=\"900\" \/>\n<figcaption class=\"wp-element-caption\"><em>\u901a\u5e38\u3001\u77ed\u3044\u6c7a\u5b9a\u30d1\u30b9\u306f\u30c7\u30fc\u30bf\u304c\u4ed6\u3068\u306f\u5927\u304d\u304f\u7570\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3057\u307e\u3059\u3002<\/em><\/figcaption>\n<\/figure>\n<p>\u3067\u306f\u3001OneClassSVM \u3068 IsolationForest \u306e\u7d50\u679c\u3092\u6bd4\u8f03\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002 \u305d\u308c\u3092\u884c\u3046\u305f\u3081\u30012 \u3064\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3067\u4f5c\u6210\u3055\u308c\u305f 2 \u3064\u306e\u6c7a\u5b9a\u5883\u754c\u306e\u30d7\u30ed\u30c3\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002 \u4ee5\u4e0b\u306e\u624b\u9806\u3067\u306f\u3001\u540c\u3058<a href=\"https:\/\/www.kaggle.com\/datasets\/vivovinco\/beehives\/data\" target=\"_blank\" rel=\"noopener\">\u990a\u8702\u7bb1 17 \u756a\u306e\u30c7\u30fc\u30bf<\/a>\u3092\u4f7f\u7528\u3057\u3066\u4e0a\u8a18\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u57fa\u306b\u69cb\u7bc9\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h4 class=\"wp-block-heading\"><strong>1. IsolationForest \u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b<\/strong><\/h4>\n<p>IsolationForest \u306f\u3001Scikit-learn \u306e Ensemble \u30ab\u30c6\u30b4\u30ea\u304b\u3089\u30a4\u30f3\u30dd\u30fc\u30c8\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from sklearn.ensemble import IsolationForest<\/pre>\n<h4 class=\"wp-block-heading\"><strong>2. \u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u3057\u3066\u65b0\u3057\u3044 estimator \u3092\u8ffd\u52a0\u3059\u308b<\/strong><\/h4>\n<p>\u3053\u308c\u4ee5\u964d\u306f 2 \u3064\u306e estimator \u304c\u5b58\u5728\u3059\u308b\u305f\u3081\u3001\u305d\u308c\u3089\u3092\u30ea\u30b9\u30c8\u306b\u683c\u7d0d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">estimators = [\n    OneClassSVM(nu=0.1, gamma=0.05).fit(X),\n    IsolationForest(n_estimators=100).fit(X)\n]<\/pre>\n<p>\u305d\u306e\u5f8c\u3001for \u30eb\u30fc\u30d7\u3092\u4f7f\u7528\u3057\u3066\u3059\u3079\u3066\u306e estimator \u3092\u30eb\u30fc\u30d7\u3067\u51e6\u7406\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">for estimator in estimators:\n    disp = DecisionBoundaryDisplay.from_estimator(\n        estimator,\n        X,\n        response_method=\"decision_function\",\n        plot_method=\"contour\",\n        xlabel=\"Temperature\", ylabel=\"Humidity\",\n        levels=[0],\n    )\n    disp.ax_.scatter(X[:, 0], X[:, 1])\n    plt.show()<\/pre>\n<p>\u6700\u5f8c\u306b\u305d\u308c\u305e\u308c\u306e\u30b0\u30e9\u30d5\u306b\u30bf\u30a4\u30c8\u30eb\u3082\u8ffd\u52a0\u3057\u3001\u691c\u67fb\u3057\u3084\u3059\u304f\u3057\u307e\u3059\u3002 \u3053\u308c\u3092\u884c\u3046\u305f\u3081\u3001disp.ax_.scatter \u306e\u5f8c\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">disp.ax_.set_title(\n        f\"Decision boundary using {estimator.__class__.__name__}\"\n    )<\/pre>\n<p>PyCharm \u3092\u4f7f\u7528\u3057\u3066\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u3059\u308b\u3068\u81ea\u52d5\u88dc\u5b8c\u306e\u5019\u88dc\u304c\u8868\u793a\u3055\u308c\u308b\u305f\u3081\u3001\u975e\u5e38\u306b\u7c21\u5358\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-537733\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/image-40.png\" alt=\"PyCharm \u306e\u81ea\u52d5\u88dc\u5b8c\u3092\u4f7f\u7528\u3057\u305f\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\" width=\"1600\" height=\"628\" \/><\/figure>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-537711\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/image-39.png\" alt=\"PyCharm \u306e\u81ea\u52d5\u88dc\u5b8c\" width=\"1520\" height=\"546\" \/><\/figure>\n<h4 class=\"wp-block-heading\"><strong>3. \u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b<\/strong><\/h4>\n<p>\u524d\u3068\u540c\u3058\u3088\u3046\u306b\u3001\u53f3\u4e0a\u306e <em>Run<\/em>\uff08\u5b9f\u884c\uff09\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3060\u3051\u3067\u7c21\u5358\u306b\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002 \u4eca\u56de\u306f\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u305f\u5f8c\u30012 \u3064\u306e\u30b0\u30e9\u30d5\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-537722\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/run-the-code.gif\" alt=\"PyCharm \u3067\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\" width=\"1056\" height=\"582\" \/><\/figure>\n<p>2 \u3064\u306e\u30b0\u30e9\u30d5\u306f\u53f3\u5074\u306e\u30d7\u30ec\u30d3\u30e5\u30fc\u3067\u7c21\u5358\u306b\u5207\u308a\u66ff\u3048\u3089\u308c\u307e\u3059\u3002 \u3054\u89a7\u306e\u3068\u304a\u308a\u3001\u6c7a\u5b9a\u5883\u754c\u306f\u7570\u306a\u308b\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u4f7f\u7528\u3059\u308b\u3068\u304b\u306a\u308a\u5909\u308f\u308a\u307e\u3059\u3002 \u7570\u5e38\u691c\u77e5\u3092\u884c\u3046\u969b\u306b\u306f\u3055\u307e\u3056\u307e\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3068\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u8a66\u3057\u3001\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u6700\u9069\u306a\u3082\u306e\u3092\u898b\u3064\u3051\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002<\/p>\n<h2 class=\"wp-block-heading\">\u6b21\u306e\u30b9\u30c6\u30c3\u30d7: \u6642\u7cfb\u5217\u30c7\u30fc\u30bf\u306e\u7570\u5e38\u691c\u77e5<\/h2>\n<p>\u3053\u306e\u990a\u8702\u7bb1\u30c7\u30fc\u30bf\u306e\u3088\u3046\u306b\u30c7\u30fc\u30bf\u304c\u6642\u7cfb\u5217\u306b\u306a\u3063\u3066\u3044\u308b\u5834\u5408\u3001\u4ed6\u306b\u3082\u7570\u5e38\u3092\u7279\u5b9a\u3059\u308b\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002 \u6642\u7cfb\u5217\u306b\u306f\u30c8\u30ec\u30f3\u30c9\u3068\u671f\u9593\u304c\u3042\u308b\u305f\u3081\u3001\u3053\u306e\u30c8\u30ec\u30f3\u30c9\u3068\u671f\u9593\u306e\u30d1\u30bf\u30fc\u30f3\u304b\u3089\u5916\u308c\u308b\u30c7\u30fc\u30bf\u306f\u3069\u308c\u3082\u7570\u5e38\u3068\u3057\u3066\u898b\u306a\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u6642\u7cfb\u5217\u3067\u7570\u5e38\u3092\u691c\u77e5\u3059\u308b\u305f\u3081\u306e\u4e00\u822c\u7684\u306a\u624b\u6cd5\u306b\u306f\u3001STL \u5206\u89e3\u3084 LSTM \u4e88\u6e2c\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u624b\u6cd5\u3092\u4f7f\u3063\u3066\u6642\u7cfb\u5217\u306e\u7570\u5e38\u3092\u691c\u77e5\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/blog.jetbrains.com\/ja\/pycharm\/2025\/05\/anomaly-detection-in-time-series\/\" data-type=\"link\" data-id=\"https:\/\/blog.jetbrains.com\/ja\/pycharm\/2025\/05\/anomaly-detection-in-time-series\/\">\u3053\u3061\u3089\u306e\u30d6\u30ed\u30b0\u8a18\u4e8b<\/a>\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h2>\n<p>\u7570\u5e38\u691c\u77e5\u306f\u30d3\u30b8\u30cd\u30b9\u30a4\u30f3\u30c6\u30ea\u30b8\u30a7\u30f3\u30b9\u306e\u91cd\u8981\u306a\u5074\u9762\u3067\u3042\u308b\u3053\u3068\u304c\u5b9f\u8a3c\u3055\u308c\u3066\u304a\u308a\u3001\u30d3\u30b8\u30cd\u30b9\u306e\u3044\u304f\u3064\u304b\u306e\u5206\u91ce\u3067\u306f\u7570\u5e38\u3092\u7279\u5b9a\u3057\u3066\u8fc5\u901f\u306a\u5bfe\u5fdc\u3092\u6307\u793a\u3067\u304d\u308b\u3053\u3068\u304c\u975e\u5e38\u306b\u91cd\u8981\u3067\u3059\u3002 \u9069\u5207\u306a\u6a5f\u68b0\u5b66\u7fd2\u30e2\u30c7\u30eb\u3092\u4f7f\u7528\u3057\u3066\u7570\u5e38\u3092\u81ea\u52d5\u7684\u306b\u691c\u77e5\u3059\u308b\u3053\u3068\u3067\u3001\u8907\u96d1\u304b\u3064\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u77ed\u6642\u9593\u3067\u5206\u6790\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u3053\u306e\u30d6\u30ed\u30b0\u8a18\u4e8b\u3067\u306f\u3001One-Class SVM \u306a\u3069\u306e\u7d71\u8a08\u7684\u624b\u6cd5\u3092\u4f7f\u3063\u3066\u7570\u5e38\u3092\u7279\u5b9a\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u6a5f\u68b0\u5b66\u7fd2\u5206\u91ce\u3067\u306e PyCharm \u306e\u4f7f\u7528\u306b\u3064\u3044\u3066\u306e\u8a73\u7d30\u306f\u3001\u300c<a href=\"https:\/\/blog.jetbrains.com\/pycharm\/2022\/06\/start-studying-machine-learning-with-pycharm\/\">PyCharm \u3092\u4f7f\u7528\u3057\u3066\u6a5f\u68b0\u5b66\u7fd2\u3092\u5b66\u3073\u59cb\u3081\u308b<\/a>\u300d\u3068\u300c<a href=\"https:\/\/blog.jetbrains.com\/pycharm\/2024\/09\/how-to-use-jupyter-notebooks-in-pycharm\/\">PyCharm \u3067 Jupyter \u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5<\/a>\u300d\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2 class=\"wp-block-heading\">PyCharm \u306b\u3088\u308b\u7570\u5e38\u306e\u691c\u77e5<\/h2>\n<p>PyCharm Professional \u3067 Jupyter \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u591a\u6570\u306e\u30c7\u30fc\u30bf\u30d5\u30a1\u30a4\u30eb\u3068\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3092\u4f7f\u3063\u3066\u7570\u5e38\u691c\u77e5\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u7c21\u5358\u306b\u6e96\u5099\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 PyCharm \u3067\u306f\u30b0\u30e9\u30d5\u51fa\u529b\u3092\u751f\u6210\u3057\u3066\u7570\u5e38\u3092\u691c\u67fb\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3001\u30d7\u30ed\u30c3\u30c8\u306b\u3082\u975e\u5e38\u306b\u7c21\u5358\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002 \u81ea\u52d5\u88dc\u5b8c\u306b\u3088\u308b\u63d0\u6848\u306a\u3069\u306e\u305d\u306e\u4ed6\u306e\u6a5f\u80fd\u3092\u4f7f\u7528\u3059\u308c\u3070\u3001Scikit-learn \u30e2\u30c7\u30eb\u3068 Matplotlib \u30d7\u30ed\u30c3\u30c8\u306e\u3059\u3079\u3066\u306e\u8a2d\u5b9a\u3082\u7c21\u5358\u306b\u64cd\u4f5c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>PyCharm \u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30b9\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30ec\u30d9\u30eb\u30a2\u30c3\u30d7\u3057\u307e\u3057\u3087\u3046\u3002\u307e\u305f\u3001\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30b9\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u306e\u5408\u7406\u5316\u306b\u5f79\u7acb\u3064<a href=\"https:\/\/www.jetbrains.com\/ja-jp\/pycharm\/data-science\/\" target=\"_blank\" rel=\"noopener\">\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30b9\u6a5f\u80fd<\/a>\u3082\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"buttons\">\n<div class=\"buttons__row\"><a class=\"btn\" href=\"https:\/\/www.jetbrains.com\/ja-jp\/pycharm\/data-science\/\" target=\"\" rel=\"noopener\">PyCharm Pro \u3092\u7121\u6599\u3067\u4f7f\u3044\u59cb\u3081\u308b<\/a><\/div>\n<\/div>\n<div>\u00a0<\/div>\n<div><strong>\u30aa\u30ea\u30b8\u30ca\u30eb\uff08\u82f1\u8a9e\uff09\u30d6\u30ed\u30b0\u6295\u7a3f\u8a18\u4e8b\u306e\u4f5c\u8005\uff1a<\/strong><\/div>\n\n    <div class=\"about-author \">\n        <div class=\"about-author__box\">\n            <div class=\"row\">\n                <div class=\"about-author__box-img\">\n                    <img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/CheukTingHo-Kimono-e1738750639162-200x200.jpg\" width=\"200\" height=\"200\" alt=\"Cheuk Ting Ho\" loading=\"lazy\"  class=\"avatar avatar-200 wp-user-avatar wp-user-avatar-200 photo avatar-default\">\n                <\/div>\n                <div class=\"about-author__box-text\">\n                                            <h4>Cheuk Ting Ho<\/h4>\n                                                        <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n","protected":false},"author":1394,"featured_media":564541,"comment_status":"closed","ping_status":"closed","template":"","categories":[952,1401],"tags":[8670],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/pycharm\/564537"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/pycharm"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/types\/pycharm"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/users\/1394"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/comments?post=564537"}],"version-history":[{"count":9,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/pycharm\/564537\/revisions"}],"predecessor-version":[{"id":564569,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/pycharm\/564537\/revisions\/564569"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/media\/564541"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/media?parent=564537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/categories?post=564537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/tags?post=564537"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/cross-post-tag?post=564537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}