Question
please help

Q1: For the data given below, (a) produce the NBC model with Laplacian Correction, and (b) use the model to predict the class
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Find Python code:

from sklearn.naive_bayes import GaussianNB

import numpy as np

# assigning predictor and target variables
x = np.array([[0, 2, 1], [1, 0, 0], [2, 2, 2], [1, 0, 1], [0, 1, 2], [2, 2, 0], [1, 1, 1], [0, 2, 2]])
Y = np.array([1, 0, 1, 0, 1, 0, 1, 1])

# laplacian correction
x += 1
# Create a Gaussian Classifier
model = GaussianNB()

# Train the model using the training sets
model.fit(x, Y)

# Predict Output
test = np.array([0, 0, 1])

test += 1
predicted = model.predict([test])
print predicted
Add a comment
Know the answer?
Add Answer to:
please help Q1: For the data given below, (a) produce the NBC model with Laplacian Correction, and (b) use the mode...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA question: Please see the code posted below and improve it so it allows for: 1.new...

    JAVA question: Please see the code posted below and improve it so it allows for: 1.new aircraft are entered [new objects] 2.these objects are automatically be assigned their unique IDs [unique ID linked to a static class variable?] 3.will not be automatically given airport codes [initialise airportCode as null in the constructor] 4.assign an airport code to each new aircraft [an object method?] The code: class Aeroplane { static int planeCount = 0; static int codeGenerator = 0; int uniqueID...

  • Hello, IN C++ please help creating a 100% functional program that follows all the guidelines shown...

    Hello, IN C++ please help creating a 100% functional program that follows all the guidelines shown below. (I WILL RATE, NO INCOMPLETE OR OTHER PEOPLE'S SOLUTIONS PLEASE): THANK YOU. a. Randomly generate three integer arrays A1, A2, and A3 of sizes N=103 , 105 , and 107 (or 106 , if your computer cannot handle an integer array of size 107 ), in that order. b. Run all the four sorting algorithms (insertion, merge, heap and quick sort) we’ve learned...

  • Please help with this SML problem.​​​​​​​ 4. Write recursive functions for the following: (a) Given an...

    Please help with this SML problem.​​​​​​​ 4. Write recursive functions for the following: (a) Given an integer i and a list L, cycle L i times. That is, if, L = [a1, A2, ... , an], then the desired result is [di+1, Q i+2, ... , An, Q1, Q2, ... , ai] (b) Compute x', where x is a real and i is a nonnegative integer. This function takes two parameters, x and i.

  • Help me please. How can I do this question. Consider the circuit shown in (Figure 1)....

    Help me please. How can I do this question. Consider the circuit shown in (Figure 1). Suppose that ig equals 9e-5 A. Part A Use the Fourier transform to find i, (t). Suppose that io (t) = Aje-atu(t) + A2e-02* u(t) + Azeztul-t), where az > 21. Determine the va of Aj, aj, A2, a2, A3, and az. Express your answers using three significant figures separated by commas. Express A2, and A3 in amperes. Express 21, 22, and as in...

  • Suppose that 4 3 -225 3 3 -3 2 6 -2 -2 2-1 5 In the following questions you may use the fact that the matrix B is row-e...

    Suppose that 4 3 -225 3 3 -3 2 6 -2 -2 2-1 5 In the following questions you may use the fact that the matrix B is row-equivalent to A, where 1 0 1 0 1 0 1 -2 0 5 0 0 01 3 (a) Find: the rank of A the dimension of the nullspace of A (b) Find a basis for the nullspace of A. Enter each vector in the form [x1, x2, ...]; and enter your...

  • 2) In the design of a new facility, the mutually exclusive alternatives in the table below...

    2) In the design of a new facility, the mutually exclusive alternatives in the table below are under consideration. Assume that the interest rate (MARR) is 15%. First draw the cash flow diagrams. Then, use the following methods to choose the best of these three feasible alternatives: Alternative 1 Alternative 2 Alternative 3 $ 11 $ 12 $ 13 Investment (first) cost (please see the table for your value) $ A1 $ A2 $ A3 Net cash flow per year...

  • Design a data processor, which keeps counting under given conditions. You will use an Algorithmic State...

    Design a data processor, which keeps counting under given conditions. You will use an Algorithmic State Machine (ASM) chart, which will define its digital hardware algorithm. Design a digital system with two flip-flops, E and F, and one 4-bit binary counter, A. The individual flip-flops in A are denoted by A4, A3, A2, and A1, with A4 holding the MSB of the count. A start signal S initiates the system operation by clearing the counter A and flip-flop F. The...

  • Someone help please Let A be an array of 5 integers, whose contents are as follows:...

    Someone help please Let A be an array of 5 integers, whose contents are as follows: 3, 2, 1, 5, 4 We will apply quick sort to sort this array. Show all of the element-wise comparisons made by the algorithm in the correct order. Here an element-wise comparison means the comparison of one element of the array with another element of the array or the key set in a particular step of the algorithm. Since the algorithm may move the...

  • Please help with Parts A-C Thank You! Engineers use a venturi meter to measure the speed...

    Please help with Parts A-C Thank You! Engineers use a venturi meter to measure the speed of a fluid traveling through a pipe (Figure 1). Positions 1 and 2 are in pipes with surface areas A1 and A2 with A1 greater than A2 and are at the same vertical height. Assume the density of water is p. Figure < 1 of 1 h 2 Part A Determine the pressure difference between positions 1 and 2 Express your answer in terms...

  • Correction: first problem is #2, not #1. Please show all steps in the proofs. Definitions for...

    Correction: first problem is #2, not #1. Please show all steps in the proofs. Definitions for problems #2 through #5: Let C be the set of all Cauchy sequences of rational numbers, with the operations of addition and multiplication defined on C by (an) + (bn) = (an + bn) and (an)(bn) = (anbn). Let N be the subset of C consisting of all null sequences in c. Properties of a ring: A1. (a + b) +c= a + b...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT