#๐Ÿ”’ Data Bases, Data Science,

4 messages ยท Page 1 of 1 (latest)

iron mountain
#
Define positive_revenue_df as the subset of movies in df with revenue greater than zero.
Code is provided below that creates new instances of model objects. Replace all instances of df with positive_revenue_df, and run the given code.
Use this code to get started:







      positive_revenue_df = 

# Replace the dataframe in the following code, and run.
regression_outcome = df[regression_target]
classification_outcome = df[classification_target]
covariates = df[all_covariates]

# Reinstantiate all regression models and classifiers.
linear_regression = LinearRegression()
logistic_regression = LogisticRegression()
forest_regression = RandomForestRegressor(max_depth=4, random_state=0)
forest_classifier = RandomForestClassifier(max_depth=4, random_state=0)
linear_regression_scores = cross_val_score(linear_regression, covariates, regression_outcome, cv=10, scoring=correlation)
forest_regression_scores = cross_val_score(forest_regression, covariates, regression_outcome, cv=10, scoring=correlation)
logistic_regression_scores = cross_val_score(logistic_regression, covariates, classification_outcome, cv=10, scoring=accuracy)
forest_classification_scores = cross_val_score(forest_classifier, covariates, classification_outcome, cv=10, scoring=accuracy)
    
What is the mean of the 10 cross validation scores for random forest regression?
 
It appears that the variables budget, popularity, runtime, vote_count, and revenue are all right-skewed. In Exercise 6, we will transform these variables to eliminate this skewness. Specifically, we will use the np.log10() method. Because some of these variable values are exactly 0, we will add a small positive value to each to ensure it is defined; this is necessary because log(0) is negative infinity.

Instructions
For each above-mentioned variable in df, transform value x into np.log10(1+x).

What is the new value of skew() for the covariate runtime? Please provide the answer to 3 decimal points
mortal vaporBOT
#

@iron mountain

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

mortal vaporBOT
#

@iron mountain

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.