Let us understand how the slicing operator ‘:’ can be used to access elements within a certain range.Example Live Demoimport pandas as pd my_data = [34, 56, 78, 90, 123, 45] my_index = ['ab', 'mn' ,'gh', 'kl', 'wq', 'az'] my_series = pd.Series(my_data, index = my_index) print("The series contains following elements") print(my_series) n = 3 print("Bottom 3 elements are :") print(my_series[n:])OutputThe series contains following elements ab 34 mn 56 gh 78 kl 90 wq 123 az 45 dtype: int64 Bottom 3 elements are : kl 90 wq 123 az 45 dtype: int64ExplanationThe required libraries are imported, and given alias names for ease ... Read More
The determinant value can be calculated on a matrix or on an array that has more than one dimension.It may sometimes be required to understand the marix/array better. This is where the determinant operation would be needed.SciPy offers a function named ‘det’ that is present in the ‘linalg’ class which is short for ‘Linear Algebra’.Syntax of ‘det’ functionscipy.linalg.det(matrix)The ‘matrix’ is the parameter that is passed to the ‘det’ function to find its determinant value.This function can be called by passing the matrix/array as an argument.In the above picture, assume that ‘a’, ‘b’, ‘c’ and ‘d’ are numeric values of a ... Read More
The process of converting a range of values into standardized range of values is known as normalization. These values could be between -1 to +1 or 0 to 1. Data can be normalized with the help of subtraction and division as well.Data fed to the learning algorithm as input should remain consistent and structured. All features of the input data should be on a single scale to effectively predict the values. But in real-world, data is unstructured, and most of the times, not on the same scale.This is when normalization comes into picture. It is one of the most important ... Read More
Feature scaling is an important step in the data pre-processing stage in building machine learning algorithms. It helps normalize the data to fall within a specific range.At times, it also helps in increasing the speed at which the calculations are performed by the machine.Why it is needed?Data fed to the learning algorithm as input should remain consistent and structured. All features of the input data should be on a single scale to effectively predict the values. But in real-world, data is unstructured, and most of the times, not on the same scale.This is when normalization comes into picture. It is ... Read More
Pre-processing data refers to cleaning of data, removing invalid data, noise, replacing data with relevant values and so on.Data pre-processing basically refers to the task of gathering all the data (which is collected from various resources or a single resource) into a common format or into uniform datasets (depending on the type of data). The output of one step becomes the input to the next step and so on.Mean values might have to be removed from input data to get specific result. Let us understand how it can be achieved using scikit-learn library.Exampleimport numpy as np from sklearn import preprocessing ... Read More
Decision tree is the basic building block of the random forest algorithm. It is considered as one of the most popular algorithms in machine learning and is used for classification purposes. The decision given out by a decision tree can be used to explain why a certain prediction was made. This means the in and out of the process would be clear to the user. They are also known as CART, i.e Classification And Regression Trees. It can be visualized as a binary tree (the one studied in data structures and algorithms).Every node in the tree represents a single input ... Read More
Scikit-learn, commonly known as sklearn is a library in Python that is used for the purpose of implementing machine learning algorithms. It is powerful and robust, since it provides a wide variety of tools to perform statistical modelling.This includes classification, regression, clustering, dimensionality reduction, and much more with the help of a powerful, and stable interface in Python. Built on Numpy, SciPy and Matplotlib libraries.Before passing the input data to the Machine Learning algorithm, it has to be split into training and test dataset.Once the data is fit to the chosen model, the input dataset is trained on this model. ... Read More
Visualizing data is an important step since it helps understand what is going on in the data without actually looking at the numbers and performing complicated computations. Seaborn is a library that helps in visualizing data. It comes with customized themes and a high level interface.General scatter plots, histograms, etc can’t be used when the variables that need to be worked with are categorical in nature. This is when categorical scatterplots need to be used.Plots such as ‘stripplot’, ‘swarmplot’ are used to work with categorical variables. The ‘stripplot’ function is used when atleast one of the variables is categorical. The ... Read More
Data present in large amounts needs to be dealt with properly. This is why computers with large capacities are used. Scientific and technical computations of large datasets can be done with the help of a library in Python known as SciPy. SciPy is short of ‘Scientific Python’.The Numpy library in Python is a pre-requisite to SciPy because SciPy is built on top of Numpy. Ensure that Numpy library is installed before installing SciPy library. It is an open-source software that is easily available to install and use.It has many features of data science and machine learning that are required to ... Read More
Visualizing data is an important step since it helps understand what is going on in the data without actually looking at the numbers and performing complicated computations. Seaborn is a library that helps in visualizing data. It comes with customized themes and a high-level interface.Kernel Density Estimation, also known as KDE is a method in which the probability density function of a continuous random variable can be estimated.This method is used for the analysis of the non-parametric values. While using ‘distplot’, if the argument ‘kde’ is set to True and ‘hist’ is set to False, the KDE can be visualized.Let ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP