This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FAQ | |
Q1. What is the assumption we have to make when implementing a Gaussian Mixture Model? | |
Ans. The Gaussian Mixture model assumes that the instances are generated from a mixture of several Gaussian distributions i.e. each instance can belong to one or more gaussian distributions. | |
Q2. What are the parameters for the Gaussian Mixture model function? | |
Ans. There are mainly 2 parameters for the GMM function, the mean of current gaussian distribution(μ) and its covariance matrix(Σ). Although another parameter, the weight of the cluster also plays an important role. | |
Q3. What is difference between hard clustering and soft clustering? | |
Ans. In hard clustering each instance belongs to only one fixed cluster, like in K-Means, while in soft clustering each instance may be a part of mutliple clusters. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FAQ | |
Q1. Why can't we have high values for both precision and recall? | |
Ans. We can't have high values for both precision and recall because there is a tradeoff between these two values, i.e if we increase one value, other will decrease. | |
Q2. Scikit-Learn doesn't let us set the threshold directly, then how do we implement its functionality in our model? | |
Ans. We can call the decision_function() method of Scikit-Learn which returns a score for each instance, and then make predictions based on those scores using any | |
threshold we want. | |
Q3. Why is the precision curve bumpier than the recall curve in the graph of precision and recall vs decision threshold? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FAQ | |
Q1. Why do we use BeautifulSoup? | |
Ans. BeautifulSoup is a python library which is used to extract data out of html or xml files, so it is very useful in web scrapping as it saves a lot of time. | |
Q2. What does the prettify() method do? | |
Ans. The prettify() method is used when we want to print the parse tree created from the raw html content and displays it in an easy to understand manner. | |
Q3. What is the use of find_all() method? | |
Ans. find_all() is used to access all elements of a specific type(tag) with specific id or class as optional attribute. for example, find_all('p', class_='para') will refer to all <p> tags with class name 'para'. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FAQ | |
Q1. What is the main difference between an Object and a class? | |
Ans. Class is like a blueprint which holds its own state(attributes) and behaviour(methods), which in turn basically defines the nature of a future object while object is an instance of the class. | |
Q2. What is the function of the __init__ method? | |
Ans. __init__ method is very similar to the concept of contructors in languages like Java or C++. It is used to initialize the data members of a class and it is automatically called when object of the class is created. | |
Q3. What does 'self' represent in Python? | |
Ans. Self is basically a reference to the current instance of the class through which we can access the methods and attributes of that class. It is not a keyword,i.e we can use a different name for the parameter, but using self is preferable for better readability of the code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FAQ | |
Q1. Why do we need file handling in Python?i | |
Ans. File handling is required if we want to work with files for either reading data from a file or writing data to it. Also I/O operations are the most expensive operations where a program can stumble, so file handling should be done carefully. | |
Q2. Which module is used for file handling in python by default? | |
Ans. The io module is the default module for accessing files, therefore we will not need to import any external library for general IO operations. | |
Q3. What is the default mode of open function? | |
Ans. If mode is not provided in the open function manually, then by default Python assumes it to be 'r', i.e. for reading. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FAQ | |
Q1. What does the 'try' clause contain? | |
Ans. 'try' clause contains the statements or lines of code which may raise an exception. | |
Q2. What does the 'except' clause contain? | |
Ans. 'except' clause contains the statements or lines of code which actually handle the exception raised in the try clause. | |
Q3. How many except clauses can a try-except block have? | |
Ans. The answer is more than zero, because there has to be atleast one except clause. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FAQ | |
Q1. Is a python dictionary ordered or unordered? | |
Ans. In Python version 3.7, dictionaries are ordered. But in Python 3.6 and earlier, dictionaries are unordered. When we say that dictionaries are ordered, it means that the items have a defined order, and that order will not change. Unordered means that the items do not have a defined order, we cannot refer to an item by using an index. | |
Q2. How is a dictionary different from a list? | |
Ans. The first major difference is that dictionaries contain pair of elements as key and value pairs while list doesn't. The second difference is that list cannot have duplicates items as keys while list allows duplicate values. | |
Q3. Is a dictionary mutable or immutable? | |
Ans. A dictionary is mutable i.e. we can add, remove and change elements in a dictionary. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FAQ | |
Q1. Why can't we access elements of a set using 0 based indexing? | |
Ans. This is because the elements of a set are unordered, i.e. items can appear in a different order every time we use them and thus they cannot be referred to by index or key. | |
Q2. How is a set different from a list? | |
Ans. List is a mutable collection of elements which allows duplicates and contained inside '[]' while set is also a mutable collection of elements which doesn't allow duplicates and its elements are contained inside '{}'. | |
Q3. Is a set mutable or immutable? | |
Ans. A set is a mutable data type but the elements of the set must be immutable. This means we can alter the set by adding and deleting elements but the elements of the set cannot be changed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FAQ | |
Q1. How is a tuple different from a list? | |
Ans. Both list and tuple are ordered and indexed collection of elements which can contain different data types, but lists are mutable and list elements are stored inside square brackets('[]') while tuple is immutable and its elements are stored inside parenthesis('()'). | |
Q2. Why are tuples more efficient than lists? | |
Ans. Tuples are stored in a single block of memory. Since they are immutable so, they don't require extra space to store new objects. Lists are allocated in two blocks: the fixed one with all the Python object information and a variable sized block for the data. It is the reason creating a tuple is faster than List. | |
Q3. How do we access elements of a tuple? | |
Ans. Since tuples are ordered we can use '0' based indexing to access tuple elements very similar to as we do in case of lists. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FAQ | |
Q1. What is the main difference between list and array in python? | |
Ans. Both list and array are collections of element but list can contain elements of different data types unlike array which can only contain elements of a single data type. | |
Q2. How do we access list elements? | |
Ans. List elements can be accessed using '0' based indexing. For example, 'i'th element of a list 'l' can be accessed using 'l[i-1]'. | |
Q3. Is list ordered or unordered? | |
Ans. List is ordered, which means that the items have a fixed order, and that order will not change. New elements are added to the end of the list. |