存储最小哈希的结果 [英] Storing the result of Minhash

查看:170
本文介绍了存储最小哈希的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

结果是阵​​列固定数量的,比方说在的蟒蛇

The result is a fixed number of arrays, let's say lists (all of the same length) in python.

人们可以把它看作是一个矩阵,所以他们在Ç 我会用一个数组,其中的每一个细胞将指向另一个数组。如何做到这一点在Python?

One could see it as a matrix too, so in c I would use an array, where every cell would point to another array. How to do it in Python?

一个列表,每一个产品列表或其他什么东西?

A list where every item is a list or something else?

我想到了一个字典,但关键是微不足道的,1,2,...,M,所以我不知道这是去这里的Python的方式。

I thought of a dictionary, but the keys are trivial, 1, 2, ..., M, so I am not sure if that is the pythonic way to go here.

我不感兴趣的实施,我感兴趣的是哪种方式,我应该遵循,其中选择,我应该做!

I am not interested in the implementation, I am interested in which approach I should follow, in which choice I should made!

推荐答案

您可以保存在一个Python列表想要的东西:整数,字符串,多个列表清单,类型的字典,对象,函数 - 你的名字。

You can store anything you want in a python list: ints, strings, more lists lists, dicts, objects, functions - you name it.

anything_goes_in_here = [1, 'one', lambda one: one / 1, {1: 'one'}, [1, 1]]

所以存储列表的列表为pretty直截了当:

So storing a list of lists is pretty straight forward:

>>> list_1 = [1, 2, 3, 4]
>>> list_2 = [5, 6, 7, 8]
>>> list_3 = [9, 10, 11, 12]
>>> list_4 = [13, 14, 15, 16]
>>> main_list = [list_1, list_2, list_3, list_4]
>>> for list in main_list:
...     for num in list:
...             print num
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

如果您正在寻找存储列表,其中索引是有意义的(意味着该指数为您提供有关存储在那里的​​一些数据信息)的名单,那么这基本上是重新实现一个HashMap(字典),虽然你说这是小事 - 使用字典听起来那么这里适合的问题。

If you are looking to store a list of lists where the index is meaningful (meaning the index gives you some information about the data stored there), then this is basically reimplementing a hashmap (dictionary), and while you say it's trivial - using a dictionary sounds like it fits the problem well here.

这篇关于存储最小哈希的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆