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

# Author: BotBark

# Difference between Variance and Covariance

Variance is the measure of, the spread between numbers, in a given data set. In other words, it means, how far each number in the data set is, from the mean of this data set. 2. Covariance is the measure of, the directional relationship between, two random variables. In other words, covariance measures, how much, … Continue reading Difference between Variance and Covariance

# 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

# Pandas Groupby apply Function on each Group Item

Here we are trying to write a solution for Group by COULUMN_2 Sum the COULUMN_1 values in each group and divide each COULUMN_1 values by Sum of it's group total. # using transform function df_new = df[['COULUMN_1','COULUMN_2']] grp = df_new.groupby('COULUMN_2') sc = lambda x: (x) / x.sum() # sum the COULUMN_1 values in each group … Continue reading Pandas Groupby apply Function on each Group Item

# 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

# Handling missing data in pandas data frame python

In this post we are going to discuss how to handle missing data from a pandas data frame. Find total number of missing data in the data frame missing_total = df.isnull().sum().sum() Find number of missing data in each column in a data frame missing_per_column = df.isnull().sum() Investigate patterns in the amount of missing data in … Continue reading Handling missing data in pandas data frame python

# 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

# int object is not iterable Error

If your code is like below count = 100 for number in count: This will give you error like.. int object is not iterable. In Python, the thing you pass to a for statement needs to be some kind of iterable object. The variable count here is a number which is not iterable. You should … Continue reading int object is not iterable Error

# Visualize or Print Random Forest Algorithm Model

As a machine learning engineer you may have created the Random Forest Algorithm Model, but have you ever tried to visualize it. If not , this is the post for you. In this post we will learn how to Visualize or Print Random Forest Algorithm Model in Jupyter notebook. Let us import the required library: … Continue reading Visualize or Print Random Forest Algorithm Model