Question: make fuel-type aspiration num-of-doors body-style drive-wheels engine-location wheel-base length width height curb-weight engine-type num-of-cylinders engine-size fuel-system bore stroke compression-ratio horsepower peak-rpm city-mpg highway-mpg price alfa-romero

make fuel-type aspiration num-of-doors body-style drive-wheels engine-location wheel-base length width height curb-weight engine-type num-of-cylinders engine-size fuel-system bore stroke compression-ratio horsepower peak-rpm city-mpg highway-mpg price
alfa-romero gas std two convertible rwd front 88.6 168.8 64.1 48.8 2548 dohc four 130 mpfi 3.47 2.68 9 111 5000 21 27 13495
alfa-romero gas std two convertible rwd front 88.6 168.8 64.1 48.8 2548 dohc four 130 mpfi 3.47 2.68 9 111 5000 21 27 16500
alfa-romero gas std two hatchback rwd front 94.5 171.2 65.5 52.4 2823 ohcv six 152 mpfi 2.68 3.47 9 154 5000 19 26 16500
audi gas std four sedan fwd front 99.8 176.6 66.2 54.3 2337 ohc four 109 mpfi 3.19 3.4 10 102 5500 24 30 13950
audi gas std four sedan 4wd front 99.4 176.6 66.4 54.3 2824 ohc five 136 mpfi 3.19 3.4 8 115 5500 18 22 17450

The asker has provided data called cars.csv . He wants me to come up with an algorithm in Python 3 using Pandas to:

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 a make fuel-type aspiration num-of-doors body-style drive-wheels engine-location wheel-base length width height , computes the conditional probability of that aspiration, given each of the makes: P(aspiration=a|model=m)curb-weight engine-type num-of-cylinders engine-size fuel-system bore stroke compression-ratio horsepower peak-rpm city-mpg highway-mpg
  3. Displays the conditional probabilities to the screen.
  4. Computes the probability of each make and outputs to the screen. I have attached a snippet of the csv file. I cannot upload it as a csv, just

price alfa-romero gas std two convertible rwd front 88.6 168.8 64.1 48.8

2548 dohc four 130 mpfi 3.47 2.68 9 111 5000 21 27

13495 alfa-romero gas std two convertible rwd front 88.6 168.8 64.1 48.8

2548 dohc four 130 mpfi 3.47 2.68 9 111 5000 21 27

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 ty in data, with the data. Formally, probability either due to a lack of sufficient data or some in of each outcome x is a value, p(x), that satisfies the following pr 1. Vx e n (p) [0,1) (each probability value has to be between zero and one) and (sum of all probabilities needs to be one) A set of outcomes defines an event. The probability of an event E is defined as PCE)- 2 it is necessary to estimate probabilities from data. If the data contains nominal (i.e. In many categorical) values, we can estimate the pro 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 i having a particular value x can be computed as of a particle value occurring in the data by counting the n (instances with feature,x) P(feature,x We can also the conditional probability of a particular feature value, given some other features values as P(reature, -xifeature, (nstances with f feature x and feature #(feature,-f) Note that the denominator is assumed to be non-zero. Such estimates can then be used for various data analysis 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 a, comput You are tes the conditional probability of that aspiration, given each of the P(aspiration almodelm) makes: Displays the conditional probabilities to the screen. Computes the probability of each make and outputs to the scren. 3. Additional Requirements 1. 2. The name of your source code file should be ProbEst.py. All your code should be within a single file. 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 Your code should follow good coding practices, including good use of whitespace and use of both inline and block 3. identifier names that conform to standard naming conventions You need to use 4. 5. 6. 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. The output of your program should exactly match the sample program output given at the end. What to Turn In You will turn in the single ProbEst.py file using BlackBoard Sample Program Output CPSC-51160, [senester] [year] NAME: [put your name here] PROGRAMNG ASSIGNMENT #4 Prob(aspirationstd|make-alfa-romero) -100.00% Prob(aspiration.turbolmake-alfa-ronero)-.00% Prob(aspiration-std|makeaudi) 71.43% Prob(aspiration.turbolnakeaudi) -28.57% Prob(aspiration-std I make-bm) . 1ee.ee% Prob(aspiration.turbolmake.bm)e.ee% Prob(aspiration.std I make-chevrolet)-100.08% Prob(aspiration"turbolmake-chevrolet)-0.00% Prob(aspirationstd[make-dodge) . 66.67% Prob(aspiration.turbolmake.dodge) . 33.33% Prob(aspiration-stdInake.honda) -1ee.ee% Prob(aspiration-turbolmake-honda) -0.00% Prob(aspiration std Imake-isuzu)100.eex Prob(aspiration turbo make-isuzu) e.eex Prob(aspiration std make-jaguar)100.eex Prob(aspiration-turbo make-jaguar) e.eex Prob(aspiration std make-mazda) 180.eex Prob(aspiration-turbo make-mazda) 8.eex Prob(aspiration std make-nercedes-benz) se.eex Prob(aspiration.turbolmake-mercedes-benz) -se.ee% Prob(aspiration-stdInake.mercury) -e.ee% Prob(aspiration-turbo I make-nercury) -lee . ee% Prob(aspiration#5td|make-mitsubishi) -53.8SX Prob(aspiration-turbolmake-mitsubishi)-46.15% Prob(aspiration-std [make-nissan) -94.44% Prob(aspiration-turbo nake nissan) S.56x Prob(aspiration-std! make-peugot) -45.45% Prob(aspiration.turbolmake-peugot) -54.55% Prob(aspiration.std [make-plymouth) -71.43% Prob(aspiration.turbolnake-plymouth) -28.57% Prob(aspiration. std I make-porsche) -100 . ee% Prob(aspiration-turbolnake-porsche)-0.0ex Prob(aspirations std|make-renault) " 100.00% Prob(aspiration-turbo Inake renault) -8.8e Prob(aspiration,std I make-saab) -66.67% Prob(aspiration-turbo I make-saab) -33.33% Prob(aspiration-std[makesubaru)-83.33% Prob(aspirationsturbo I make. subaru)-16.67% Prob(aspiration-std[make-toyota) -96.88% Prob(aspiration turbolmake toyota) 3.123 Prob(aspiration-stdInake"volkswagen) . 83.33% Prob(aspiration turbolmake. volkswagen)-26.67% Prob(aspiration-std,make-volvo) -54.55% prob(aspiration turbolmake volvo) 45 Prob(make-alfa-romero) . 1.46% Prob(make-audi)-3.41% Prob(make-bm) . 3.98% 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) e-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%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!