Lzk0821 2021-09-27 21:40 采纳率: 0%
浏览 455
已结题

pytorch相关问题求解答,可有偿

In this assignment, we will perform several linear regression analyses on the
Boston dataset. Load the dataset as follows (requires installing the scikit-learn
library) and read the description:

from sklearn import datasets
boston = datasets . load_boston ()
print ( boston . DESCR )
The dataset contains 506 observations of 13 features, with the target value being
the median value of homes. Load the observations and targets into separate
numpy arrays:
data = boston . data
target = boston . target
We will use the first 450 observations as training data and the remaining 56 as
testing data:
X_train = data [:450 ,]
y_train = target [:450 ,]
X_test = data [450:,]
y_test = target [450:,]

Note: Please use torch to complete the problems in this assignment.

Problem 1
(10 points) Explore some of the relationships between the features of the data.
Which features appear to have the strongest relationship with the target? Which
features have the weakest relationship? Use a few plots to describe the data and
these relationships.

Problem 2
(20 points) Perform a multivariate linear regression on the Boston dataset without regularization. Report the coefficients of your trained model. Report the
following testing error metrics: RMSE, MAPE, MAE, MBE, R2
. Use plots to
show how your model performs.

Problem 3
(20 points) Perform a linear regression on the Boston dataset with l2-norm
regularization (i.e., ridge regression). Report the results as before.

Problem 4
(20 points) Perform a linear regression on the Boston datset with l1-norm regularization (i.e., lasso). Report the results as before. Compare the performances
of the three models from Problems 2, 3, and 4 and comment on the results.

Problem 5

(30 points) Perform a non-regularized linear regression on the Boston dataset
using 5-fold cross validation. Report the results as before. Does the non-regularized model perform better with or without cross-validation? Does this
agree with your expectations?
Note: If the size of the dataset is not evenly divisible by the number of folds
k, you may need to either (1) choose a different value for k or (2) exclude some
observations from the dataset in order to use np.split() as we discussed in
class.


  • 写回答

1条回答 默认 最新

  • 小木木木木木mu 2021-09-28 11:12
    关注

    第一题可以贝叶斯计算或者决策树也行
    后面几个题就是逻辑回归加上l1或l2正则或不加正则三个结果,最后比较一下,然后5折交叉验证
    不过还真没用pytorch去写过这些,不都是sklearn吗,而且题目要求是torch,并不是pytorch

    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 10月1日
  • 赞助了问题酬金 9月28日
  • 赞助了问题酬金 9月28日
  • 赞助了问题酬金 9月27日
  • 展开全部

悬赏问题

  • ¥15 数据库数据成问号了,前台查询正常,数据库查询是?号
  • ¥15 算法使用了tf-idf,用手肘图确定k值确定不了,第四轮廓系数又太小才有0.006088746097507285,如何解决?(相关搜索:数据处理)
  • ¥15 彩灯控制电路,会的加我QQ1482956179
  • ¥200 相机拍直接转存到电脑上 立拍立穿无线局域网传
  • ¥15 (关键词-电路设计)
  • ¥15 如何解决MIPS计算是否溢出
  • ¥15 vue中我代理了iframe,iframe却走的是路由,没有显示该显示的网站,这个该如何处理
  • ¥15 操作系统相关算法中while();的含义
  • ¥15 CNVcaller安装后无法找到文件
  • ¥15 visual studio2022中文乱码无法解决