Gaurav Kumar has Published 49 Articles

Implementing K-means clustering with SciPy by splitting random data in 3 clusters?

Gaurav Kumar

Gaurav Kumar

Updated on 14-Dec-2021 08:48:44

119 Views

Yes, we can also implement a K-means clustering algorithm by splitting the random data in 3 clusters. Let us understand with the example below −Example#importing the required Python libraries: import numpy as np from numpy import vstack, array from numpy.random import rand from scipy.cluster.vq import whiten, kmeans, vq from pylab ... Read More

Implementing K-means clustering with SciPy by splitting random data in 2 clusters?

Gaurav Kumar

Gaurav Kumar

Updated on 14-Dec-2021 08:42:53

294 Views

K-means clustering algorithm, also called flat clustering, is a method of computing the clusters and cluster centers (centroids) in a set of unlabeled data. It iterates until we find the optimal centroid. The clusters, we might think of a group of data points whose inter-point distances are small as compared ... Read More

What is scipy cluster hierarchy? How to cut hierarchical clustering into flat clustering?

Gaurav Kumar

Gaurav Kumar

Updated on 25-Nov-2021 07:05:23

465 Views

The scipy.cluster.hierarchy module provides functions for hierarchical clustering and its types such as agglomerative clustering. It has various routines which we can use to −Cut hierarchical clustering into the flat clustering.Implement agglomerative clustering.Compute statistics on hierarchiesVisualize flat clustering.To check isomorphism of two flat cluster assignments.Plot the clusters.The routine scipy.cluster.hierarchy.fcluster is ... Read More

Which linear function of SciPy is used to solve a banded matrix equation?

Gaurav Kumar

Gaurav Kumar

Updated on 25-Nov-2021 06:50:00

280 Views

The linear function named scipy.linalg.solve_banded is used to solve the banded matrix equation. The form of this function is as follows −scipy.linalg.solve_banded(l_and_u, ab, b, overwrite_ab=False, overwrite_b=False, debug=None, check_finite=True)This linear function will solve the equation ax = b for x where a is a banded matrix.The banded matrix a is stored ... Read More

What is scipy.cluster.hierarchy.fcluster()method?

Gaurav Kumar

Gaurav Kumar

Updated on 25-Nov-2021 06:43:02

1K+ Views

scipy.cluster.hierarchy.fcluster(Z, t, criterion=’inconsistent’depth=2, R=None, monocrat=None)− The fcluster() method forms flat clusters from the hierarchical clustering. This hierarchical clustering is defined by the given linkage matrix, identifying a link between clustered classes.Below is given the detailed explanation of its parameters −ParametersZ− ndarrayIt represents the hierarchical clustering which is encoded with the ... Read More

How to solve Hermitian positive-banded matrix equation using Python SciPy?

Gaurav Kumar

Gaurav Kumar

Updated on 25-Nov-2021 06:36:52

142 Views

The linear function named scipy.linalg.solveh_banded is used to solve the banded matrix equation. In the below given example we will be solving the banded system Hx = b where −$$\mathrm{H} = \begin{bmatrix} 8 & 2-1j&0 &0 \ 2+1j & 5& 1j & -2-1j0\ 0 & -1j& 9& \ 0 & ... Read More

How to solve triangular matrix equations using Python SciPy?

Gaurav Kumar

Gaurav Kumar

Updated on 24-Nov-2021 14:37:03

323 Views

The linear function named scipy.linalg.solveh_triangular is used to solve the banded matrix equation. In the below given example we will be solving the triangular system ax = b where −$$\mathrm{a} = \begin{bmatrix} 3 & 0 & 0 & 0\ 2 & 1 & 0 & 0\ 1 &0 &1 &0 ... Read More

Finding inverse of a square matrix using SciPy library

Gaurav Kumar

Gaurav Kumar

Updated on 24-Nov-2021 13:42:44

193 Views

SciPy library has scipy.linalg.inv() function for finding the inverse of a square matrix. Let’s understand how we can use this function to calculate the inverse of a matrix −ExampleInverse of a 2 by 2 matrix#Importing the scipy package import scipy.linalg #Importing the numpy package import numpy as np ... Read More

Various approaches in Python to load CSV data for ML projects

Gaurav Kumar

Gaurav Kumar

Updated on 24-Nov-2021 13:10:55

280 Views

To successfully build a machine learning project, loading data properly is one of the most important as well as challenging tasks. CSV is the most common format for machine learning projects. It is a simple format which is used to store tabular data.Followings are the three most common approaches in ... Read More

What is Reinforcement Learning? How is it different from supervised and unsupervised learning?

Gaurav Kumar

Gaurav Kumar

Updated on 24-Nov-2021 13:07:37

660 Views

In reinforcement learning methods, a trained agent interacts with a specific environment and takes actions based upon the current state of that environment.The working of reinforcement learning is as follows −First you need to prepare an agent with some specific set of strategies.Now leave the agent to observe the current ... Read More

Advertisements