首先早R0估计葡萄牙COVID-19的爆发

刚刚发布的COVID-19的第一个早期估计R_0(basic reproduction number) in Portugal outbreak. Details on the image, more information to come soon. This estimate is taking into consideration the uncertainty for the generation interval and the growth.

Cite this article as: Christian S. Perone, "First early R0 estimate for Portugal COVID-19 outbreak," in亚洲金博宝未知领域,14/03/2020,//www.cpetem.com/2020/03/first-early-r0-estimate-for-portugal-covid-19-outbreak/

可视化网络集成的自举和随机先验

几个月前,我做了一个关于后深强化学习随机函数之前,where I showed how to implement the training procedure in PyTorch and how to extract the model uncertainty from them.

使用相同的代码表现为前面,这些动画下面示出的40种型号的合奏与2-层MLP和在不同的设置20个隐藏单元的训练。这些可视化是非常好的了解使用或不引导或随机先验的时候什么都收敛差异。

天真合奏

这是自举无数据或添加一个随机的前一堂训练课,它只是一个天真的ensembling:

Ensemble with Randomized Prior

这是合奏但是添加随机现有的(MLP具有相同的结构,具有随机加权和固定):

$$ Q _ {\ theta_k}(X)= F _ {\ theta_k}(X)+ P_K(x)的$$

该final model \(Q_{\theta_k}(x)\) will be the k model of the ensemble that will fit the function \(f_{\theta_k}(x)\) with an untrained prior \(p_k(x)\):

乐团与随机之前和Bootstrap

这是与现有的随机函数和数据自举一个合奏:

具有固定之前和自举合奏

这是具有固定之前(SIN)和自举合奏:

引用本文为:基督教S. Perone,“可视化网络集成的自举和随机先验”,在亚洲金博宝未知领域,20/07/2019,//www.cpetem.com/2019/07/visualizing-network-ensembles-with-bootstrap-and-randomized-priors/

Recebendo dados德baloes meteorologicos达AERONAUTICA

*这个帖子是葡萄牙语

HOJE finalmente consegui rastrear嗯DOSbalõesmeteorológicos阙一AERONAUTICAlança杜阿斯vezes POR直径褐EM阿雷格里港/ RS。甲AERONAUTICA utiliza作为sondas哒维萨拉(UMA Empresa与finlandesa)莫德洛RS-92SGP对realizar作为medições德umidade,温度ëpressão。埃斯蒂斯dados圣保罗geralmente utilizados对作为previsões德的节奏DAregião;existe UM数据表COM MAIS dadossobre o equipamento que eles utilizam, neste datasheet tem informações importantes como por exemplo a frequência em que o aparelho envia os dados de telemetria. Aqui em Porto Alegre / RS a aeronáutica está utilizando a faixa de operação em 402.700Mhz, que também é coberta pelos dongles USB RTLSDR como o que eu utilizo.

Øequipamento达维萨拉é嗯equipamento阙utiliza 60mW的德potência娜transmissão(EUJá六balõestransmitindo吃600公里萨frequênciaCOM apenas 10mW的èCOM UMA的Antena decenteé克拉罗)电子utilizamodulaçãoGFSK。帕拉decodificarØprotocoloéGFSK podemos utilizar SDR#juntamente COMØ虚拟电缆(OU算法中semelhante对redirecionar OS dados做SDR#对ØSondeMonitor阙éO软件阙IRA FAZER一个decodificaçãoDOS dados(infelizmente O软件éPAGéSó罗达apenasEM的Windows,MAS AO menos VEM COM alguns迪亚斯去试)。

没有MEU建立欧盟我在这utilizando嗯加密狗RTLSDR R820T juntamente COM嗯低噪声放大器(LNA4ALL NA照片abaixo)电子UMA的Antena德5分贝omnidirecional:

LNAèregulador德tensão
LNAèregulador德tensão

Abaixo SEGUE一个照片做equipamentolançado科莫有效载荷做巴老meteorológico:

雄达RS92-SGP
雄达RS92-SGP

Estes balões geralmente atingem uma altitude de uns 20km a 35km, mas isto depende de vários fatores como por exemplo os ventos, a quantidade de gás que foi utilizada no balão, a espessura do latex do balão e outros fatores. Quando o balão estoura este fenômeno é geralmente chamado de “burst” e após este estouro o balão acaba caindo por terra (ele tem uma bateria que não agride a natureza).

Seguem abaixo OSscreenshotsdo recebimento dos dados, neste momento eu ainda não havia conseguido receber toda calibração do aparelho:

SDR#recebendoØ打了个平手达雄达
SDR#recebendoØ打了个平手达雄达

截图de alguém mais fazendo o tracking da sonda e jogando para o APRS aqui de Porto Alegre:

Localização do balão no APRS
Localização do balão no APRS

IMAGEM做rastremento做巴老没有APRS:

Rastreamento达雄达

O próximo passo agora é conseguir uma antena direcional para melhorar a recepção =)

对终止日期过江interesse EM receber OS dados,OSbalões圣保罗lançadosdiariamente为00:00 UTCË为12:00 UTC

- 基督教S. Perone

书中建议:塞拉菲尼写本

今天Codex Seraphinianus刚到(月的预购等待状态后)。我买了它从亚马逊和I really recommend this edition for those who are interested because this is a very large edition with high quality textured paper and beautiful printing style. The book has also in the end a pocket with a small brochure called “Decodex” with a letter from Luigi Serafini.

该book is a very impressive creation by Luigi Serafini (or by the cat) dating from 1981 and presenting an impossible world that will cause to you the most strange feelings. See the photo of the cover and some pages below.

- 基督教S. Perone

Codex Page

食品名称

黑客为Python对象内部

You know, Python represents every object using the low-level C API的PyObject(要么PyVarObject为可变尺寸的对象)的结构,所以,具体地说,可以施放任何Python对象指针这种类型;这种继承是由手工打造,每一个新的对象必须有一个名为领先的宏亚洲金博宝PyObject_HEADwhich defines the的PyObjectheader for the object. The的PyObjectstructure is declared in包含/ object.h如:

[enlighter郎=” C”]
typedef结构_object {
PyObject_HEAD
}的PyObject;
[/ enlighter]

并且PyObject_HEAD宏定义为:

[enlighter郎=” C”]
#define PyObject_HEAD \
_PyObject_HEAD_EXTRA \
Py_ssize_t ob_refcnt;\
结构_typeobject * ob_type;
[/ enlighter]

......两个字段(forget the_PyObject_HEAD_EXTRA,它只是用于跟踪调试功能) calledob_refcntob_type,表示该对象的引用计数和对象的类型。我知道你可以使用sys.getrefcountto get the reference counting of an object, but hacking the object memory using ctypes is by far more powerful, since you can get the contents of any field of the object (in cases where you don’t have a native API for that), I’ll show more examples later, but lets focus on the reference counting field of the object.

Getting the reference count (ob_refcnt)

So, in Python, we have the built-in functionID(),这个函数返回的对象的身份,但是,在看其对CPython的实现定义,你会发现,ID()returns the memory address of the object, see the source in蟒蛇/bltinmodule.c

[enlighter郎=” C”]
静态的PyObject *
builtin_id(*的PyObject自我,的PyObject * V)
{
返回PyLong_FromVoidPtr(V);
}
[/ enlighter]

… 功能PyLong_FromVoidPtrreturns a Python long object from a void pointer. So, in CPython, this value is the address of the object in the memory as shown below:

[enlighter郎=”蟒”]
> > >值= 666
>>>十六进制(ID(值))
“0x8998e50”的“值”对象#存储器地址
[/ enlighter]

现在我们已经有了对象的内存地址,我们可以使用Python的ctypes模块通过访问属性来获取引用计数ob_refcnt,here is the code needed to do that:

[enlighter郎=”蟒”]
> > >值= 666
>>> value_address = ID(值)
>>>
>>> ob_refcnt= ctypes.c_long.from_address(value_address)
>>> ob_refcnt
c_long(1)
[/ enlighter]

我在这里做越来越从整数值ob_refcnt的属性的PyObjectin memory. Let’s add a new reference for the object ‘value’ we created, and then check the reference count again:

[enlighter郎=”蟒”]
>>> value_ref =值
>>> ID(value_ref)== ID(值)
真正
>>> ob_refcnt
C_long(2)
[/ enlighter]

Note that the reference counting was increased by 1 due to the new reference variable called ‘value_ref’.

Interned strings state (ob_sstate)

现在,越来越引用计数并不可笑,我们已经有了sys.getrefcountAPI for that, but what about the字符串的实习状态?为了避免对相同字符串的不同分配的创建(和速度比较),Python使用像一个“缓存”的字符串作品,这本词典中定义字典对象/ stringobject.c

[enlighter郎=” C”]

/ *这本词典包含所有实习字符串。请注意该引用
在这本字典字符串*不是字符串的ob_refcnt *计数。
When the interned string reaches a refcnt of 0 the string deallocation
功能会删除该词典的参考。

一个other way to look at this is that to say that the actual reference
字符串的计数为:S-> ob_refcnt +(S-> ob_sstate 2:0)
*/
静态的PyObject *实习;
[/ enlighter]

这里我也复制有关字典中的评论,因为是有趣的是,在字典中的字符串不字符串的计ob_refcnt

因此,一个字符串对象的实习状态是保持在属性ob_sstateString对象的,让我们来看看Python字符串对象的定义:

[enlighter郎=” C”]

typedef结构{
PyObject_VAR_HEAD
长ob_shash;
INT ob_sstate;
炭ob_sval [1];

/ *不变量:
* ob_sval contains space for ‘ob_size+1’ elements.
* ob_sval [ob_size] == 0。
* ob_shash is the hash of the string or -1 if not computed yet.
* ob_sstate!= 0当且仅当该字符串对象是stringobject.c的
*“实习”字典;在这种情况下,两个引用
*从“实习”对该对象的*不计*在ob_refcnt。
*/
} PyStringObject;
[/ enlighter]

正如你可以注意到,字符串对象从PyObject_VAR_HEAD宏,它定义了另一个标题属性继承,让我们来看看定义中,以结构的完整思路:

[enlighter郎=” C”]
#定义PyObject_VAR_HEAD \
PyObject_HEAD \
Py_ssize_t ob_size; /* Number of items in variable part */
[/ enlighter]

PyObject_VAR_HEADmacro adds another field calledob_size,这是对Python对象的可变部分的项目数(即一个列表对象上的项目的数目)。所以,在获取到ob_sstate场,我们需要转变我们的偏移跳过领域ob_refcnt(长)ob_type(void*)(从PyObject_HEAD), 场ob_size(长)(从PyObject_VAR_HEAD)和现场ob_shash(长)from thePyStringObject。Concretely, we need to skip this offset (3 fields with size与大小和一个场无效*)个字节的:

[enlighter郎=”蟒”]
>>> ob_sstate_offset = ctypes.sizeof(ctypes.c_long)* 3 + ctypes.sizeof(ctypes.c_voidp)
>>>ob_sstate_offset
16
[/ enlighter]

Now, let’s prepare two cases, one that we know that isn’t interned and another that is surely interned, then we’ll force the interned state of the other non-interned string to check the result of theob_sstateattribute:

[enlighter郎=”蟒”]
>>>一个=“雷诺”
>>> B =“”。加入([“升”,“E”,“R”,“O”])
>>> ctypes.c_long.from_address(ID(A)+ ob_sstate_offset)
c_long(1)
>>> ctypes.c_long.from_address(ID(B)+ ob_sstate_offset)
c_long(0)
>>> ctypes.c_long.from_address(ID(实习生(B))+ ob_sstate_offset)
c_long(1)
[/ enlighter]

Note that the interned state for the object “a” is 1 and for the object “b” is 0. After forcing the interned state of the variable “b”, we can see that the fieldob_sstate已更改为1。

更改内部状态(邪恶的模式)

现在,让我们假设我们希望通过解释来改变一个Python对象内部的一些状态。让我们试着改变一个int对象的值。INT对象中所定义Include/intobject.h

[enlighter郎=” C”]
typedef结构{
PyObject_HEAD
长ob_ival;
} PyIntObject;
[/ enlighter]

正如你所看到的,一个int内部值存储在现场ob_ival,to change it, we just need to skip theob_refcnt(长)ob_type(void*)from thePyObject_HEAD

[enlighter郎=”蟒”]
> > >值= 666
>>> ob_ival_offset = ctypes.sizeof(ctypes.c_long)+ ctypes.sizeof(ctypes.c_voidp)
>>> ob_ival = ctypes.c_int.from_address(ID(值)+ ob_ival_offset)
>>>ob_ival
c_long(666)
>>> ob_ival.value = 8
>>>值
8
[/ enlighter]

这就是它,我们都直接在内存改变了int值的值。

我希望你喜欢它,你可以有很多玩其他的Python对象,如列表和类型的字典,需要注意的是,此方法只为了表明Python的对象是如何在存储结构以及如何使用本机API改变他们,但obviously, you’re not supposed to use this to change the value of ints lol.

Update 11/29/11you’re not supposed to do such things on your production code or something like that, in this post I’m doing lazy assumptions about arch details like sizes of primitives, etc.Be warned

Cite this article as: Christian S. Perone, "Hacking into Python objects internals," in亚洲金博宝未知领域,23/11/2011,//www.cpetem.com/2011/11/hacking-into-python-objects-internals/