![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
Henry Fox
这个作者很懒,什么都没留下…
展开
-
cython在windows下long格式的处理 2022-05-20
由于cython中,long在linux和windows下的含义不同,因此在windows中需要修改一下对应的类型名称,如下图所示。原创 2022-05-20 16:25:02 · 227 阅读 · 1 评论 -
Python版本gurobi实例 2022-03-01
gurobi是一个用来进行优化的程序,可以求解优化问题。有python版本接口。例子(来自 https://www.gurobi.com/documentation/9.5/quickstart_mac/cs_example_mip1_py.html ):import gurobipy as gpfrom gurobipy import GRBtry: # Create a new model m = gp.Model("mip1") # Create variable转载 2022-03-01 16:19:11 · 448 阅读 · 0 评论 -
不同机器迁移venv(Ubuntu下) 2021-12-13
需要先安装一样的python包,具体安装方法可以参考:https://blog.csdn.net/qq_36243169/article/details/121913457接着需要保证venv/bin/activate里面的路径正确,即VIRTUAL_ENV="venv的完整路径"接下来尝试,如果报错:python: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No原创 2021-12-13 21:06:53 · 1090 阅读 · 0 评论 -
Ubuntu16.04 安装python3.6 2021-12-13
由于Ubuntu16.04已经很老了,安装python3.6的时候会出一系列问题,在此作一记录。apt搜不到python3.6解决:直接用 https://www.php.cn/python-tutorials-416841.html 的方法,通过sudo add-apt-repository ppa:deadsnakes/ppa,sudo apt update,sudo apt install python3.6进行安装提示add-apt-repository找不到命令解决:按照 htt原创 2021-12-13 20:26:54 · 1440 阅读 · 0 评论 -
jupyter lab安装和使用 2021-12-09
https://www.cnblogs.com/Tsingwaa/p/14681660.html转载 2021-12-09 20:52:10 · 228 阅读 · 0 评论 -
ubuntu系统python版本引发的血案 2021-12-05
今日闲的蛋疼,想要升级一下ubuntu16.04服务器上的python版本(现在装的是python3.5,但心血来潮想装python3.10体验一下),结果引发了一连串血案。python3.10的安装:添加ppa:sudo add-apt-repository ppa:deadsnakes/ppa,执行后回车等一会;sudo apt updatesudo apt install python3.10python3.10的问题及卸载:pip的时候出问题:AttributeError: m原创 2021-12-06 00:24:03 · 1468 阅读 · 0 评论 -
Anaconda环境用户权限 2021-12-01
背景:anaconda是在公用账户上装的,默认设置下anaconda的环境权限不在我的账号下,所以用自己账号的时候会报错。解决:用sudo chown -R 用户名 /home/公用账户/anaconda3/envs/环境名原创 2021-12-01 13:46:53 · 2234 阅读 · 0 评论 -
个人网站seafile+nginx配置 2021-10-16
开启了一个seafile服务,用的是 https://cloud.seafile.com/published/seafile-manual-cn/docker/%E7%94%A8Docker%E9%83%A8%E7%BD%B2Seafile.md ,端口映射为 8888:80 ,nginx中设置为: server { listen 80; server_name IP地址; location / { root原创 2021-10-16 00:37:06 · 719 阅读 · 0 评论 -
迁移学习 相关资料 2021-09-18
龙明盛组:Transfer Learning Library: https://github.com/thuml/Transfer-Learning-Library说明: http://170.106.108.162/get_started/quickstart.htmlTransfer Learning PPT: http://ise.thss.tsinghua.edu.cn/~mlong/doc/transfer-learning-theories-and-algorithms-ccdm2原创 2021-09-21 17:14:27 · 148 阅读 · 0 评论 -
python caching_sha2_password问题 2021-09-15
我有一个Django项目链接了MySQL8数据库,采用的连接方式是默认的caching_sha2_password。在Windows电脑下没有问题,但在mac下报错:django.db.utils.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/Cellar/mysql-connector-c/6.1.11/lib/plugin/cach原创 2021-09-15 23:28:45 · 643 阅读 · 0 评论 -
pytorch中的稀疏矩阵 2021-09-07
pytorch的系数矩阵结构包括:torch_sparse.tensor.SparseTensor: 该结构非pytorch官方给出的数据结构,在torch_geometric等包中使用。可以通过.to_torch_sparse_coo_tensor()转换为下面的COO tensor(coordinate)结构。torch.sparse包中存在的几种数据结构,详情见 https://pytorch.org/docs/stable/sparse.html 。包括torch.sparse_coo_ten原创 2021-09-07 13:22:04 · 1954 阅读 · 2 评论 -
pytorch模型列表的处理 2021-09-06
在pytorch中可能层数不确定,需要用一个列表的形式进行模型构建。如果直接在Module里面写self.xx=[层1,层2]这样就不能将这些参数放到模型可训练参数列表中。需要用self.xx=torch.nn.ModuleList([层1,层2])...原创 2021-09-06 14:06:06 · 412 阅读 · 0 评论 -
MySQL enum和set类型 及 Django实现
mysql中enum和set类型https://segmentfault.com/a/1190000019795336enum类型是将enum内容在内部存储为一个整数(普通整数,1-2个字节),而set类型使用one-hot形式表示某个值(二进制one-hot形式),用位运算实现set操作。利用django-mysql实现enum field对应:https://django-mysql.readthedocs.io/en/latest/model_fields/enum_field.html原创 2021-09-04 18:04:15 · 311 阅读 · 0 评论 -
Swagger-软件开发接口 2021-09-02
三分钟快速掌握Swagger入门技巧 - Java程序员一枚的文章 - 知乎https://zhuanlan.zhihu.com/p/108613903前后端分离的情况下,用swagger约定接口并且进行测试,是很好的选择。如果使用flask,可以考虑用flasgger。 https://blog.csdn.net/weixin_42290927/article/details/101543298...原创 2021-09-02 16:39:31 · 93 阅读 · 0 评论 -
python多文件共享变量 2021-09-02
https://blog.csdn.net/weicao1990/article/details/88989362专门放一个共享变量的conf.py文件,之后用的时候必须import conf,不能from conf import xxx转载 2021-09-02 16:16:05 · 659 阅读 · 0 评论 -
GNN包torch_geometric使用 2021-09-02
torch_geometric包是一个进行GNN实现的非常方便的包,官网是 https://pytorch-geometric.readthedocs.io/en/latest/notes/introduction.html数据集格式使用的数据集的格式如下例所示:>>> import torch>>> from torch_geometric.data import Data>>> edge_index = torch.tensor([[0,原创 2021-09-02 16:13:48 · 2048 阅读 · 5 评论 -
PCA 2021-06-04
https://youtu.be/FgakZw6K1QQ先进行平移:目标:最大化投影点到原点的距离平方和,或者到直线的距离的平方和,这两个等价,因为勾股原理。对PC1的分析:转载 2021-08-27 01:31:35 · 65 阅读 · 0 评论 -
Ridge Regression 2021-05-30
https://youtu.be/Q81RR3yKn30数据集里面,训练集训出来的模型在测试集上效果不好。这是因为数据没有很好的代表性,把斜率带偏了。在这个例子里面,通过加上正则项,使得最后的结果斜率更低。如果是参数比较大,自变量的变化会导致因变量变化很大。所以要对参数限制。得到的模型斜率比较低,所以预测结果对于斜率的敏感性比较低。在ridge regression里面,如果要求截距也是很小,就会导致0点处基本为0。所以不会这样要求。普通的线性回归的数据量应该大于参数量,但是用Ridg转载 2021-08-27 01:30:16 · 95 阅读 · 0 评论 -
偏差(bias)方差(variance) 2021-05-30
https://youtu.be/EuBBz3bI-aA数据点里面,蓝色表示训练集,绿色表示测试集,中间的曲线表示ground truth。Bias:The inability for a machine learing method to capture the true relationship is called bias. 无法捕获真实关系线性模型怎样都不能拟合数据,所以bias比较大。波浪线可以很好地拟合数据点,所以bias很小。但是如果考虑测试集,会发现测试集上反而是线性模型更好转载 2021-08-27 01:28:43 · 216 阅读 · 0 评论 -
markdown写PPT 2021-08-21
此前有一些markdown写ppt的程序,如marp( https://zhuanlan.zhihu.com/p/149521766 )但这些工具大都是生成pdf或者html,而不是直接生成ppt文件。所以可以尝试使用 https://github.com/MartinPacker/md2pptx原创 2021-08-21 22:56:23 · 232 阅读 · 0 评论 -
pytorch升级conflict
由于在pytorch1.8.1环境下安装了pytorch-geometric,导致升级pytorch的时候出现问题:解决方案:先卸载pytorch-geometric(conda uninstall pytorch-geometric),安装新版pytorch(conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch)后再安装pytorch-geometric(conda install pytorch-geomet原创 2021-08-20 08:52:00 · 282 阅读 · 0 评论 -
python安装yaml
需要使用pyyaml而不是yaml原创 2021-08-19 17:35:05 · 1374 阅读 · 0 评论 -
Selenium下载PDF文件实战 2021-07-21
文章目录文件下载的Selenium配置文件名修改按钮点击出错示例根据`Xpath`获取内容打开所有折叠的session标签获取所有session的论文列表数据保存下载文件&重命名文件下载的Selenium配置由于打开PDF文件网页时,可能会直接打开PDF预览页面,所以需要用:from selenium import webdriverdownload_dir = r"C:\Users\xxx\Desktop"options = webdriver.ChromeOptions()opti原创 2021-07-21 17:37:45 · 3775 阅读 · 0 评论 -
网页图片下载并编辑为单个文件 2021-07-20
百度文库开通了VIP之后发现VIP文档下载特权只能下载两篇,感觉非常不爽。在网站 https://wenku.baidu.com/view/556bf8b430126edb6f1aff00bed5b9f3f90f72b8.html 尝试了一下。每个页面都是一个图片,所以可以直接下载单个图片拼起来。具体方法:先点击加载把所有页面都读取出来;在console执行:items = document.getElementsByClassName("ppt-page-item")imglist = [];原创 2021-07-20 13:19:00 · 116 阅读 · 0 评论 -
Flask开发相关 2021-07-18
Flask开发过程中的一些记录原创 2021-07-18 20:25:18 · 150 阅读 · 0 评论 -
Antlr4安装与使用(包括python3与C++版本) 2018-12-21
文章目录安装Ubuntu安装Windows安装使用g4部分python部分示例:Visitor实现四则运算的计算C++版本官方demo创建自己的项目ANTLR的lib生成LIB介绍LIB创建LIB使用-引用LIB使用-复制LIB文件ANTLR的lib生成安装Ubuntu安装安装方法:(来自官网首页,Quick Start)$ cd /usr/local/lib$ wget https://www.antlr.org/download/antlr-4.7.2-complete.jar$ expor原创 2021-07-18 17:21:44 · 1695 阅读 · 0 评论 -
Mac Neo4j安装与使用 2020-05-09
关于图数据库的一些介绍https://www.cnblogs.com/mantoudev/p/10414495.html摘录一下:图数据很多,图数据库比普通的要更快neo4j的教程在:https://www.w3cschool.cn/neo4j/Neo4j安装到https://neo4j.com/,点右上角的 DOWNLOAD NEO4J就行。之后填一个表(表单加载挺慢的,得等会),就能下载了。会给一个激活密钥。我用的Mac,下载链接:https://neo4j.com/artifact.原创 2021-07-18 17:15:23 · 1266 阅读 · 0 评论 -
微信公众号第三方配置、接口及模板 2018-10-17
微信官方给出的开发文档中Start Up部分:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1472017492_58YV5具体实现可以参考:https://github.com/ThssSE/WeChatTicket/blob/master/wechat下面也将用上述工程中的部分代码说明。接口测试公众号申请地址:http://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/l原创 2021-07-18 16:41:25 · 657 阅读 · 0 评论 -
微信公众号开发入门 django 2020-04-26
测试号微信公众号平台的说明:https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Overview.html去注册一个测试号:测试号注册的网页服务器上前面的准备工作可以看:阿里云windows服务器配置服务器可以到这里买:新用户74元/年的云服务器:阿里云学生机,10元/月的云服务器:阿里云学生机参考了https://blog.csdn.net/u013205877/article/details/7760285原创 2021-07-18 16:38:41 · 230 阅读 · 0 评论 -
selenium爬虫检测 2021-03-05
https://zhuanlan.zhihu.com/p/328768200提到了可以用:chrome_options.add_experimental_option( "excludeSwitches", ["enable-automation"])chrome_options.add_experimental_option('useAutomationExtension', False)chrome_options.add_argument("disable-blink-features原创 2021-07-16 15:16:32 · 138 阅读 · 0 评论