Skip to content

Commit

Permalink
Update Fraud Detection so it can be used in Colab
Browse files Browse the repository at this point in the history
  • Loading branch information
fisher85 committed Nov 15, 2020
1 parent b094f28 commit c1b83c8
Showing 1 changed file with 25 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"metadata": {},
"outputs": [],
"source": [
"# Read in the data from the CSV file\n",
"df = pd.read_csv('payment_fraud.csv')"
"# Read the data from the CSV file\n",
"df = pd.read_csv('https://raw.githubusercontent.com/fisher85/ml-cybersecurity/master/python-logistic-regression-fraud-detection/payment_fraud.csv')"
]
},
{
Expand Down Expand Up @@ -994,33 +994,33 @@
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>4692</td>\n",
" <td>39</td>\n",
" <td>24428</td>\n",
" <td>72</td>\n",
" <td>1</td>\n",
" <td>4.962055</td>\n",
" <td>0.001389</td>\n",
" <td>0</td>\n",
" <td>4.921318</td>\n",
" <td>71.091667</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <td>5279</td>\n",
" <td>14</td>\n",
" <td>34769</td>\n",
" <td>28</td>\n",
" <td>1</td>\n",
" <td>4.745402</td>\n",
" <td>4.876771</td>\n",
" <td>0.000000</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <td>10430</td>\n",
" <td>2000</td>\n",
" <td>26432</td>\n",
" <td>1840</td>\n",
" <td>1</td>\n",
" <td>4.962055</td>\n",
" <td>1010.061111</td>\n",
" <td>5.034622</td>\n",
" <td>36.324306</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
Expand All @@ -1032,19 +1032,19 @@
],
"text/plain": [
" accountAgeDays numItems localTime paymentMethodAgeDays label \\\n",
"4692 39 1 4.962055 0.001389 0 \n",
"5279 14 1 4.745402 0.000000 0 \n",
"10430 2000 1 4.962055 1010.061111 0 \n",
"24428 72 1 4.921318 71.091667 0 \n",
"34769 28 1 4.876771 0.000000 0 \n",
"26432 1840 1 5.034622 36.324306 0 \n",
"\n",
" paymentMethod_creditcard paymentMethod_paypal \\\n",
"4692 0 1 \n",
"5279 1 0 \n",
"10430 1 0 \n",
"24428 1 0 \n",
"34769 1 0 \n",
"26432 1 0 \n",
"\n",
" paymentMethod_storecredit \n",
"4692 0 \n",
"5279 0 \n",
"10430 0 "
"24428 0 \n",
"34769 0 \n",
"26432 0 "
]
},
"execution_count": 7,
Expand Down Expand Up @@ -1075,19 +1075,10 @@
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"D:\\MachineLearning\\Anaconda3\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
" FutureWarning)\n"
]
}
],
"outputs": [],
"source": [
"# Initialize and train classifier model\n",
"clf = LogisticRegression().fit(X_train, y_train)\n",
"clf = LogisticRegression(solver='lbfgs').fit(X_train, y_train)\n",
"\n",
"# Make predictions on test set\n",
"y_pred = clf.predict(X_test)"
Expand Down

0 comments on commit c1b83c8

Please sign in to comment.