1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vinvika [58]
4 years ago
11

For this programming assignment you will implement the Naive Bayes algorithm from scratch and the functions to evaluate it with

a k-fold cross validation (also from scratch). You can use the code in the following tutorial to get started and get ideas for your implementation of the Naive Bayes algorithm but please, enhance it as much as you can (there are many things you can do to enhance it such as those mentioned at the end of the tutorial):
Computers and Technology
1 answer:
DanielleElmas [232]4 years ago
8 0

Bayes’ Theorem provides a way that we can calculate the probability of a piece of data belonging to a given class, given our prior knowledge.

P(class|data) = (P(data|class) * P(class)) / P(data)

Where P(class|data) is the probability of class given the provided data.

Explanation:

  • Naive Bayes is a classification algorithm for binary  and multiclass classification problems.
  • It is called Naive Bayes or idiot Bayes because the calculations of the probabilities for each class are simplified to make their calculations tractable.

This Naive Bayes tutorial is broken down into 5 parts:

Step 1: Separate By Class :  Calculate the probability of data by the class they belong to, the so-called base rate. Separate our training data by class.

Step 2: Summarize Dataset : The two statistics we require from a given dataset are the mean and the standard deviation

The mean is the average value and can be calculated using :

mean = sum(x)/n * count(x)

Step 3: Summarize Data By Class : Statistics from our training dataset organized by class.

Step 4: Gaussian Probability Density Function : Probability or likelihood of observing a given real-value. One way we can do this is to assume that the values are drawn from a distribution, such as a bell curve or Gaussian distribution.

Step 5: Class Probabilities :  The statistics calculated from our training data to calculate probabilities for new data.  Probabilities are calculated separately for each class. This means that we first calculate the probability that a new piece of data belongs to the first class, then calculate the second class, on for all the classes.

You might be interested in
8.17 Lab: Strings of a Frequency Write a program that reads whitespace delimited strings (words) and an integer (freq). Then, th
WITCHER [35]

Answer:

def wordsOfFreqency(words, freq):

 text1 = "Apple apPLE mangO aPple orange Orange apple guava Mango mango"

 words = []

 words1 = []

 words1 = text1.split()

 words = [x.upper() for x in words1]

 freq=[words.count(w) for w in words]

 print(dict(zip(freq,words)))

 return words

def main():

wordsOfFreqency(words, freq)      

if __name__=="__main__":

main()    # call main function

Explanation:

This will print the list of strings as per its word frequency.

Output is :

{4: 'APPLE', 3: 'MANGO', 2: 'ORANGE', 1: 'GUAVA'}

4 0
3 years ago
Relation between training and occupation with examples in points . Plz tell fast<br> ​
dolphi86 [110]

Answer:

Follows are the relation between training and occupation:

Explanation:

Training:

This method includes several steps that are systematically practiced to have an efficient training course. It is a structured activity carried out to improve an employee's skills, attitudes, and behavior.  

Occupation :

Profession, industry, occupation, corporation, trade, and business are also the things you actively participate in, especially your daily work or lifestyle. Its general word occupational is now a fun or cozy job.  

Relation:  

Training allows a person to acquire new knowledge and abilities but also build their professions by becoming independent. It enables competence to improve. All employees are highly inspired by training.

6 0
3 years ago
How can you resize the program window?​
Daniel [21]

Answer:

Resize a window by dragging the edges or corner of the window. Hold down Shift while resizing to snap the window to the edges of the screen and other windows. Move or resize a window using only the keyboard. Press Alt + F7 to move a window or Alt + F8 to resize.

4 0
3 years ago
Read 2 more answers
BlueGriffon has four different views, called: Question 4 options: Normal, All Tags Mode, Source, and Preview.� WYSIWYG, HTML, So
daser333 [38]

Answer:

WYSIWYG, HTML, Source, and Preview in Browser

Explanation:

First, open the html file you are editing from the File : Open dialog, or from the Open File icon on the toolbar. Click on the toggle Browser Preview on the toolbar or from the View menu. This will give you a quick browser preview. Click on the button again and it will return to the code view

8 0
3 years ago
The components of hardware include:
zlopas [31]

Answer:

A

Explanation:

Monitor, CPU, Disk Drives, Printer, Keyboard/mouse

5 0
3 years ago
Read 2 more answers
Other questions:
  • Describe how computer is in the last 35 years
    6·1 answer
  • How long does it take a packet of length 1,000 bytes to propagate over a link of distance 2,500 km, propagation speed 2.5 · 108
    8·2 answers
  • QUICK ANSWER- what is the function of GUI
    6·2 answers
  • Hoda wants to create a new presentation in PowerPoint with existing graphics and designs. What is the easiest and fastest way fo
    14·1 answer
  • The U.S. National Institute of Standards and Technology defines the incident response life cycle as having four main processes:
    13·1 answer
  • The bag class in Chapter 5 has a new grab member function that returns a randomly selected item from a bag (using a pseudorandom
    8·1 answer
  • Which of these is true about moores law
    6·1 answer
  • After running the following pseudocode, what will the value of VARIABLE be? 1. Set value of VARIABLE to 5 2. Increase the value
    15·1 answer
  • Make a list of any four computer that were used in the history of computer.​
    6·1 answer
  • Team members can collaborate on ideas using telepresence. <br> true or false?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!