Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Attached first is the program that needs to be solved. The rest is the cars.csv that needs to be read in the program. CPSC-51100: Statistical

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedAttached first is the program that needs to be solved. The rest is the cars.csv that needs to be read in the program.

CPSC-51100: Statistical Programming Programming Assignment 4 - Estimating Probabilities Introduction Probability is a number that indicates the likelihood of some outcome occurring, where each outcome comes from a set called the sample space, denoted by . Probabilities are used in situations where there is uncertainty in data, either due to a lack of sufficient data or some inherent randomness associated with the data. Formally, probability of each outcome is a value, , that satisfies the following properties 1.(each probability value has to be between zero and one) an (sum of all probabilities needs to be one) A set of outcomes defines an event. The probability of an event E is defined as In many applications, it is necessary to estimate probabilities from data. If the data contains nominal (i.e. categorical) values, we can estimate the probability of a particle valuc occurring in the data by counting the number of instances in which the value occurs. In particular, assume the data consists of N instances, which of which is associated with a fixed number of feature values. Then the probability of a particular feature having a particular value can be computed as We can also compute the conditional probability of a particular feature value, given some other features values as Note that the denominator is assumed to be non-zero. Such estimates can then be used for various data analysis applications, such as modeling or machine learnin Requirements You are to create a program in Python that performs the following 1. Loads the 'cars.csv' file into a pandas DataFrame 2. For each aspiration type , computes the conditional probability of that aspiration, given each of the makes 3. Displays the conditional probabilities to the screen 4. Computes the probability of each make and outputs to the screen Additional Requirements 1. The name of your source code file should be ProbEst.py All your code should be within a single file 2. You cannot import any package except for pandas. You need to use the pandas DataFrame object for storing data. You cannot use the groupby function! 3. Your code should follow good coding practices, including good use of whitespace and use of both inline and block comments 4. You need to use meaningful identifier names that conform to standard naming conventions. 5. At the top of each file, you need to put in a block comment with the following information: your name, date, course name, semester, and assignment name. 6. The output of your program should exactly match the sample program output given at the end. NAME: [put your name here] PROGRAMMING ASSIGNMENT #4 Prob(aspiration stdmake-alfa-romero)-100.00% Prob(aspiration turbo! make alfa-romero)-0.00% Prob(aspiration std|make audi) 71 .43% Prob aspiration-turbo!make-audi)-28.57% Prob(aspiration-std|make-bmw-100.00% Prob(aspiration-turbo!make-bmw)-0.00% Prob(aspiration std|make chevrolet) 100.00% Prob(aspiration-turbo!make-chevrolet)-0.00% Prob(aspiration-st make dodge)-66.67% Prob(aspiration: turbo!make dodge)-33.33% Prob(aspiration stdmake-honda-100.00% Prob(aspiration turbolmake-honda-0.00% Prob(aspiration-std|make-isuzu)-100.00% Prob(aspiration turbo!make-isuzu)-0.00% Prob(aspiration stdmake-jaguar) 100.00% Prob(aspiration turbolmake-jaguar)-0.00% Prob( aspiration-stdl make mazda)-100.00% Prob( aspiration turbo make-mazda)-0.00% Prob( aspiration std|make-mercedes-benz) 50.00% Prob(aspiration turbo!make-mercedes-benz) 50.00% Prob( aspiration-std! make mercury) 0.00% Prob(aspiration: turbolmake mercury)-100.00% Prob(aspiration-std|make-mitsubishi)-53.85% Prob(aspiration-turbo!make mitsubishi-46. I 5% Prob(aspiration-std|make-nissan)-94.44% Prob(aspiration-turbo!make=nissan) = 5.56% Prob( aspiration std make peugot) 45.45% Prob( aspiration-turbo make peugot)-54.55% Prob(aspiration stdmake-plymouth)-7 1 .43% Prob( aspiration-turbo make-plymouth) = 28.57% Prob( aspiration stdl make porsche) 100.00% Prob(aspiration-turbomake-porsche)-0.00% Prob(aspiration: std|make renault) 100.00% Prob( aspiration: turbolmake-renault)-0.00% Prob(aspiration-stdmake-saab) 66.67% Prob(aspiration-turbo!make saab) 33.33% Prob(aspiration-std|make-subaru)-83.33% Prob(aspiration-turbomake subaru) 16.67% Prob( aspiration std make toyota) 96.88% Prob( aspiration-turbo make toyota) 312% Prob(aspiration-std|make-volkswagen)-83.33% Prob(aspiration-turbolmake volkswagen) 16.67% Prob(aspiration std|make volvo)-54.55% Prob( aspiration-turbo make-volvo)-45.45% Prob(make-audi)-3.41% Prob(make-bmw) 3.90% Prob make chevrolet)-1 .46% Prob(make-dodge)-4.39% Prob(make-honda) = 6.34% Prob(make-isuzu)= 1.95% Prob(make-jaguar) 1 .46% Prob( make-mazda)-8.29% Prob(make-mercedes-benz)-3.90% Prob(make-mercury-0.49% Prob(make-mitsubishi)-6.34% Prob(make nissan) 8.78% Prob(make-peugot) 5.37% Prob(make-plymouth) 3.41 Prob(make-porsche) 2.44% Prob(make-renault) 0.98% Prob(make-saab)-2.93% Prob(make-subaru) = 5.85% Prob(make-toyota)-15.61% Prob(make-volkswagen)-5.85% Prob( make-volvo) 5.37% y 27 27 26 30 22 25 25 25 20 22 29 29 28 28 25 2 2 2 3 4 3 4 38 38 JA 38 30 24 54 JA 99g 8 5 3 7 8 9 9 9 8 8 8 5 6 1 4 4 4 4 S 7 6 1 8 8 8 9 7 7 9 .4 3 3 3 3 3 3 3 2 2 .1 1 0 77352528 8 .8 2 6 6 3 7 7 ,7 2 8 8 8 8 39 39 R. 7 1 9 8 3 3 3 3 3 3 3 6266 .6 6 .5 8 4 8 B 8 B 5 2 2 2 2 5 5 5 0 4 5 5 7 7/7/7396 .6 run two two two tow low two two tow two two tow two two two tow our tow-tow two two two sid td td td td td td td tur tur td td td td td td td td td td td td td tur td td td tur td tur td td reh sid and sid and sad and sad and sed and sed and sed sed ,, ,, sid ,12 3-45-67-89-10 11 12 13 14 15 16 17 18 19 73 25 26 27 29 30 31 32 33 60 /b 76 /6 76 86 86 86 86 01 00 78 70 70 90 76 /6 62 68 68 68 68 68 01 01 1 5 84 84 84 84 64 84 64 $ 64 $ 9 2 2 2 5 2 66 6 6 3 2 6 6 6 2 64 64 64 2 7 7 7 7 5 5 5 5 5 5 4. I 5 5 4 1 1 7 9 9 6 6 6 7 1 1 188 34 3 3 3 3 30 123 44 567890 1 2 3 4 5 6 7 890 6666 66 80 12 5 5 5 5 3 3 8 8 8 4 4 4 6 5 5 7 , 7 5 5 5 5 4944A444 3 3 3 3 3 3 3: :322 2. 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 45 70 8 3 121 75 9 9 5 6 6 3 1 2 4 333 3 3 3 2 2 2 4 4 4 4 3 3 3 3 2 3 63 2 gos gas gas gas gas gas gas gas gas ges gas-ges gas gos gas ges gas sed gas ges gas gas gas gas m 67 68 69 70 72 73 4 56 77 78 79 BO 82 83 84 8 86 B AA 89 90 9 92 93 94 95 96 97 98 99 75 30 50 50 72 57-09 21 37 4 3 2 2 2 2 2 2 2 3 2 2 2 3 2 2 23 24 4 3 3 3 3 3 2 2 2 5 223 .4 5 8 9 9 9 9 8 941124142427 4644 g57555g1 .8 2 2 5 5 9 g 9 4 4 A 4 4 4 4 4 4 4 3888886335 35 .3 ,5 ,4 4 4 7 6 6 7 75 7799.799.7 ,7 3 .3 3 6 2 9 9 9 9 7 gas ges gas-gas gas gas gas gas gas ted gas gas -gas gas gas gas gas gas gas gas gas ges gas ges gas ges gas .7 1 3 3 3 9 g 9 7 7 5 5 g g 7 g g 9 7 9 g g g g g g g 5 ? g g g g .3 9 99 07070 07 3 64 64 64 64 6-1 64 6-1 64 6-1 64 6 03 3 3 3 3 3 3 3 3 3 0 3 03 03 .6 S 5 5 5 5 5 4 6 8 4 4-4-4444. 6 6 6 6 6 6 4 4 4 4 4 4 4 34 29 2 3 3 3 30 3 3 3 3 2 2 2 2 2 2 2 46 4 4 34 34 2 2 2 2 2 3 1 28 28 28 29 26 2 2-1 2 2-1 2 2 2 29 30 2 27 27 2 1 20 13 23 22 37 26 24 24 1 3 2 22 24 3. 3 3 3 3 3 3 3 3 3 3 3 3 3 3333333333333333 ohe dek dek ohe ohe ohe ohe ohe ohe ohe ohe ohe ohe ohe dek dek dek dek ohe ohe ohe ohe ohe ohe ohe ohe ohe ohe ohe ohe ohe ohe ohe 35 5 9 1 5 2 8 1 1 5 6 1 1 1 1 0 4 2 5 9 0 5 1 6 9 3 233 5555555555555 55 5 5 5 5 5 5 5 5 56 5 6 5 5 5 .4 .4 .4 4 4 4 4 .4 g g 5 53 .3 3 3 3 3 3 5 4 4 4 3 3 3 fr fr fr fr fr fr fr fr fr fr f f tr-fr fr fr f fr fr fr fr fr , st st st st st st st st st st tut st st st st st st st st st st st st unt st st st st tur sta sta sid sta 66 67 68 69 70 71 23 45 76 7 8 79 80 a 23 45 86 7 8g 90-91 23 45 67 98 205 vuho diesel turbo four 091188.868.955.5 3062 ohc

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions