{"id":1154,"date":"2023-07-27T11:31:28","date_gmt":"2023-07-27T11:31:28","guid":{"rendered":"https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/"},"modified":"2023-07-27T11:31:28","modified_gmt":"2023-07-27T11:31:28","slug":"%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python","status":"publish","type":"post","link":"https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/","title":{"rendered":"Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 (\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\"><a href=\"https:\/\/statorials.org\/ja\/\u30ed\u30b7\u3099\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30-1\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u306f\u3001<\/a> <a href=\"https:\/\/statorials.org\/ja\/\u5909\u6570\u306e\u8aac\u660e\u5fdc\u7b54\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u5fdc\u7b54\u5909\u6570\u304c<\/a>\u30d0\u30a4\u30ca\u30ea\u306e\u5834\u5408\u306b\u56de\u5e30\u30e2\u30c7\u30eb\u3092\u8fd1\u4f3c\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3067\u304d\u308b\u65b9\u6cd5\u3067\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3067\u306f\u3001<em>\u6700\u5c24\u63a8\u5b9a<\/em>\u3068\u3057\u3066\u77e5\u3089\u308c\u308b\u65b9\u6cd5\u3092\u4f7f\u7528\u3057\u3066\u3001\u6b21\u306e\u5f62\u5f0f\u306e\u65b9\u7a0b\u5f0f\u3092\u6c42\u3081\u307e\u3059\u3002<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>log[p(X) \/ ( <sub>1<\/sub> -p(X))] = \u03b2 <sub>0<\/sub> + \u03b2 <sub>1<\/sub> X <sub>1<\/sub> + \u03b2 <sub>2<\/sub> X <sub>2<\/sub> + \u2026 + \u03b2 <sub>p<\/sub><\/strong><\/span><\/p>\n<p><span style=\"color: #000000;\">\u91d1\uff1a<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>X <sub>j<\/sub><\/strong> : j<sup>\u756a\u76ee\u306e<\/sup>\u4e88\u6e2c\u5909\u6570<\/span><\/li>\n<li><span style=\"color: #000000;\"><strong>\u03b2 <sub>j<\/sub><\/strong> : j<sup>\u756a\u76ee<\/sup>\u306e\u4e88\u6e2c\u5909\u6570\u306e\u4fc2\u6570\u306e\u63a8\u5b9a<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">\u65b9\u7a0b\u5f0f\u306e\u53f3\u5074\u306e\u5f0f\u306f\u3001\u5fdc\u7b54\u5909\u6570\u304c\u5024 1 \u3092\u3068\u308b<strong>\u5bfe\u6570\u30aa\u30c3\u30ba<\/strong>\u3092\u4e88\u6e2c\u3057\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u3057\u305f\u304c\u3063\u3066\u3001\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u30e2\u30c7\u30eb\u3092\u5f53\u3066\u306f\u3081\u308b\u5834\u5408\u3001\u6b21\u306e\u65b9\u7a0b\u5f0f\u3092\u4f7f\u7528\u3057\u3066\u3001\u7279\u5b9a\u306e\u89b3\u6e2c\u5024\u304c\u5024 1 \u3092\u53d6\u308b\u78ba\u7387\u3092\u8a08\u7b97\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<p> <span style=\"color: #000000;\">p(X) = e <sup>\u03b2 <sub>0<\/sub> + <sub>\u03b2<\/sub> <sub>1<\/sub> <sub>X<\/sub> <sub>1<\/sub> <sub>+<\/sub> <sub>\u03b2<\/sub><\/sup> <sup><sub>2<\/sub> <sub>X<\/sub> <sub>2<\/sub> <sub>+<\/sub> <sub>\u2026<\/sub> <sub>+<\/sub> <sub>\u03b2<\/sub><\/sup> p<\/span><\/p>\n<p><span style=\"color: #000000;\">\u6b21\u306b\u3001\u7279\u5b9a\u306e\u78ba\u7387\u3057\u304d\u3044\u5024\u3092\u4f7f\u7528\u3057\u3066\u3001\u89b3\u6e2c\u5024\u3092 1 \u307e\u305f\u306f 0 \u306b\u5206\u985e\u3057\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u305f\u3068\u3048\u3070\u3001\u78ba\u7387\u304c 0.5 \u4ee5\u4e0a\u306e\u89b3\u6e2c\u5024\u306f\u300c1\u300d\u306b\u5206\u985e\u3055\u308c\u3001\u305d\u306e\u4ed6\u306e\u89b3\u6e2c\u5024\u306f\u3059\u3079\u3066\u300c0\u300d\u306b\u5206\u985e\u3055\u308c\u308b\u3068\u8a00\u3048\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001R \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u306e\u6bb5\u968e\u7684\u306a\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002<\/span><\/p>\n<h3><span style=\"color: #000000;\"><strong>\u30b9\u30c6\u30c3\u30d7 1: \u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u307e\u305a\u3001Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> pandas <span style=\"color: #008000;\">as<\/span> pd\n<span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n<span style=\"color: #008000;\">from<\/span> sklearn. <span style=\"color: #3366ff;\">model_selection<\/span> <span style=\"color: #008000;\">import<\/span> train_test_split\n<span style=\"color: #008000;\">from<\/span> sklearn. <span style=\"color: #3366ff;\">linear_model<\/span> <span style=\"color: #008000;\">import<\/span> LogisticRegression\n<span style=\"color: #008000;\">from<\/span> sklearn <span style=\"color: #008000;\">import<\/span> metrics\n<span style=\"color: #008000;\">import<\/span> matplotlib. <span style=\"color: #3366ff;\">pyplot<\/span> <span style=\"color: #008000;\">as<\/span> plt\n<\/strong><\/pre>\n<h3><span style=\"color: #000000;\"><strong>\u30b9\u30c6\u30c3\u30d7 2: \u30c7\u30fc\u30bf\u3092\u30ed\u30fc\u30c9\u3059\u308b<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u3053\u306e\u4f8b\u3067\u306f\u3001 <a href=\"https:\/\/www.ime.unicamp.br\/~dias\/Intoduction%20to%20Statistical%20Learning.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">\u66f8\u7c4d\u300e\u7d71\u8a08\u5b66\u7fd2\u5165\u9580\u300f<\/a>\u306e<strong>\u30c7\u30d5\u30a9\u30eb\u30c8<\/strong>\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u6b21\u306e\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3001\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u6982\u8981\u3092\u8aad\u307f\u8fbc\u3093\u3067\u8868\u793a\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#import dataset from CSV file on Github\n<span style=\"color: #000000;\">url = \"https:\/\/raw.githubusercontent.com\/Statorials\/Python-Guides\/main\/default.csv\"\ndata = pd. <span style=\"color: #3366ff;\">read_csv<\/span> (url)\n<\/span><\/span>\n<span style=\"color: #008080;\">#view first six rows of dataset\n<\/span>data[0:6]\n\n        default student balance income\n0 0 0 729.526495 44361.625074\n1 0 1 817.180407 12106.134700\n2 0 0 1073.549164 31767.138947\n3 0 0 529.250605 35704.493935\n4 0 0 785.655883 38463.495879\n5 0 1 919.588530 7491.558572  \n\n<span style=\"color: #008080;\">#find total observations in dataset<\/span>\nlen( <span style=\"color: #3366ff;\">data.index<\/span> )\n\n10000\n<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u3053\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306b\u306f\u300110,000 \u4eba\u306e\u500b\u4eba\u306b\u95a2\u3059\u308b\u6b21\u306e\u60c5\u5831\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002<\/span><\/p>\n<ul>\n<li><span style=\"color: #000000;\"><strong>\u30c7\u30d5\u30a9\u30eb\u30c8:<\/strong>\u500b\u4eba\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u3057\u305f\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059\u3002<\/span><\/li>\n<li><span style=\"color: #000000;\"><strong>\u5b66\u751f:<\/strong>\u500b\u4eba\u304c\u5b66\u751f\u3067\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059\u3002<\/span><\/li>\n<li><span style=\"color: #000000;\"><strong>\u6b8b\u9ad8:<\/strong>\u500b\u4eba\u304c\u4fdd\u6709\u3059\u308b\u5e73\u5747\u6b8b\u9ad8\u3002<\/span><\/li>\n<li><span style=\"color: #000000;\"><strong>\u53ce\u5165\uff1a<\/strong>\u500b\u4eba\u306e\u53ce\u5165\u3002<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">\u5b66\u751f\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u3001\u9280\u884c\u6b8b\u9ad8\u3001\u53ce\u5165\u3092\u4f7f\u7528\u3057\u3066\u3001\u7279\u5b9a\u306e\u500b\u4eba\u304c\u50b5\u52d9\u4e0d\u5c65\u884c\u306b\u306a\u308b\u78ba\u7387\u3092\u4e88\u6e2c\u3059\u308b\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u30e2\u30c7\u30eb\u3092\u69cb\u7bc9\u3057\u307e\u3059\u3002<\/span><\/p>\n<h3><span style=\"color: #000000;\"><strong>\u30b9\u30c6\u30c3\u30d7 3: \u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u304a\u3088\u3073\u30c6\u30b9\u30c8\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u6b21\u306b\u3001\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u3001\u30e2\u30c7\u30eb\u3092<em>\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u3059\u308b<\/em>\u305f\u3081\u306e\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0 \u30bb\u30c3\u30c8\u3068\u3001\u30e2\u30c7\u30eb\u3092<em>\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306e<\/em>\u30c6\u30b9\u30c8 \u30bb\u30c3\u30c8\u306b\u5206\u5272\u3057\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#define the predictor variables and the response variable\n<\/span>X = data[[' <span style=\"color: #008000;\">student<\/span> ',' <span style=\"color: #008000;\">balance<\/span> ',' <span style=\"color: #008000;\">income<\/span> ']]\ny = data[' <span style=\"color: #008000;\">default<\/span> ']\n\n<span style=\"color: #008080;\">#split the dataset into training (70%) and testing (30%) sets\n<\/span>X_train,X_test,y_train,y_test = <span style=\"color: #3366ff;\">train_test_split<\/span> (X,y,test_size=0.3,random_state=0)<\/strong><\/pre>\n<h3><span style=\"color: #000000;\"><strong>\u30b9\u30c6\u30c3\u30d7 4: \u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u30e2\u30c7\u30eb\u3092\u5f53\u3066\u306f\u3081\u308b<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u6b21\u306b\u3001 <b>LogisticRegression()<\/b>\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u3001\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u30e2\u30c7\u30eb\u3092\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306b\u9069\u5408\u3055\u305b\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#instantiate the model\n<\/span>log_regression = LogisticRegression()\n\n<span style=\"color: #008080;\">#fit the model using the training data\n<\/span>log_regression. <span style=\"color: #3366ff;\">fit<\/span> (X_train,y_train)\n\n<span style=\"color: #008080;\">#use model to make predictions on test data\n<\/span>y_pred = log_regression. <span style=\"color: #3366ff;\">predict<\/span> (X_test)\n<\/strong><\/pre>\n<h3><span style=\"color: #000000;\"><strong>\u30b9\u30c6\u30c3\u30d7 5: \u30e2\u30c7\u30eb\u306e\u8a3a\u65ad<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u56de\u5e30\u30e2\u30c7\u30eb\u3092\u9069\u5408\u3055\u305b\u305f\u3089\u3001\u30c6\u30b9\u30c8 \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3067\u306e\u30e2\u30c7\u30eb\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5206\u6790\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<p>\u307e\u305a\u3001<span style=\"color: #000000;\">\u30e2\u30c7\u30eb\u306e<\/span><span style=\"color: #000000;\">\u6df7\u540c\u884c\u5217\u3092\u4f5c\u6210\u3057\u307e\u3059<\/span>\u3002<\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong>cnf_matrix = metrics. <span style=\"color: #3366ff;\">confusion_matrix<\/span> (y_test, y_pred)\ncnf_matrix\n\narray([[2886, 1],\n       [113,0]])\n<\/strong><\/span><\/pre>\n<p><span style=\"color: #000000;\">\u6df7\u540c\u884c\u5217\u304b\u3089\u6b21\u306e\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\">#\u771f\u967d\u6027\u4e88\u6e2c: 2886<\/span><\/li>\n<li> <span style=\"color: #000000;\">#\u771f\u9670\u6027\u4e88\u6e2c: 0<\/span><\/li>\n<li> <span style=\"color: #000000;\">#\u8aa4\u691c\u77e5\u4e88\u6e2c: 113<\/span><\/li>\n<li> <span style=\"color: #000000;\">#\u507d\u9670\u6027\u4e88\u6e2c: 1<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">\u307e\u305f\u3001\u30e2\u30c7\u30eb\u306b\u3088\u3063\u3066\u884c\u308f\u308c\u305f\u4fee\u6b63\u4e88\u6e2c\u306e\u5272\u5408\u3092\u793a\u3059\u7cbe\u5ea6\u30e2\u30c7\u30eb\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>print(\" <span style=\"color: #008000;\">Accuracy:<\/span> \", <span style=\"color: #3366ff;\">metrics.accuracy_score<\/span> (y_test, y_pred))l\n\nAccuracy: 0.962\n<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u3053\u308c\u306f\u3001\u500b\u4eba\u304c<strong>96.2%<\/strong>\u306e\u78ba\u7387\u3067\u30c7\u30d5\u30a9\u30eb\u30c8\u3059\u308b\u304b\u3069\u3046\u304b\u306b\u3064\u3044\u3066\u3001\u30e2\u30c7\u30eb\u304c\u6b63\u3057\u3044\u4e88\u6e2c\u3092\u884c\u3063\u305f\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u6700\u5f8c\u306b\u3001\u4e88\u6e2c\u78ba\u7387\u306e\u3057\u304d\u3044\u5024\u3092 1 \u304b\u3089 0 \u306b\u4e0b\u3052\u305f\u5834\u5408\u306b\u3001\u30e2\u30c7\u30eb\u306b\u3088\u3063\u3066\u4e88\u6e2c\u3055\u308c\u308b\u771f\u967d\u6027\u306e\u5272\u5408\u3092\u8868\u793a\u3059\u308b\u53d7\u4fe1\u8005\u52d5\u4f5c\u7279\u6027 (ROC) \u66f2\u7dda\u3092\u30d7\u30ed\u30c3\u30c8\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<p> <span style=\"color: #000000;\">AUC (\u66f2\u7dda\u4e0b\u9762\u7a4d) \u304c\u9ad8\u3044\u307b\u3069\u3001\u30e2\u30c7\u30eb\u306f\u3088\u308a\u6b63\u78ba\u306b\u7d50\u679c\u3092\u4e88\u6e2c\u3067\u304d\u307e\u3059\u3002<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#define metrics<\/span>\ny_pred_proba = log_regression. <span style=\"color: #3366ff;\">predict_proba<\/span> (X_test)[::,1]\nfpr, tpr, _ = metrics. <span style=\"color: #3366ff;\">roc_curve<\/span> (y_test, y_pred_proba)\nauc = metrics. <span style=\"color: #3366ff;\">roc_auc_score<\/span> (y_test, y_pred_proba)\n\n<span style=\"color: #008080;\">#create ROC curve\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (fpr,tpr,label=\" <span style=\"color: #008000;\">AUC=<\/span> \"+str(auc))\nplt. <span style=\"color: #3366ff;\">legend<\/span> (loc=4)\nplt. <span style=\"color: #3366ff;\">show<\/span> ()\n<\/strong><\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11591 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/auc1.png\" alt=\"Python \u306e ROC \u66f2\u7dda\" width=\"389\" height=\"262\" srcset=\"\" sizes=\"auto, \"><\/p>\n<div class=\"entry-content entry-content-single\" data-content-ads-inserted=\"true\">\n<p><em><span style=\"color: #000000;\">\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u4f7f\u7528\u3055\u308c\u308b\u5b8c\u5168\u306a Python \u30b3\u30fc\u30c9\u306f\u3001 <a href=\"https:\/\/github.com\/Statorials\/Python-Guides\/blob\/main\/logistic_regression.py\" target=\"_blank\" rel=\"noopener noreferrer\">\u3053\u3053\u306b<\/a>\u3042\u308a\u307e\u3059\u3002<\/span><\/em><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u306f\u3001 \u5fdc\u7b54\u5909\u6570\u304c\u30d0\u30a4\u30ca\u30ea\u306e\u5834\u5408\u306b\u56de\u5e30\u30e2\u30c7\u30eb\u3092\u8fd1\u4f3c\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3067\u304d\u308b\u65b9\u6cd5\u3067\u3059\u3002 \u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3067\u306f\u3001\u6700\u5c24\u63a8\u5b9a\u3068\u3057\u3066\u77e5\u3089\u308c\u308b\u65b9\u6cd5\u3092\u4f7f\u7528\u3057\u3066\u3001\u6b21\u306e\u5f62\u5f0f\u306e\u65b9\u7a0b\u5f0f\u3092\u6c42\u3081\u307e\u3059\u3002 log[p(X) \/ ( 1  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-1154","post","type-post","status-publish","format-standard","hentry","category-16"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 (\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7) - Statorials<\/title>\n<meta name=\"description\" content=\"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u3092\u3001\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7\u306e\u4f8b\u3092\u542b\u3081\u3066\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/ja\/\u30ed\u30b7\u3099\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30python\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 (\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7) - Statorials\" \/>\n<meta property=\"og:description\" content=\"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u3092\u3001\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7\u306e\u4f8b\u3092\u542b\u3081\u3066\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/ja\/\u30ed\u30b7\u3099\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30python\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T11:31:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/auc1.png\" \/>\n<meta name=\"author\" content=\"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/\",\"url\":\"https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/\",\"name\":\"Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 (\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7) - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/ja\/#website\"},\"datePublished\":\"2023-07-27T11:31:28+00:00\",\"dateModified\":\"2023-07-27T11:31:28+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/ja\/#\/schema\/person\/86b92d2dd87368b26360d19d9c6a5d83\"},\"description\":\"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u3092\u3001\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7\u306e\u4f8b\u3092\u542b\u3081\u3066\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u5bb6\",\"item\":\"https:\/\/statorials.org\/ja\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 (\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/ja\/#website\",\"url\":\"https:\/\/statorials.org\/ja\/\",\"name\":\"Statorials\",\"description\":\"\u7d71\u8a08\u80fd\u529b\u3078\u306e\u30ac\u30a4\u30c9\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/ja\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/ja\/#\/schema\/person\/86b92d2dd87368b26360d19d9c6a5d83\",\"name\":\"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/statorials.org\/ja\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/ja\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/ja\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb\"},\"description\":\"\u79c1\u306f\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u3067\u3059\u3002\u9000\u8077\u3057\u305f\u7d71\u8a08\u6559\u6388\u304b\u3089\u3001\u5c02\u4efb\u306e Statorials \u6559\u80b2\u8005\u306b\u306a\u308a\u307e\u3057\u305f\u3002 \u7d71\u8a08\u5206\u91ce\u306b\u304a\u3051\u308b\u8c4a\u5bcc\u306a\u7d4c\u9a13\u3068\u5c02\u9580\u77e5\u8b58\u3092\u6d3b\u304b\u3057\u3066\u3001\u79c1\u306f Statorials \u3092\u901a\u3058\u3066\u5b66\u751f\u306b\u529b\u3092\u4e0e\u3048\u308b\u305f\u3081\u306b\u81ea\u5206\u306e\u77e5\u8b58\u3092\u5171\u6709\u3059\u308b\u3053\u3068\u306b\u5c3d\u529b\u3057\u3066\u3044\u307e\u3059\u3002\u3082\u3063\u3068\u77e5\u308b\",\"sameAs\":[\"http:\/\/statorials.org\/ja\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 (\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7) - Statorials","description":"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u3092\u3001\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7\u306e\u4f8b\u3092\u542b\u3081\u3066\u8aac\u660e\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statorials.org\/ja\/\u30ed\u30b7\u3099\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30python\/","og_locale":"ja_JP","og_type":"article","og_title":"Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 (\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7) - Statorials","og_description":"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u3092\u3001\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7\u306e\u4f8b\u3092\u542b\u3081\u3066\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/statorials.org\/ja\/\u30ed\u30b7\u3099\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30python\/","og_site_name":"Statorials","article_published_time":"2023-07-27T11:31:28+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/auc1.png"}],"author":"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"1\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/","url":"https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/","name":"Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 (\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7) - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/ja\/#website"},"datePublished":"2023-07-27T11:31:28+00:00","dateModified":"2023-07-27T11:31:28+00:00","author":{"@id":"https:\/\/statorials.org\/ja\/#\/schema\/person\/86b92d2dd87368b26360d19d9c6a5d83"},"description":"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u3092\u3001\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7\u306e\u4f8b\u3092\u542b\u3081\u3066\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/ja\/%e3%83%ad%e3%82%b7%e3%82%99%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%af%e5%9b%9e%e5%b8%b0python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u5bb6","item":"https:\/\/statorials.org\/ja\/"},{"@type":"ListItem","position":2,"name":"Python \u3067\u30ed\u30b8\u30b9\u30c6\u30a3\u30c3\u30af\u56de\u5e30\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5 (\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7)"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/ja\/#website","url":"https:\/\/statorials.org\/ja\/","name":"Statorials","description":"\u7d71\u8a08\u80fd\u529b\u3078\u306e\u30ac\u30a4\u30c9","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/ja\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/statorials.org\/ja\/#\/schema\/person\/86b92d2dd87368b26360d19d9c6a5d83","name":"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/statorials.org\/ja\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/ja\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/ja\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u30fb\u30a2\u30f3\u30c0\u30fc\u30bd\u30f3\u535a\u58eb"},"description":"\u79c1\u306f\u30d9\u30f3\u30b8\u30e3\u30df\u30f3\u3067\u3059\u3002\u9000\u8077\u3057\u305f\u7d71\u8a08\u6559\u6388\u304b\u3089\u3001\u5c02\u4efb\u306e Statorials \u6559\u80b2\u8005\u306b\u306a\u308a\u307e\u3057\u305f\u3002 \u7d71\u8a08\u5206\u91ce\u306b\u304a\u3051\u308b\u8c4a\u5bcc\u306a\u7d4c\u9a13\u3068\u5c02\u9580\u77e5\u8b58\u3092\u6d3b\u304b\u3057\u3066\u3001\u79c1\u306f Statorials \u3092\u901a\u3058\u3066\u5b66\u751f\u306b\u529b\u3092\u4e0e\u3048\u308b\u305f\u3081\u306b\u81ea\u5206\u306e\u77e5\u8b58\u3092\u5171\u6709\u3059\u308b\u3053\u3068\u306b\u5c3d\u529b\u3057\u3066\u3044\u307e\u3059\u3002\u3082\u3063\u3068\u77e5\u308b","sameAs":["http:\/\/statorials.org\/ja"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/posts\/1154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/comments?post=1154"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/posts\/1154\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/media?parent=1154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/categories?post=1154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/ja\/wp-json\/wp\/v2\/tags?post=1154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}