Question

Consider the table given below. It contains the movie ratings of a single user. There are 15 movies and we also have four mov

Rating 4.9 ? 3 2.1 4.3 5 ? Movie П M2 M3 M4 M5 M6 M7 MS M9 M10 П1 M12 M13 M14 M15 Romance 0.8 0.7 0.3 0.001 0.2 0.5 0.002 0.2

I need a code written on PYTHON LANGUAGE, you can use any class in scikit. Below, you can see the "Movie Rate.txt" provided. Can you solve this question? I will give thumbs up

4.9 -1 3 2.1 4.3 5 -1 1 5 3.4 -1 4 1 2 5 0.8 0.7 0.3 0.001 8.2 8.5 0.002 0.2 0.99 0.001 0.90 0.5 0.001 0.4 0.88 0.06 0.6 0.88

0 0
Add a comment Improve this question Transcribed image text
Answer #1

**I HAVE ANSWER THE QUESTION FIRST AND THEN GIVE THE CODE. IF YOU DON'T NEED THE CODE YOU CAN SKIP IT.

1. It is a regression problem because we have to predict the movie rating which can be in range 0-5 and in any fractional value.

2. Learned parameters

 [-0.88396343 -3.3650339 -0.12833597 -2.67356581]

3.

Rating prediction for M2: 1.97688151

Rating prediction for M7: 1.39717038

Rating prediction for M11: 3.9678044

PYTHON CODE:

#import libaries
import pandas as pd
from sklearn import linear_model

#load the data into datframe
df = pd.read_csv('Movie Rate.txt',sep='\t',header=None)
print(df)

#row 2 7 11 has the rating value ?
#except these all are the train set
train_set = df.drop([2,7,11])
#we have to preicct the rating
#i.e column 0 it is Y
Y_train = train_set.iloc[:,0]
#other rows are X
X_train = train_set.iloc[:,1:5]
X_train

#row 2 7 11 has the rating value ?
#thse are test value we have to predict
test_set = df.iloc[[2,7,11],:]
X_test = test_set.iloc[:,1:5]
#No Y_test we have to predict it

#simple linear regression model
reg = linear_model.LinearRegression()
reg.fit(X_train,Y_train)

#learnt paramenters
print(reg.coef_)

#predction for M2,M7,M11
Y_pred = reg.predict(X_test)
print(Y_pred)

File Edit View Insert Cell Kernel Help Trusted Python 3 Run + e Code In [82]: #import Libaries import pandas as pd from sklea

*IF YOU GET ANY ERROR READING THE FILE PLEASE INSERT A TAB BETWEEN THE DATA IN Movie Rate.txt FILE

Add a comment
Know the answer?
Add Answer to:
I need a code written on PYTHON LANGUAGE, you can use any class in scikit. Below,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I'm trying to solve this differential equations by using matlab and I've got a plot from the code attached. But...

    I'm trying to solve this differential equations by using matlab and I've got a plot from the code attached. But I wanna get a plot of completely sinusoidal form. If I can magnify the plot and expand x-axis, maybe we can get the sinusoidal form. So help me with this problem by using matlab. Example is attached in below. One is the plot from this code and another is example. function second_order_ode2 t=[0:0.001:1]; initial_x=0; initial_dxdt=0; [t,x]=ode45(@rhs,t,[initial_x initial_dxdt]); plot(t,x(:,1)) xlabel('t') ylabel('x')...

  • I'm trying to solve this differential equations by using matlab and I've got a plot from the code attached. But...

    I'm trying to solve this differential equations by using matlab and I've got a plot from the code attached. But I wanna get a plot of completely sinusoidal form. If I can magnify the plot and expand x-axis, maybe we can get the sinusoidal form. So help me with this problem by using matlab. Example is attached in below. One is the plot from this code and another is example. function second_order_ode2 t=[0:0.001:1]; initial_x=0; initial_dxdt=0; [t,x]=ode45(@rhs,t,[initial_x initial_dxdt]); plot(t,x(:,1)) xlabel('t') ylabel('x')...

  • The number of successes and the sample size for a simple random sample from a population...

    The number of successes and the sample size for a simple random sample from a population are given below. X=7, n=28, Hop=0.2, H. p> 0.2, a=0.05 a. Determine the sample proportion b. Decide whether using the one proportion z-test is appropriate. c. If appropriate, use the one proportion z-test to perform the specified hypothesis test. Click here to view a table of areas under the standard normal curve for negative values of z. Click here to view a table of...

  • Question 3 (9 marks) Consider the following information about a non-dividend paying stock: The current stock...

    Question 3 (9 marks) Consider the following information about a non-dividend paying stock: The current stock price is $36, and its return standard deviation is 30% per year. The continuous compound risk-free rate is 3% per year. Assume that the Black-Scholes model correctly prices all the options written on the stock given the information above. a). A call option written on the stock expires in 1 year and has an exercise price of $36. Calculate the Black-Scholes value of the...

  • Please give detailed explanation how you got answers. Thank you in advance. Z table is included....

    Please give detailed explanation how you got answers. Thank you in advance. Z table is included. please show steps how to derive to answer. Thank you, experts. 4. Find the following probabilities based on the standard normal variable Z. (You may find reference the z table. Round your answers to 4 decimal places.) 3.33 Doints 0.7881 0.0096 a. P(Z >08) b. PIZ-2.34) C. POSZ $ 1.57) d. P(-0.73SZ S2.81) eBook References MC Graw Hill < Prey Enfrey Next > Type...

  • I need solution thank you! you can use these tables and formulas. 2. The heights for...

    I need solution thank you! you can use these tables and formulas. 2. The heights for 5 year boys are normally distributed with a mean height of 43 inches and a standard deviation of 5.3 inches. A sample of 60 boys is randomly selected. Find (a) (8 points) The probability that mean height of boys for the sample of 60 boys is between 41 inches and 45 inches. (b) (5 points) The height of a boy that corresponds to the...

  • I believe 0.0587 is the answer but i want to be sure! thank you Let x...

    I believe 0.0587 is the answer but i want to be sure! thank you Let x be a continuous random variable with a standard normal distribution. Using the accompanying standard normal distribution table, find P(1.34 SXS 1.86). Click the icon to view the standard normal distribution table. Areas for a Standard Normal Distribution P(1.34 SXS 1.86) = 0.0587 (Round to four decimal places as needed.) Entries in the table represent area under the curve between z= 0 and a positive...

  • please do 1 through 4. Thank you. 0 1. Fe 1.SCN Procedure B: 1. Prepare ICE...

    please do 1 through 4. Thank you. 0 1. Fe 1.SCN Procedure B: 1. Prepare ICE tables for beakers 2 - 6 using the example below as a guideline (you will have 5 different ICE tables). Table 3. Sample "ICE" table. Fe(aq)*3 + SCN(aq) = FeSCN2 Initial: **M calculated **M calculated using your Table 2 using your Table 2 volumes volumes Change: - 1x - 1x Equilibrium: M 1x 1x = concentration calculated from Procedure A slope-intercept equation +1x M...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT