Starting from:

$30

EE3700 - hw1 - Solved

Derive equation 2.17.

 

Hint: Take the derivative of the sum of squared errors with respect to the two parameters, set them equal to 0, and solve these two equations in two unknowns as:

 

2.    (10%) Assume a disease so rare that it is seen in only one person out of every million. Assume also that we have a test that is effective in that if a person has the disease, there is a 99 percent chance that the test result will be positive; however, the test is not perfect, and there is a one in a thousand chance that the test result will be positive on a healthy person. Assume that a new patient arrives and the test result is positive. What is the probability that the patient has the disease?

3.    (10%) Show that as we move an item from the consequent to the antecedent, confidence can never increase: confidence(ABC→D) ≥ confidence (AB→CD).

4.    (10%) Let us say that we toss a fair coin ten times. What is the probability that we see four to six heads? What is the probability that we see forty to sixty heads when we toss it one hundred times?

5.    (10%) Write the log likelihood for a multinomial sample and show equation

4.6.

 

6.    (10%) Show equation 5.11.

 

Hint: Consider multivariate normal distribution and use covariance matrix as

 



1.    Download Anaconda Individual Edition installer and follow the installing instructions.

2.    After the installation is complete, launch Spyder. Choose File > Open… and open the file hw1.py in the downloaded folder from eeclass. Then you will see the script.

3.    In this homework, you will have to use libraries including numpy and sklearn. To install python libraries, please launch Anaconda Prompt and enter the following command: pip install <library_name>

For example, pip install numpy

You can also install multiple libraries at the same time: pip install numpy sklearn

4.    After installing required libraries, please go back to Spyder. Click Run File in Spyder and you will see some messages shown in the Console.

5.    Click Variable explorer and you will see the information of variables. Double click any variable and observe its data arrangement.

 

Part II. Naive Bayes Classification


Implementation
1.    Open hw1.py in Spyder.

2.    (1%) Write the information of this script at the beginning.

3.    Load the given data file wine.data.

4.    (2%) Print the number of samples in each class.

5.    (5%) Split the data into training set and testing set.

6.    (5%) Standardize the values of each feature dimension.

7.    (5%) Train a Naive Bayes classifier.

8.    (2%) Use the trained classifier to test the testing set.

Report
1.    (10%) Try to apply the parameter random_state in the function sklearn.model_selection.train_test_split and choose different values to it.

a.    What can the parameter random_state do?

b.    Try to assign different values to random_state and observe the accuracies. Would random_state affect the accuracy? Why?

2.    (10%) Try to modify the value of the parameter testset_portion in Main. Note that you should fix the random_state to do the following experiment.

a.    Assign testset_portion with 0.2, 0.5, 0.8, 0.9, 0.98 and compare their corresponding accuracies. What do you observe?

b.    What causes such results?

More products