
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

2K+ 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 linkage matrix.t− scalarThe value of t depends on the type of criteria. For ‘inconsistent’, ‘distance’, and ‘monocrit’ criteria, the value of t represents the threshold to apply when forming flat clusters. On the other hand, for ‘maxclust’, and ‘maxclust_monocrit’ criteria, the value of t represents the maximum number of clusters ... Read More

623 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 used to cut hierarchical clustering into flat clustering, which they obtain as a result an assignment of the original data point to single clusters. Let’s understand the concept with the help of below given example −Example#Importing the packages from scipy.cluster.hierarchy import ward, fcluster from scipy.spatial.distance import pdist #The cluster ... Read More

269 Views
It is difficult to remember the values, units, and precisions of all physical constants. That’s the reason scipy.constants() have four methods with the help of which we can access physical constants. Let’s understand these methods along with examples −scipy.constants.value(key)− This method will give us the value in physical constants indexed by key.Parameterskey- It represents the key in dictionary physical_constants. Its value is a Python string or Unicode.Returnsvalue- It represents the value in physical_constants corresponding to the key parameter. Its value is of float type.Examplefrom scipy import constants constants.value(u'proton mass')Output1.67262192369e-27scipy.constants.unit(key)− This method will give us the unit in physical constants indexed ... Read More

163 Views
To implement Scientific or Mathematical calculation, we need various universal constants. For example, the formula to calculate area of a circle is pi*r*r where Pi is a constant having value = 3.141592653. There are various other scenarios like this where we need constants. It would really be helpful if we can incorporate these constants into our calculation with ease. The scipy.constants(), a sub-module inside the Scipy library, does the job for us and provide us a reference material to look up exhaustive list of Physical Constants, universal mathematical constants, and various units such as SI prefixes, Binary prefixes, Mass, Angle, ... Read More

515 Views
The scipy.cluster.vq()has two methods to implement k-means clustering namely kmeans() and kmeans2(). There is a significant difference in the working of both these methods. Let us understand it −scipy.cluster.vq.kmeans(obs, k_or_guess, iter=20, thresh=1e-05, check_finite=True)− The kmeans() method forms k clusters by performing k-means algorithm on a set of observation vectors. To determine the stability of the centroids, this method uses a threshold value to compare the change in average Euclidean distance between the observations and their corresponding centroids. The output of this method is a code book mapping centroid to codes and vice versa.scipy.cluster.vq.kmeans2(data, k, iter=10, thresh=1e-05, minit='random', missing='warn', check_finite=True)− The ... Read More

237 Views
scipy.cluster.vq.kmeans2(data, k, iter=10, thresh=1e-05, minit='random', missing='warn', check_finite=True)− The kmeans2() method classify a set of observations vectors into k clusters by performing k-means algorithm. To check for convergence, the kmeans2() method does not use threshold values. It has additional parameters to decide the method of initialization of centroids, to handle empty clusters, and to validate if the input metrices contain only finite numbers or not.Below is given the detailed explanation of its parameters −Parametersdata− ndarrayIt is an ‘M’ by ‘N’ array of M observations in N dimension.k− int or ndarrayThis parameter represents the number of clusters to form and the centroids ... Read More

216 Views
The scipy.cluster.vq.kmeans(obs, k_or_guess, iter=20, thresh=1e- 05, check_finite=True)method forms k clusters by performing a k-means algorithm on a set of observation vectors. To determine the stability of the centroids, this method uses a threshold value to compare the change in average Euclidean distance between the observations and their corresponding centroids. The output of this method is a code book mapping centroid to codes and vice versa.Below is given the detailed explanation of its parameters−Parametersobs− ndarrayIt is an ‘M’ by ‘N’ array where each row is an observation, and the columns are the features seen during each observation. Before using, these features ... Read More

268 Views
In this article, we need to find a number of prefix sum which are prime numbers in a given array arr[ ] of positive integers and range query L, R, where L is the initial index value arr[ L ] for prefixsum[ ] array and R is the number of prefix sum we need to find.To fill the prefix sum array, we start with index L to index R and add the present value with the last element in the given array. So here is the Example for the problem −Input : arr[ ] = { 3, 5, 6, 2, ... Read More

458 Views
A timer can only be cancelled after it is being scheduled. The Immediate class has an object for setImmediate() method and passes the same object to clearImmediate(), in case it wants to cancel the scheduled timer function.Scheduling TimersThis type of timers schedules the task to take place after a certain instant of time.setImmediate()setInterval()setTimeout()Cancelling TimersThis type of timers cancels the scheduled tasks which is set to take place.ClearImmediate()clearInterval()clearTimeout()1. clearImmediate() methodThis method clears the Immediate timer object that is created by the setImmediate() method.SyntaxclearImmediate( timer )Examplefilename - clearImmediate.js// clearImmediate() Example var timer = setImmediate(function A() { console.log("Timer set"); }); ... Read More

228 Views
In this article, we will explain how to solve the number of possible pairs of hypotenuse and area form a right-angled triangle in C++.We need to determine the number of all possible pairs of a hypotenuse and the area ( H, A ) to form a right-angled triangle with H as hypotenuse and A as Area.In this example − x = Base of Right Angled Triangle y = Height of Right Angled Triangle H = hypotenuse of Right Angled TriangleWe know Area of right angled triangle, A = ( x * ... Read More