Question: Hi, i wanted the solution for these two questions. Even if you have solution for one of them, it would be of great help. Thankyou

 Hi, i wanted the solution for these two questions. Even if
Hi,
i wanted the solution for these two questions.
Even if you have solution for one of them, it would be of great help.
Thankyou

.11 Sprint Wi-Fi 7:50 PM Assignment 3.pdf 1- Suppose that we want to classify patients to healthy or not healthy based on physicians' notes. For example, we have the folowing set of mini-notes, each labeled healthy (-1) or not heakhy+1) 1. -1) negative results 2. -1) good response 3. (+1ot good 4. (+1) negative reaction Each note x is mapped ontofeature vector (x), which maps each word to the number of occurrences of that word in the note. For example, the first note maps to the (sparse) feature vector (x) {negative: 1. test:L results: 1) Recall the defniton of the hinge loss (Losssng'(x, y, w . max(0.1-w-$(r)yl, where y is the correct label al Suppose we run stochastic gradient descent, updating the weights according to ww-ayir_LossAnge(x, y, w), once for each of the four examples in order. After the classifier is trained on the given four data points, what are the weights of the sx words negative, ood, sults, ot"response "reaction") that appear in the above notes? Use = 1 as the step size and intialize w . ..Assume that T,Loss ingey w)-O when the margin is exactly 1 b) Create a small labeled dataset of four mini-notes about patients' test results using the words net", "negative, and positive, where the labels make intuitive sense (Note that if the test results are negative, or not postive, it means that the patient is healthyl. Each note should contain one or two words, and no repeated words. Prove that no inear classifier using word features can get zero error on your dataset. Propose a single additional feature that we could augment the feature vector with that would fix this problem 2- In this problem, we will buld a binary linear classifier that reads physician notes and guesses whether the patients are having heart problems(+2) r mot(-1. ln this problem, you wil use the test and train fles provided for you (train.csw and test.esw) Also, you must implement the functions without using Ibraries Iike Scilit-learn. al Suppose that we will use a predictor that takes note x and returns sign(w )Suppose that we wish to use the hinge loss. Wnite out the expression for Lsngxy,w) b) Compute the gradient of the loss c) Assumingy 1, what is the largest magnitude that the gradient can take? That ks, find a way to set w to make 1Loss (x,y,w)1 as big as possible Leave your answer in terms of 10()I d) Implement the function extractWordFeatures, which takes a note (stringe) as input and returns a feature vector (x) (represent the vector (x) as dictionary in Pychon). e) Implement the function leamPredictor using stochastic gradient descent and minimize the hinge loss Print the training error and test error after each iteration to make sure your code is working. ) Create an artificial dataset for your leamPredictor function by writing the enerateExample function (nested in the generateDataset function). Use this to double Open with Print .11 Sprint Wi-Fi 7:50 PM Assignment 3.pdf 1- Suppose that we want to classify patients to healthy or not healthy based on physicians' notes. For example, we have the folowing set of mini-notes, each labeled healthy (-1) or not heakhy+1) 1. -1) negative results 2. -1) good response 3. (+1ot good 4. (+1) negative reaction Each note x is mapped ontofeature vector (x), which maps each word to the number of occurrences of that word in the note. For example, the first note maps to the (sparse) feature vector (x) {negative: 1. test:L results: 1) Recall the defniton of the hinge loss (Losssng'(x, y, w . max(0.1-w-$(r)yl, where y is the correct label al Suppose we run stochastic gradient descent, updating the weights according to ww-ayir_LossAnge(x, y, w), once for each of the four examples in order. After the classifier is trained on the given four data points, what are the weights of the sx words negative, ood, sults, ot"response "reaction") that appear in the above notes? Use = 1 as the step size and intialize w . ..Assume that T,Loss ingey w)-O when the margin is exactly 1 b) Create a small labeled dataset of four mini-notes about patients' test results using the words net", "negative, and positive, where the labels make intuitive sense (Note that if the test results are negative, or not postive, it means that the patient is healthyl. Each note should contain one or two words, and no repeated words. Prove that no inear classifier using word features can get zero error on your dataset. Propose a single additional feature that we could augment the feature vector with that would fix this problem 2- In this problem, we will buld a binary linear classifier that reads physician notes and guesses whether the patients are having heart problems(+2) r mot(-1. ln this problem, you wil use the test and train fles provided for you (train.csw and test.esw) Also, you must implement the functions without using Ibraries Iike Scilit-learn. al Suppose that we will use a predictor that takes note x and returns sign(w )Suppose that we wish to use the hinge loss. Wnite out the expression for Lsngxy,w) b) Compute the gradient of the loss c) Assumingy 1, what is the largest magnitude that the gradient can take? That ks, find a way to set w to make 1Loss (x,y,w)1 as big as possible Leave your answer in terms of 10()I d) Implement the function extractWordFeatures, which takes a note (stringe) as input and returns a feature vector (x) (represent the vector (x) as dictionary in Pychon). e) Implement the function leamPredictor using stochastic gradient descent and minimize the hinge loss Print the training error and test error after each iteration to make sure your code is working. ) Create an artificial dataset for your leamPredictor function by writing the enerateExample function (nested in the generateDataset function). Use this to double Open with Print

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!