Name is simply an identity given to objects, you can also call it as an identifier. In python, everything is an object and the name is using to identify that object or can say the name is a way to access the object. For example, when we declare any variable a = 20, here 20 is an object stored in memory and a is the…
Data Science
Answered Dec 19, 2019
·
1.7K Views
Read answer →
This is defined as the precision after retrieving R documents, where R is the number of relevant documents retrieved for the current query.
Data Science
Answered Dec 19, 2019
·
2.0K Views
Read answer →
To visualize specific entities, we need to pass the specific tag we need to view in order to restrict the visualization.Here, only ORG and PRODUCT tags are displayed because of the options entered as our choice.
Data Science
Answered Dec 18, 2019
·
1.5K Views
Read answer →
When the number of predictor variables exceeds a handful, many of the records to be classified will be without exact matches. This can be understood in the context of a model to predict voting on the basis of demographic variables. Even a sizable sample may not contain even a single match for a new record who is a…
Data Science
Answered Dec 18, 2019
·
1.5K Views
Read answer →
Bayesian classifier often works with categorical variables. But it is also possible to make classification in numeric data. But for such cases, we have to follow two approaches. We have to bin and convert the numerical predictors to categorical variable and apply the Naïve Bayes algorithm We have to use a probability…
Data Science
Answered Dec 18, 2019
·
1.6K Views
Read answer →
If we consider the spam classification model, it may happen that some words never appear in the past while model building but may appear in a later stage which can make the entire calculation as zero. To avoid such situations, a Laplace estimator is used. It essentially adds a small number to each of the counts in the…
Data Science
Answered Dec 18, 2019
·
2.0K Views
Read answer →
To do the following we need to follow these steps. Get the vectorized matrix print("Final Data-matrix:") print(X_tr.shape, y_train.shape) print(X_cr.shape, y_cv.shape) print(X_te.shape, y_test.shape) Now we will train the model with MultinomialNB # Put the optimal alpha value you found NBModel =…
Data Science
Answered Dec 18, 2019
·
1.8K Views
Read answer →
Conditional probability uses Bayes theorem to calculate the relationships between the dependent events. If A and B are two events then P(AB) can be read as the probability of event occurring A given that the event B has already occurred. The equation of conditional probability can be written as Let us take an example…
Data Science
Answered Dec 18, 2019
·
1.6K Views
Read answer →
It is simple to work on mutually exclusive cases but most of the actual problems belong to non-mutually exclusive events. We can predict the event outcome by using the joint appearance. For example, if emails messages present the word like lottery, which is very highly likely of being spam rather than ham. The…
Data Science
Answered Dec 18, 2019
·
1.8K Views
Read answer →
First we import the training and testing data # Importing the dataset training_set = read.csv(file.choose())#salary_train test_set = read.csv(file.choose())# salary_test Now we encode the target feature as factor and fit the model # Encoding the target feature as factor #dataset$Purchased = factor(dataset$Purchased,…
Data Science
Answered Dec 18, 2019
·
1.6K Views
Read answer →
First we import the libraries and the datasets import pandas as pd import bumpy as np from sklearn.naive_bayes import Gaussian NB from sklearn.naive_bayes import MultinomialNB from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix salary_train =…
Data Science
Answered Dec 18, 2019
·
1.8K Views
Read answer →
Let us create an empty list which will contain the training and testing accuracy and the respective k values. The following code will generate the k values along with the training and testing accuracy. The k values will be ranging from 3 to 200 with a step size of 2. test_acc
Data Science
Answered Dec 18, 2019
·
1.6K Views
Read answer →