Skip to content

mayank-aggrwal/Credit_Card_Fraud_Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💻 Credit Card Fraud Detection

Detecting Credit Card fraudulent transactions using Machine Learning It is important that credit card companies are able to recognize fraudulent credit card transactions so that customers are not charged for items that they did not purchase.

Dataset used is from Kaggle - https://www.kaggle.com/mlg-ulb/creditcardfraud The dataset contains transactions made by credit cards in September 2013 by European cardholders. This dataset presents transactions that occurred in two days, where we have 492 frauds out of 284,807 transactions. The dataset is highly unbalanced, the positive class (frauds) account for 0.172% of all transactions. Features V1, V2, … V28 are the principal components obtained with PCA, the only features which have not been transformed with PCA are 'Time' and 'Amount'. Feature 'Time' contains the seconds elapsed between each transaction and the first transaction in the dataset. The feature 'Amount' is the transaction Amount, this feature can be used for example-dependant cost-sensitive learning. Feature 'Class' is the response variable and it takes value 1 in case of fraud and 0 otherwise.

Installation

  1. Make sure python3 and git is installed. Install Python : From official website
  2. Clone this repository to your local machine.
  3. Run the following command for installing all the required dependencies all at once-
py -m pip install -r requirements.txt
  1. Download the dataset file creditcard.csv from Kaggle link provided above.
  2. Run fraud_detection.ipynb in a jupyter notebook
jupyter notebook fraud_detection.ipynb

Additional instructions

Install Python :

From official website

To check version of Python :

py --version
python --version

Create a virtual environment :

py -m venv blog_app

To activate virtual-environment :

.\Scripts\activate

To deactivate virtual-environment :

.\Scripts\deactivate

To check python is used in virtualenv :

pip -V

If you are running the virtual env, it'll show the path to the environment's location.

To install a package in virtual environment :

py -m pip install package_name

To install django :

py -m pip install django
django --version

To check django version :

py -m django --version

To start a new app :

python manage.py startapp your_app_name

Then make an entry for the app in the INSTALLED_APPS section in settings.py Include URL's of your new app using include() in url.py (main app)

While activating if terminal shows, "running scripts is disabled on this system"

There are 4 policy levels to choose from. From most secure to most insecure:

  1. Restricted: No Powershell scripts can be run. This is the default setting.

  2. AllSigned: Scripts can be run, but all must have a digital signature. Even if you wrote the script yourself on the local computer.

  3. RemoteSigned: Locally-written scripts can be run. But scripts from outside (email, IM, Internet) must be signed by a trusted publisher.

  4. Unrestricted: Any script will run. Regardless of who created them or whether they are signed.

    To view the current systemwide Execution Policy setting :

    Get-ExecutionPolicy

    To set execution policy :

    Set-ExecutionPolicy remotesigned

Touch alternative in windows powershell :

$null > file_name.cpp

Configure GIT :

git config --global user.email "user_mail"
git config --global user.name "user_name"
NOTE: Make .gitignore file after initialising the GIT repository

To run the application server :

python manage.py runserver

For migrating the models to the database :

python manage.py makemigrations
python manage.py migrate

While making a POST request through a form to the server, include :

{% csrf_token %}

To checkout a particular branch:

git checkout <branch-name>

To list all the branches in the git repository:

git branch -a

To lists all the modules installed for the project:

py -m pip freeze
py -m pip list

To merge a branch into master branch:

Change to master branch

git checkout master
git merge <branch-name>

To see branch graphs in git:

git log --graph --oneline --decorate --all

To see all remotes

git remote -v

To push all branches to remote repository

git push --all <remote-origin>

To add a new remote to push changes to

git remote add new-remote-origin-name https://github.com/user_name/repo.git

If you happen to delete db.sqlite3 file, run:

python manage.py migrate

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Releases

No releases published

Packages

No packages published