Found 10784 Articles for Python

Synsets for a word in WordNet in NLP

Mithilesh Pradhan
Updated on 09-Aug-2023 11:53:20

650 Views

Introduction WordNet is a large database of words present in the NLTK library in present in many languages for Natural Language related use cases. NLTK library has an interface known as Synset that allows us to look for words in WordNet. Verbs, Nouns, etc. are grouped into sunsets. WordNet and Synsets The below diagram shows the structure of WordNet. In WordNet, the relationship between words is maintained. For example, words like sad are similar and find the application under similar contexts. These words can be interchanged during usage. These kinds of words are grouped for synsets. Each synset is ... Read More

How to choose elements from the list with different probability using NumPy?

Niharika Aitam
Updated on 09-Aug-2023 14:55:24

712 Views

There are multiple ways to choose elements from the list with the different probability using the numpy library. In python, NumPy library provides a module named random, which has several functions such as choice(), multinomial() etc., which are used to choose elements from an array with different probabilities. The sum of all probability values defined in the list should be equal to 1. Let’s see each way one by one. Using the random.choice() function The random module provides the function choice(), which is used to calculate a random sample from the given 1-d array with the specified probability distribution. ... Read More

How to check whether the element of a given NumPy array is non-zero?

Niharika Aitam
Updated on 09-Aug-2023 14:53:33

112 Views

There are multiple ways to check whether the element of a given Numpy array is Non-zero. Here are few common ways that we can apply. Using Boolean indexing Boolean Indexing is a technique in Numpy library, that allows for the selection of specific elements from the array based on the Boolean condition. This creates a Boolean mask containing True or False values, which have the same shape and size as per the Boolean condition. Example Following example how to use Boolean indexing to check whether the element of a given numpy array is non-zero. import numpy as np arr = ... Read More

K-Medoids clustering with solved example in Machine Learning

Mithilesh Pradhan
Updated on 09-Aug-2023 11:51:43

2K+ Views

Introduction K-Medoids is an unsupervised clustering algorithm using the partition method of clustering. It is an improvised version of the K-Means clustering algorithm especially used to handle outlier data. It requires unlabeled data to work with. In this article let us understand the k-Medoids algorithm with an example. K-Medoids Algorithm In the K-Medoids algorithm, each data point is called a medoid. The medoids serve as cluster centers. The medoid is a point such that its sum of the distance from all other points in the same cluster is minimum. For distance, any suitable metric like Euclidian distance or Manhattan distance ... Read More

How to check whether the day is a weekday or not using Pandas in Python?

Niharika Aitam
Updated on 09-Aug-2023 14:51:19

2K+ Views

The Python pandas library provides different functions to check whether the day is a weekday or not namely, weekday(), day_name(), isoweekday() etc., Pandas is an open source python library which is used for data manipulation, data analysis, data visualization, data structures etc. This library is widely used in data science and data analysis which provides data cleaning, exploration and transformation. There are many modules and functions available in pandas to work with the given data. Using the weekday() function In python, the weekday() function can be used to determine whether a given day is a weekday or not. This ... Read More

How to check whether specified values are present in NumPy array?

Niharika Aitam
Updated on 09-Aug-2023 14:47:20

5K+ Views

We have different modules and functions available in python language to check whether specified values are present in the given Numpy array. Numpy is abbreviated as Numerical Python, which is a python library used to perform the mathematical, statistical and scientific calculations. The result of the numpy array is returned in the format of array. The arrays can be created in one dimension, two dimension and so on up to 32 dimensions. The Numpy library provides a number of modules and functions which helps us to perform scientific calculations and mathematical calculations. Let’s see each way one by one to ... Read More

Exploring Data Distribution

Mithilesh Pradhan
Updated on 09-Aug-2023 11:26:27

284 Views

Introduction The distribution of data gives us useful insights into the data while working with any data science or machine learning use case. Data Distribution is how the data is available and its present condition, the information about specific parts of the data, any outliers in the data as well as central tendencies related to the data. To explore the data distribution there popular graphical methods that prove beneficial while working with the data. In this article let us explore these methods. Know more about your data: The Graphical Way Histograms & KDE Density Plots Histograms are the most ... Read More

How to check the execution time of Python script?

Niharika Aitam
Updated on 09-Aug-2023 14:45:08

9K+ Views

The python script is the file that can store the code which is used to execute a specific task or set of tasks. This file is saved with the file extension “.py”. The python script can be created and edited in any text editor and can be executed using the command line prompt or can be imported as a package or module into the integrated development environment(IDE). Each python script will take some time to execute the file; it can be calculated by using the following ways. Using the time Module In python, we have the time module which ... Read More

How to check multiple variables against a value in Python?

Niharika Aitam
Updated on 09-Aug-2023 14:42:47

2K+ Views

The variable is an entity that stores on different values. When we assign a new value, every time, the previous value will be replaced with the new one. In python, a variable can be alphabetic, underscore, numeric value starting with the alphabet etc. The multiple variables can be against a value; it can be checked by using the following ways in python. Using logical ‘or’ and ‘and’ One of the way to check multiple variables against a value in python is by logical or and and. The and operator will check if all the variables are equal to their ... Read More

How to Check Loading Time of Website using Python

Niharika Aitam
Updated on 09-Aug-2023 14:35:53

457 Views

We use different websites in our day to day life. Every particular website will take some time to load the content. Mathematically, we can get the loading time by subtracting the time obtained with the reading time of the whole website. In python we have few packages and modules to check loading time of the website. Steps/Approach The following are the steps that we need to follow to get the loading time of the website. Let’s see each step one by one. Firstly, we have to import the required libraries into our python environment. The following is the lines ... Read More

Advertisements