When the index values are customized, they are accessed using series_name[‘index_value’].The ‘index_value’ passed to series is tried to be matched to the original series. If it is found, that corresponding data is also displayed on the console.Let us see how multiple elements can be displayed.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) print("Accessing multiple elements using customized index") print(my_series[['mn', 'az', 'wq', 'ab']])OutputThe series contains following elements ab 34 mn 56 gh 78 kl 90 wq ... Read More
Scalar or constant values are defined once, and they are repeated across all rows/entries of the series data structure. Following is an example −Example Live Demoimport pandas as pd my_index = ['ab', 'mn' ,'gh', 'kl'] my_series = pd.Series(7, index = my_index) print("This is series data structure created using scalar values and specifying index values") print(my_series)OutputThis is series data structure created using scalar values and specifying index values ab 7 mn 7 gh 7 kl 7 dtype: int64ExplanationThe required libraries are imported, and their alias are given so that it is easy to use them.A list of index ... 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.Scatter plot shows the distribution of data as data points that are spread/scattered on the graph. It uses dots to represents values of a dataset, which are numeric in nature. The position of every dot on the horizontal and vertical axis denotes the value for a single data point.They help understand the relationship between two variables. Let us understand how this can be achieved using ... Read More
Let us see how a series data structure can be created with the help of a Numpy array, and explicitly giving values for ‘index’.When no value is specified for index, default values beginning from 0 are assigned to values in the series.Following is an example −Example Live Demoimport pandas as pd import numpy as np my_data = np.array(['ab', 'bc', 'cd', 'de', 'ef', 'fg', 'gh', 'hi']) my_index = [3, 5, 7, 9, 11, 23, 45, 67] my_series = pd.Series(my_data, index = my_index) print("This is series data structure created using Numpy array and specifying index values") print(my_series)OutputThis is series data structure created using ... Read More
A neuron is a mathematical function that takes one or more values as input and outputs a ingle numerical value −It can be defined as follows −Here, ‘f’ refers to the function.We first computed the weighted sum of the inputs xi and the weights wiThe weight wi is also known as the activation value or activation function.The input xi can be a numerical value that represents the input data or it can be an output from other neurons if the neuron belong to a neural network.The weight wi is a numerical value that can be used to represent the strength ... Read More
A neural network can be understood as a network of hidden layers, an input layer and an output layer that tries to mimic the working of a human brain.The hidden layers can be visualized as an abstract representation of the input data itself. These layers help the neural network understand various features of the data with the help of its own internal logic.These neural networks are non-interpretable models. Non-interpretable models are those which can’t be interpreted or understood even if we observe the hidden layers. This is because the neural networks have an internal logic working on its own, that ... Read More
The basic example of a neural network is a ‘perceptron’. It was invented by Frank Rosenblatt in 1957. The perceptron is a classification algorithm similar to logistic regression. This because, similar to logistic regression, a perceptron has weights, w, and an output function, ‘f’, which is a dot product of the weights and the input.The only difference is that ‘f’ is a simple step function, where a logistic regression rule is applied to the output of the logistic function. On the other hand, perceptron can be understood as an example of a simple one-layer neural feedforward network.The perceptron was considered ... Read More
Neural networks have been around for many years, through which they have been praised as well as criticised for their characteristics.But off late, they have gained attention over other machine learning algorithms. Of course, Machine learning algorithms are important as they help achieve certain goals. But what should we do when machine learning algorithms can’t achieve higher accuracy?This is where deep learning algorithms come into play. They mimic the layers of the human brain, and try to take optimal decisions by passing an input from one layer to the next.Neural networks, as the name suggests, tries to follow the pattern ... Read More
We previously understood how Q-learning works, with the help of Q-value and Q-table. Q-learning is a type of reinforcement learning algorithm that contains an ‘agent’ that takes actions required to reach the optimal solution. This is achieved with the help of Q-table that is present as a neural network. It helps take the right step that maximizes the reward, thereby reaching the optimal solution.Now, let us see how the agent uses the policy to decide on the next step that it needs to take to achieve optimum results.The policy considers the Q-values of all possible actions that could be taken, ... Read More
Q-learning is a type of reinforcement learning algorithm that contains an ‘agent’ that takes actions required to reach the optimal solution.Reinforcement learning is a part of the ‘semi-supervised’ machine learning algorithms. When an input dataset is provided to a reinforcement learning algorithm, it learns from such a dataset, otherwise it learns from its experiences and surroundings.When the ‘reinforcement agent’ performs an action, it is awarded or punished (awards and punishments are different, as they depend on the data available in hand) based on whether it predicted correctly (or took the right path or took a path that was least expensive).If ... Read More