Measure Similarity or Distance Between Two Vertices in a Graph

Ginni
Updated on 18-Feb-2022 10:09:11

1K+ Views

There are two types of measures such as geodesic distance and distance based on random walk.Geodesic Distance − A simple measure of the distance among two vertices in a graph is the shortest route among the vertices. Usually, the geodesic distance among two vertices is the length in terms of the multiple edges of the shortest path among the vertices. For two vertices that are not linked in a graph, the geodesic distance is represented as infinite.By utilizing geodesic distance, it can represent various useful measurements for graph analysis and clustering. Given a graph G = (V, E), where V ... Read More

Categorization of Constraints in Data Mining

Ginni
Updated on 18-Feb-2022 10:02:36

490 Views

Constraint-based algorithms need constraints to decrease the search area in the frequent itemset generation phase (the association rule creating step is exact to that of exhaustive algorithms).The importance of constraints is well-defined and they make only association rules that are interesting to customers. The method is quite trivial and the rules area is decreased whereby remaining rules use the constraints.There are three types of constraints which are as follows −Constraints on instances − A constraint on instances defines how a pair or a set of instances must be grouped in the cluster analysis. There are two types of constraints from ... Read More

Compute Bitwise OR of Two 2D Arrays Element-wise in NumPy

AmitDiwan
Updated on 18-Feb-2022 07:48:55

174 Views

To compute the bit-wise OR of two 2D arrays element-wise, use the numpy.bitwise_or() method in Python Numpy. Computes the bit-wise OR of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator |.The 1st and 2d parameter are the arrays, only integer and boolean types are handled. If x1.shape != x2.shape, they must be broadcastable to a common shape.The where parameter is the condition broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original ... Read More

Compute Bit-wise OR of Two Boolean Arrays Element-wise in NumPy

AmitDiwan
Updated on 18-Feb-2022 07:46:29

769 Views

To compute the bit-wise OR of two boolean arrays element-wise, use the numpy.bitwise_or() method in Python Numpy. Computes the bit-wise OR of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator |.The 1st and 2d parameter are the arrays, only integer and boolean types are handled. If x1.shape != x2.shape, they must be broadcastable to a common shape.The where parameter is the condition broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original ... Read More

Mask Rows and Columns of a 2D Array with Masked Values in NumPy

AmitDiwan
Updated on 18-Feb-2022 07:43:51

153 Views

To mask rows and/or columns of a 2D array that contain masked values, use the np.ma.mask_rowcols() method in Numpy. The function returns a modified version of the input array, masked depending on the value of the axis parameter.Mask whole rows and/or columns of a 2D array that contain masked values. The masking behavior is selected using the axis parameter −If axis is None, rows and columns are masked.If axis is 0, only rows are masked.If axis is 1 or -1, only columns are masked.StepsAt first, import the required library −import numpy as np import numpy.ma as maCreate an array with ... Read More

Mask Rows and Columns of a 2D Array in NumPy

AmitDiwan
Updated on 18-Feb-2022 07:41:21

294 Views

To mask rows and/or columns of a 2D array that contain masked values, use the np.ma.mask_rowcols() method in Numpy. The function returns a modified version of the input array, masked depending on the value of the axis parameterMask whole rows and/or columns of a 2D array that contain masked values. The masking behavior is selected using the axis parameter −If axis is None, rows and columns are masked.If axis is 0, only rows are masked.If axis is 1 or -1, only columns are masked.StepsAt first, import the required library −import numpy as np import numpy.ma as maCreate an array with ... Read More

Return Outer Product of Two Masked Arrays with Different Shapes in NumPy

AmitDiwan
Updated on 18-Feb-2022 07:39:26

252 Views

To return the outer product of two masked arrays with different shapes, use the ma.outer() method in Python Numpy. The first parameter is the input vector. Input is flattened if not already 1-dimensional. The second parameter is the second input vector. Input is flattened if not already 1-dimensional.A masked array is the combination of a standard numpy.ndarray and a mask. A mask is either nomask, indicating that no value of the associated array is invalid, or an array of booleans that determines for each element of the associated array whether the value is valid or not.StepsAt first, import the required ... Read More

Compare and Return True if a NumPy Array is Greater than or Equal to Another

AmitDiwan
Updated on 18-Feb-2022 07:37:03

527 Views

To compare and return True if an array is greater than equal to another, use the numpy.char.greater_equal() method in Python Numpy. The arr1 and arr2 are the two input string arrays of the same shape.Unlike numpy.greater_equal, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray.The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_ or numpy.bytes_.StepsAt first, import the required library −import numpy as npCreate two One-Dimensional arrays of string −arr1 = np.array(['Bella', 'Tom', 'John', 'Kate', 'Amy', 'Brad', 'aaa']) arr2 = ... Read More

Return Right Justified Elements of a NumPy Array as String

AmitDiwan
Updated on 18-Feb-2022 07:34:59

134 Views

To return an array with the elements of an array right-justified in a string of length width, use the numpy.char.rjust() method in Python Numpy. The "width" parameter is the length of the resulting strings.The function returns an output array of str or unicode, depending on input type. The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_ or numpy.bytes_.StepsAt first, import the required library −import numpy as np# Create a One-Dimensional array of stringarr = np.array(['Tom', 'John', 'Kate', 'Amy', 'Brad'])Displaying our array −print("Array...", arr)Get the datatype −print("Array datatype...", arr.dtype)Get the dimensions of the Array −print("Array ... Read More

Left Justify Elements of an Array in Numpy

AmitDiwan
Updated on 18-Feb-2022 07:32:26

192 Views

To left-justify elements of an array and set the characters to use for padding, use the numpy.char.ljust() method in Python Numpy. The "width" parameter is the length of the resulting strings. The "fillchar" parameter is the character to use for padding.The function returns an output array of str or unicode, depending on input type. The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_ or numpy.bytes_.StepsAt first, import the required library −import numpy as npCreate a One-Dimensional array of string −arr = np.array(['Tom', 'John', 'Kate', 'Amy', 'Brad'])Displaying our array −print("Array...", arr)Get the datatype: −print("Array datatype...", ... Read More

Advertisements