- 博客(34)
- 收藏
- 关注
原创 利用AutoSSH建立SSH隧道,实现内网穿透
https://www.jianshu.com/p/b9398a4342b9autossh -M 4010 -R 80:localhost:4000 username@xxx.xxx.xxx.xxx (-p xxxx)
2023-07-17 19:38:29
187
原创 What do the part-of-speech and dependency tags mean?
You can find some ways herea. A good reference for understanding the dependency tags is the Stanford dependency manualb. Just a quick tip about getting the detail meaning of the short forms. You can use explain method like following:spacy.explain('pobj'
2021-10-15 10:29:22
154
转载 Constituency Parsing vs Dependency Parsing
Constituency Parsing vs Dependency Parsing
2021-10-14 16:41:39
204
转载 Python | Check for URL in a String
# Python code to find the URL from an input string# Using the regular expressionimport redef Find(string): # findall() has been used # with valid conditions for urls in string regex = r"(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(
2021-06-01 20:36:26
150
原创 Creating Python Virtual Environments with Conda
Creating Python Virtual Environments with Conda: Why and Howcreate a virtual environment using condaconda create --name env_name python=3.8switch to your new environmentconda activate env_nameswitch back using this commandconda deactivateTo see y
2021-05-12 10:17:50
176
转载 plot_tree in very low resolution, nearly unreadable
原文链接xgb.plot_tree(bst, num_trees=2)fig = matplotlib.pyplot.gcf()fig.set_size_inches(150, 100)fig.savefig('tree.png')
2021-04-09 17:26:23
227
转载 Neo4j Export to Gephi
官方文档Export to GephiGephi has a streaming plugin, that can provide and accept JSON-graph-data in a streaming fashion. The export to Gephi procedure sends data to this end point.Installing the pluginMake sure to install the plugin first and activate it
2021-04-01 10:04:19
643
原创 One hot representation 降维
1. 稀疏矩阵(sparse matrix)2. feature selection or feature filtering参考文献:A. Caliskan-Islam, R. Harang, A. Liu, A. Narayanan, C. Voss, F. Yamaguchi, and R. Greenstadt. 2015. De-anonymizing Programmers via Code Stylometry. In 24th USENIX Security Symposium (US
2021-03-31 20:19:25
471
原创 使用apoc从neo4j中导出graphml
CALL apoc.export.graphml.all("pc_goal_oriented_freq1_train.graphml", {})
2021-03-30 19:52:52
505
转载 Understanding Ranking Loss, Contrastive Loss, Margin Loss, Triplet Loss, Hinge Loss
Understanding Ranking Loss, Contrastive Loss, Margin Loss, Triplet Loss, Hinge Loss and all those confusing namesContrastive Loss: Contrastive refers to the fact that these losses are computed contrasting two or more data points representations. This name
2021-02-03 10:53:47
192
转载 Word Mover’s Distance for Text Similarity
Word Mover’s Distance for Text Similarity
2021-02-03 10:46:58
97
转载 两个矩阵的余弦相似性计算
import scipy.spatial as spcos = 1 - sp.distance.cdist(matrix1, matrix2, 'cosine')print(cos) array([[ 1. , 0.94280904], [ 0.94280904, 1. ]])原文链接
2021-01-22 10:47:22
1981
转载 python对象的for迭代实现
原文链接第一种:iter实现__iter__的对象,是可迭代对象。__iter__方法可以直接封装一个迭代器,从而实现for循环class A: def __init__(self): self.lis = [1,2,3,4] def __iter__(self): for i in self.lis: yield ia = A()for i in a: print(i)第二种:iter 和 next利用__
2021-01-21 19:15:45
114
转载 Python : How to Check if an item exists in list ? | Search by Value or Condition
In this article we will discuss different ways to check if a given element exists in list or not.Suppose we have a list of strings i.e.List of stringlistOfStrings = ['Hi' , 'hello', 'at', 'this', 'there', 'from']Now let’s check if given list contains
2021-01-21 17:01:13
415
转载 How to calculate Cosine similarity and Euclidean distance between two tensors in TF2.0?
原文链接You can calculate Euclidean distance and cosine similarity in tensorflow 2.X as below. The returned output will also be a tensor.import tensorflow as tf# It should be tf 2.0 or greaterprint("Tensorflow Version:",tf.__version__)#Create Tensorsx1
2021-01-21 10:17:49
329
转载 How to make an object properly hashable?
make an object properly hashableclass Hero: def __init__(self, name, age): self.name = name self.age = age def __str__(self): return self.name + str(self.age) def __hash__(self): print(hash(str(self)))
2021-01-19 16:55:33
73
翻译 python 时间开销分析
时间开销分析项目根目录运行以下命令,可以跑script/run_snowball.py脚本,并且得出详细地时间开销。这个是跑小规模的样例句子的时间分析python -m cProfile -s cumulative script/run_snowball.py >time_analysis.log这个是跑小规模的地在所有热门帖子上的时间分析python -m cProfile -s cumulative script/run_snowball_large_by_one.py >
2021-01-19 15:52:04
507
转载 Python3 中类的静态方法、普通方法、类方法
原文链接Python3 中类的静态方法、普通方法、类方法静态方法: 用 @staticmethod 装饰的不带 self 参数的方法叫做静态方法,类的静态方法可以没有参数,可以直接使用类名调用。普通方法: 默认有个self参数,且只能被对象调用。类方法: 默认有个 cls 参数,可以被类和对象调用,需要加上 @classmethod 装饰器。class Classname:@staticmethoddef fun():print(‘静态方法’)@classmethoddef a(cls)
2021-01-14 16:22:37
89
转载 Python代码规范与命名规则
原文链接1、模块模块尽量使用小写命名,首字母保持小写,尽量不要用下划线(除非多个单词,且数量不多的情况)正确的模块名import decoderimport html_parser不推荐的模块名import Decoder2、类名类名使用驼峰(CamelCase)命名风格,首字母大写,私有类可用一个下划线开头class Farm():passclass AnimalFarm(Farm):passclass _PrivateFarm(Farm):pass将相关的类和顶级函数放在
2021-01-14 16:13:44
66
转载 pycharm Django项目打开项目目录出现黄色的阴影,但不影响项目启动,如何恢复?
给出JetBrains也就是Pycharm的官方回复If by “shadow” you mean brown coloring, that means that directory is marked as “excluded” in project structure. The code will run, but code inspection and insight won’t work for excluded folders, so please remove “excluded” flag .
2021-01-12 15:32:36
2065
转载 XGBoost plot_importance doesn‘t show feature names?
XGBoost plot_importance doesn’t show feature namesmodel = joblib.load(“your_saved.model”)model.get_booster().feature_names = [“your”, “feature”, “name”, “list”]xgboost.plot_importance(model.get_booster())
2021-01-11 20:48:57
527
转载 Learning to rank基本算法小结
Learning to rank基本算法小结https://zhuanlan.zhihu.com/p/26539920
2021-01-07 11:16:37
112
转载 Text Preprocessing With NLTK
nltk preprocess pythonTutorial OverviewLowercaseRemoving PunctuationTokenizationStopword FilteringStemmingPart-of-Speech TaggerAll code displayed in this tutorial can be accessed in my Github repo.
2020-12-30 15:33:00
87
转载 用.sql文件通过navicat导数据到mysql中,大文本会显示BLOB的问题
https://blog.youkuaiyun.com/u012500237/article/details/78351820?utm_source=blogxgwz5
2018-10-27 23:07:18
388
转载 警告: Untokenizable: ? (U+D83D, decimal: 55357)
https://stackoverflow.com/questions/5242890/stanford-pos-tagger-in-java-usagehttps://stackoverflow.com/questions/33722024/how-to-remove-non-valid-unicode-characters-from-strings-in-java
2018-10-15 12:12:33
792
原创 将.csv文件导入数据库
load data infile ‘F:/test.csv’into table testfields terminated by ‘,’optionally enclosed by ‘"’escaped by ‘"’lines terminated by ‘\r\n’IGNORE 1 LINES;常见问题:1.第一行标题上不能有双引号2.段结束要修改成Windows下的转
2018-10-10 21:22:54
394
转载 用word2vec表示一个句子
这里写链接内容# 欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 C...
2018-09-05 16:58:09
2959
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人