https://surprise.readthedocs.io/en/stable/

命令行输入参数:
python run.py -r rating.txt -i item_content.txt -p True

SVD on ml-100k

python3 BaselineMF.py -n_factors=50
from __future__ import (absolute_import, division, print_function, unicode_literals)
from surprise import SVDimport surprise
from surprise import Dataset
from surprise import accuracy
from surprise.model_selection import train_test_split
import osif __name__ == '__main__':datapath = '../SharedData/Movie/ml-100k/ml-100k_ratings.dat' file_path = os.path.expanduser(datapath)reader = surprise.Reader(line_format='user item rating timestamp', sep='::')data = Dataset.load_from_file(file_path, reader=reader)trainset, testset = train_test_split(data, test_size=.20)# Use the famous SVD algorithm.algo = SVD()algo.fit(trainset)predictions = algo.test(testset)# Then compute RMSEaccuracy.rmse(predictions)

SVD on Amazon dataset

python3 BaselineMF.py -n_factors 50
from __future__ import (absolute_import, division, print_function, unicode_literals)
from surprise import SVDimport surprise
from surprise import Dataset
from surprise import accuracy
from surprise.model_selection import train_test_split
import osif __name__ == '__main__':datapath = '../SharedData/Movie/aiv/AIV_sorted_ratings.txt'file_path = os.path.expanduser(datapath)reader = surprise.Reader(line_format='user item rating', sep='::')  # aiv-6data = Dataset.load_from_file(file_path, reader=reader)trainset, testset = train_test_split(data, test_size=.20)# Use the famous SVD algorithm.# algo = SVD()algo.fit(trainset)predictions = algo.test(testset)# Then compute RMSEaccuracy.rmse(predictions)

NMF on Amazon dataset

python3 BaselineMF.py -n_factors 50
from __future__ import (absolute_import, division, print_function, unicode_literals)
from surprise import NMFimport surprise
from surprise import Dataset
from surprise import accuracy
from surprise.model_selection import train_test_split
import osif __name__ == '__main__': datapath = '../SharedData/Movie/aiv/AIV_sorted_ratings.txt'file_path = os.path.expanduser(datapath)reader = surprise.Reader(line_format='user item rating timestamp', sep='::')data = Dataset.load_from_file(file_path, reader=reader)trainset, testset = train_test_split(data, test_size=.40)# Use the famous NMF algorithm.algo = NMF()algo.fit(trainset)predictions = algo.test(testset)# Then compute RMSEaccuracy.rmse(predictions)

PMF on Amazon dataset
You can choose to use an unbiased version of SVD algorithm, simply predicting:

CSDN怎么编辑公式
https://blog.csdn.net/gateway6143/article/details/23134225
在线 LaTeX 公式编辑器
https://private.codecogs.com/latex/eqneditor.php

This is equivalent to Probabilistic Matrix Factorization
(:cite:salakhutdinov2008a, section 2) and can be achieved by setting
the biased parameter to False.

execute the module by commend line: **python3 BaselineMF.py -biased False -n_factors 50**from __future__ import (absolute_import, division, print_function, unicode_literals)
from surprise import SVDimport surprise
from surprise import Dataset
from surprise import accuracy
from surprise.model_selection import train_test_split
import osif __name__ == '__main__':datapath = '../SharedData/Movie/aiv/AIV_sorted_ratings.txt'file_path = os.path.expanduser(datapath)reader = surprise.Reader(line_format='user item rating', sep='::')  # aiv-6data = Dataset.load_from_file(file_path, reader=reader)trainset, testset = train_test_split(data, test_size=.40)# Use the famous SVD algorithm.algo = SVD()  # PMF --biased Falsealgo.fit(trainset)predictions = algo.test(testset)# Then compute RMSEaccuracy.rmse(predictions)

Surprise官方文档练习相关推荐

  1. OpenCV-Python官方文档学习笔记(上)

    整理自OpenCV-Python官方文档 一. OpenCV-Python Tutorials 1 安装及验证 2 图片读写,展示 3 视频读写,展示 4 绘图功能(绘制几何形状:线.圆.椭圆.矩形. ...

  2. Ant Design 入门-参照官方文档使用组件

    微信小程序开发交流qq群   173683895    承接微信小程序开发.扫码加微信. 先来一个按钮组件使用的对比,官方文档的(不能直接用)和实际能用的. 官网demo: import { Tabl ...

  3. 坑爹的微软官方文档:SQL无人值守安装

    我在部署项目的时候,需要用批处理无人值守安装SQLserver,.Net等组件. 于是查了微软官方文档,其中一项内容如下: http://msdn.microsoft.com/zh-cn/librar ...

  4. Tomcat官方文档关于数据源配置的内容

    虽然有网上有网友自己总结的文章,但说明得总是不够清晰,还是参考官方文档理解得比较透彻: http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html h ...

  5. python-66:BS4实例--下载BS4官方文档

    2019独角兽企业重金招聘Python工程师标准>>> 前面已经对BS4有了简单的认识和讲解,该讲的都讲了,原本也已经想好了一个实例,但是现在想往后推一推,因为我实在受不了了,我们前 ...

  6. k8s多master建议用几个_Kubernetes 教程之跟着官方文档从零搭建 K8S

    前言 本文将带领读者一起, 参照者 Kubernetes 官方文档, 对其安装部署进行讲解. Kubernetes 更新迭代很快, 书上.网上等教程可能并不能适用于新版本, 但官方文档能. 阅读这篇文 ...

  7. 文件标识符必须为双精度类型的整数值标量_【翻译】VTK官方文档 - vtk文件格式

    本文翻译自vtk官方文档:vtk_file_format 文末有链接 VTK提供了许多源对象和编写器对象,用于读取和写入流行的数据文件格式,此外,VTK也提供了自己的文件格式.创建一种数据文件格式的主 ...

  8. 深入理解Java 8 Lambda表达式(Oracle官方文档版)

    Java 8 问世三年了,9马上也要问世了,所以,嗯,我要开始学8了-- 官方文档:http://docs.oracle.com/javase/tutorial/java/javaOO/lambdae ...

  9. 《Redis官方文档》用Redis构建分布式锁

    <Redis官方文档>用Redis构建分布式锁 用Redis构建分布式锁 在不同进程需要互斥地访问共享资源时,分布式锁是一种非常有用的技术手段. 有很多三方库和文章描述如何用Redis实现 ...

  10. python数据科学和机器学习常用库的官方文档

    文章目录 Matplotlib Numpy Pandas sklearn sklearn_crfsuite SciPy Matplotlib 进入matplotlib官网地址:https://matp ...

最新文章

  1. Head First JSP---随笔六
  2. 如何迁移完整SQL数据库到另外一台服务器
  3. c++中非静态函数不能用类名调用,为什么CWnd的成员函数GetDC()可以直接调用啊?
  4. 天下会-百度搜索技巧语法大全
  5. VS工程,换电脑后出现的问题
  6. 为什么最近「骚扰电话」明显越来越多了?
  7. docker redis 删除集群_基于Docker的Redis集群实践
  8. dell r740如何做raid_数据存储之七种RAID浅析
  9. 夏普ar2048s打印机驱动安装_无光盘,轻松解决各种打印机的驱动安装
  10. Python数值分析案例01--------四阶龙格库塔法解抛体运动
  11. mybatisplus删除操作引起的selectBatchIds报错
  12. 运维就是一场没有硝烟的战争
  13. 查询攻略,将多个退回延误的快递单号物流设置分类
  14. 选择模型 _ 审查回归算法
  15. JSM之ActivityMQ
  16. 购买安防监控摄像头时如何省钱
  17. 从无秘和知乎看中国社交产品的特点
  18. AXI总线核心解读---基于官方文档
  19. Simpsons’ Hidden Talents (HDU-2594)
  20. Office Online Server概述

热门文章

  1. 转载:如果你到了20岁,还没到 25岁 作者:李开复
  2. HDU 1398 Square Coins
  3. 课时46:魔法方法:描述符(property的原理)
  4. ssm整合之配置applicationContext-service.xml
  5. 25深入理解C指针之---传递数组
  6. 2039 骑马修栅栏
  7. PostgreSQL数据库的安装与配置
  8. php扩展php_curl windows 安装问题
  9. C语言链表与malloc函数
  10. ASP.NET 事件(回传)机制