Jupyter Notebook Edit mode and Command mode

There are two different working modes for the Jupyter Notebook.Therefore , the same keyboard key press has different effect, depending on which mode the notebook is in currently.There are two modes: Edit mode When in edit mode of jupyter notebook, you can type code and text. we can enter this mode, by pressing enter or … Continue reading Jupyter Notebook Edit mode and Command mode

Difference Between Batch, Mini-Batch and Stochastic Gradient Descent

Gradient Descent is one the key algorithm used in Machine Learning. While training machine learning model, we require an algorithm to minimize the value of loss function. Gradient Descent is one of the optimization algorithm , that is used to minimize the loss. There are mainly three types of Gradient Descent algorithm1. Batch Gradient DescentBatch … Continue reading Difference Between Batch, Mini-Batch and Stochastic Gradient Descent

How to write command-line arguments using argparse in python

If you want to run a .py python file from command line and you also want to pass the argument using command line you can use argparse library. This can be done as below: import argparse # Command Line arguments argp = argparse.ArgumentParser() argp.add_argument('--my_var', dest="my_var", action="store", type=int, default=5) params = argp.parse_args() myvar= params.my_var print(myvar) Then … Continue reading How to write command-line arguments using argparse in python

Decision Tree vs Linear Regression

Decision Tree can be used for implementing regression as well as classification models, however , Linear Regression can be used for regression problem only. Decision tree can be used for regression, even when there is non linear relationships between the features and the output variable.¬†However, Linear Regression works really nicely when there is linear relationship … Continue reading Decision Tree vs Linear Regression

Using torchvision transforms for data augmentation

Transforms are common image transformations. torchvision transforms are used to augment the data with scaling, rotations, mirroring, cropping etc. Transforms are common image transformations.  Let us create some possible transforms like RandomRotation , Resize, RandomResizedCrop etc. Below is the code to use transforms for the training, validation, and testing sets transforms.Compose([transforms.Resize(224),transforms.CenterCrop(64),transforms.ToTensor()]) Most neural networks expect the … Continue reading Using torchvision transforms for data augmentation