首页 > 编程知识 正文

彼得斯堡是哪个国家,如何用符号做出形

时间:2023-05-04 18:25:22 阅读:270274 作者:4346

A while back I posted an example outlining how to use petersburg to simulate the St. Petersburg Paradox. In this post, I’d like to dig a little deeper into what petersbug is and what it does.

前一段时间,我发布了一个示例,概述了如何使用彼得斯堡来模拟圣彼得堡悖论。 在本文中,我想更深入地研究petersbug是什么以及它的作用。

Petersburg is a minimal python library for representing complex decisions (as in decision theory decisions) as probabilistic graphs.  With a game or decision represented, it can be simulated with some context (like finite bankrolls, ruin, or risk aversion).  So let’s dive in to the inner workings:

Petersburg是一个最小的python库,用于将复杂的决策(如决策理论决策中的)表示为概率图。 通过表示游戏或决策,可以在一定环境下(例如有限资金,破产或规避风险)对其进行模拟。 因此,让我们深入了解内部工作原理:

A graph is a set of nodes connected by edges.  Nodes represent some object or state, and they are connected by edges that may or may not have direction.  Both edges and nodes can have attributes tied to them, such as weights, labels or other data.  If it is possible to start at a node, and progress along edges and get back to the same node, that is called a cycle, making a directed graph without cycles “acyclic”.  These directed acyclic graphs (DAGs) are what we use to represent decisions in petersburg.

图是由边连接的一组节点。 节点表示某种对象或状态,它们通过可能具有方向或没有方向的边连接。 边缘和节点都可以绑定属性,例如权重,标签或其他数据。 如果有可能从一个节点开始,然后沿着边缘前进并返回到同一节点,则称为循环,使没有循环的有向图成为“非循环的”。 这些有向无环图(DAG)是我们用来表示圣彼得堡决策的依据。

Nodes in petersburg have one attribute: payoff.  This is some numeric value accumulated when the node is reached.  There is one special case for nodes, and that is the starting node, where the process begins.  Other than that, all decisions are made up of these simple one-attribute nodes connected by directed edges.  The edges have two attributes: cost and weight.  The cost is, just like the payoff attribute of the nodes, accumulated on arrival to the edge.  Weights are positive numeric values that are used to represent the likelihood of taking one edge versus another when more than one path out of a node is available.

彼得斯堡的节点具有一个属性:收益。 这是到达节点时累积的一些数值。 节点有一种特殊情况,那就是过程开始的起始节点。 除此之外,所有决策都由这些有向边连接的简单一属性节点组成。 边缘具有两个属性:成本和重量。 就像节点的收益属性一样,成本是在到达边缘时累积的。 权重是正数值,用于表示当一条路径中有多个路径可用时,一条边缘相对于另一边缘的可能性。

With these two objects, a graph object, which is simply a reference to the starting node of a DAG can be built very simply to represent very complex scenarios.  To revisit the St. Petersburg case in a more classical case (with finite bankroll), the dictionary representing the game for just one flip would be:

使用这两个对象,可以非常简单地构建一个图形对象,该对象只是对DAG起始节点的引用,可以表示非常复杂的场景。 为了在更经典的情况下(具有有限的资金)重温圣彼得堡的情况,仅需翻转一下即可表示游戏的字典为:

{ "1": { "after": [], "payoff": 0 }, "2": { "after": [ { "cost": 10, "node_id": 1 } ], "payoff": 0 }, "3": { "after": [ { "weight": 1, "cost": 0, "node_id": 2 } ], "payoff": 2 }, "4": { "after": [ { "weight": 1, "cost": 0, "node_id": 2 } ], "payoff": 0 }}

In this graph, there are 4 nodes:

在此图中,有4个节点:

StartEntrance FeeFlip #1: HeadsFlip #2: Tails (fail) 开始 入场费 翻转#1:纯真的大神 翻转#2:尾巴(失败)

The (3) and (4) node pattern can be repeated indefinitely to represent the St. Petersburg game.

可以无限重复重复(3)和(4)节点模式,以表示圣彼得堡游戏。

While these classical decision theoretic problems are interesting, and I have two more to post in the coming weeks, the real intention here is to study more interesting relationships in complex decision structures.  So in the case where the weights in one part of graph aren’t known, but the structure and costs are, how can you use simulation to understand the influence of those weights to make informed (and safe from ruin) decisions?  How can likelihood, criticality, and ability to affect change be estimated and consolidated in complex decision scenarios?

尽管这些经典决策理论问题很有趣,并且在接下来的几周内我还要发表两个问题,但这里的真正目的是研究复杂决策结构中更有趣的关系。 因此,在未知图的一部分权重但结构和成本未知的情况下,您如何使用模拟来理解这些权重的影响来做出明智的(并且可以避免崩溃)决策? 在复杂的决策场景中,如何估计,合并影响变更的可能性,关键性和能力?

Petersburg will be able to help understand these kinds of questions better by providing structure into how the problems are presented, and by providing that structure in such a way that subsets of the decision which may be simpler can be examined in isolation.

通过为问题的处理方式提供结构,并以一种可以使可能更简单的决策子集被单独检查的方式提供结构,Petersburg将能够帮助更好地理解这类问题。

So check out petersburg on github, it’s still very raw, but there are a bunch of examples that I’ll continue developing as the library itself fleshes out:

因此,请在github上查看petersburg,它仍然很原始,但是随着库本身的完善,我将继续开发许多示例:

翻译自: https://www.pybloggers.com/2016/01/thinking-like-a-graph-to-make-decisions-petersburg/

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。