WO2022145332A1 - サンプリング装置及びサンプリング方法 - Google Patents

サンプリング装置及びサンプリング方法 Download PDF

Info

Publication number
WO2022145332A1
WO2022145332A1 PCT/JP2021/047811 JP2021047811W WO2022145332A1 WO 2022145332 A1 WO2022145332 A1 WO 2022145332A1 JP 2021047811 W JP2021047811 W JP 2021047811W WO 2022145332 A1 WO2022145332 A1 WO 2022145332A1
Authority
WO
WIPO (PCT)
Prior art keywords
program
control flow
sampling
stochastic
conversion rule
Prior art date
Application number
PCT/JP2021/047811
Other languages
English (en)
French (fr)
Inventor
一郎 蓮尾
雄一郎 大藪
クロビス エバーハート
幸平 末永
健太 長
審也 勝股
Original Assignee
大学共同利用機関法人情報・システム研究機構
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 大学共同利用機関法人情報・システム研究機構 filed Critical 大学共同利用機関法人情報・システム研究機構
Priority to CN202180086506.7A priority Critical patent/CN116670642A/zh
Priority to JP2022573033A priority patent/JPWO2022145332A1/ja
Priority to EP21915192.5A priority patent/EP4270178A4/en
Publication of WO2022145332A1 publication Critical patent/WO2022145332A1/ja
Priority to US18/338,078 priority patent/US20230333829A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/3005Arrangements for executing specific machine instructions to perform operations for flow control
    • G06F9/30058Conditional branch instructions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N7/00Computing arrangements based on specific mathematical models
    • G06N7/01Probabilistic graphical models, e.g. probabilistic networks

Definitions

  • This disclosure relates to a sampling device and a sampling method.
  • Bayesian estimation is a statistical method for inferring things estimated from observed events (observed facts) (causal events that are the cause of them) in a probabilistic sense.
  • Bayesian inference includes rocket control, automated driving, collision avoidance, junk mail filtering, medical inquiry, academic ability test, voice analysis and synthesis, genome analysis, astronomy, psychology, drug discovery, materials, energy, semantic search, online shopping. It is applied to various fields such as sales promotion and deep learning.
  • Stochastic programming is used to realize Bayesian inference.
  • stochastic programming By using stochastic programming, statistical models can be expressed in the form of programs, and various methods can be provided for statistical model analysis.
  • sampling method a continuous Monte Carlo method (SMC), a Markov chain Monte Carlo method (MCMC), a variational inference (VI), and the like are known.
  • SMC continuous Monte Carlo method
  • MCMC Markov chain Monte Carlo method
  • VI variational inference
  • the subject of this disclosure is to provide a novel sampling method for stochastic programming.
  • one aspect of the present invention is a control flow selection unit that selects a control flow corresponding to each branch of a stochastic program, and a predetermined conversion rule is back-propagated to the selected control flow program.
  • the present invention relates to a sampling apparatus having a program optimization unit that applies and optimizes the program, and a sampling unit that generates a sample according to the optimized program.
  • Bayesian inference is to derive the posterior distribution P (X
  • a probabilistic model for Bayesian estimation can be described by a Bayesian network as shown in FIG.
  • B) ⁇ P (B) / P (JohnCalls true & Mary)
  • Probabilistic programming is used to realize such Bayesian inference.
  • the probabilistic model shown in FIG. 1 can be described as, for example, a stochastic program as shown in FIG.
  • the desired posterior probability P B
  • P can be output by "return burary” when "observe (jonCalls & & MaryCalls)" holds in the illustrated stochastic program.
  • the flip function that returns a Boolean value at random is used, but in probabilistic programming, a sampling function that follows various probability distributions can be used.
  • a sampling function uniform following a uniform distribution, a sampling function beta following a beta distribution, and a sampling function gamma following a gamma distribution are used.
  • the process branches depending on whether the parameter z0 is negative or non-negative, and is divided into a control flow in which the beta function is used and a control flow in which the gamma function is used.
  • the smoothness of the probability distributions between control flows is lacking. In this case, it is difficult to determine the switching timing of the probability distribution in the MCMC method that moves randomly to acquire the target distribution, and the VI method that applies to the data using the distribution template lacks smoothness. It is difficult to find a template suitable for the distribution.
  • the sampling device 100 selects one of the control flows, optimizes the program of the selected control flow according to the conditional propagation described later, and generates a sample according to the optimized program.
  • the program is converted according to a predetermined conversion rule so as to eliminate sampling that does not logically satisfy the condition for satisfying "observ”.
  • the sampling device 100 selects the next control flow based on the sampling result, optimizes the program of the selected control flow in the same manner, and generates a sample according to the optimized program.
  • the sampling device 100 includes a processor 101 such as a CPU (Central Processing Unit), a RAM (Random Access Memory), a memory 102 such as a flash memory, a storage 103, and an input / output ( I / O) It may have a hardware configuration with an interface 104.
  • a processor 101 such as a CPU (Central Processing Unit), a RAM (Random Access Memory), a memory 102 such as a flash memory, a storage 103, and an input / output ( I / O) It may have a hardware configuration with an interface 104.
  • a processor 101 such as a CPU (Central Processing Unit), a RAM (Random Access Memory), a memory 102 such as a flash memory, a storage 103, and an input / output ( I / O) It may have a hardware configuration with an interface 104.
  • a processor 101 such as a CPU (Central Processing Unit), a RAM (Random Access Memory), a memory 102 such as a flash memory, a storage 103,
  • the processor 101 executes various processes of the sampling device 100 described later.
  • the memory 102 stores various data and programs in the sampling device 100, and functions as a working memory especially for working data, running programs, and the like. Specifically, the memory 102 stores a program for executing and controlling various processes loaded from the hard disk 103, which will be described later, and functions as a working memory during the execution of the program by the processor 101.
  • the hard disk 103 stores various data and programs in the sampling device 100.
  • the I / O interface 104 is an interface for receiving commands, input data, etc. from the user, displaying and reproducing the output result, and inputting / outputting data to / from an external device.
  • the I / O interface 104 may be a device for inputting / outputting various data such as a USB (Universal Serial Bus), a communication line, a keyboard, a mouse, a display, a microphone, and a speaker.
  • USB Universal Serial Bus
  • sampling device 100 is not limited to the hardware configuration described above, and may have any other suitable hardware configuration.
  • one or more of various processes by the sampling device 100 may be realized by a processing circuit or an electronic circuit wired to realize this.
  • FIGS. 7 to 13 FIG. 7 is a block diagram showing a functional configuration of the sampling device 100 according to the embodiment of the present disclosure.
  • the sampling device 100 includes a control flow selection unit 110, a program optimization unit 120, and a sampling unit 130.
  • the control flow selection unit 110 selects the control flow corresponding to each branch of the stochastic program. Specifically, when a stochastic program to be processed is given, the control flow selection unit 110 specifies a control structure related to a branch such as an if statement in the stochastic program, and a processing path corresponding to each branch of the stochastic program. Extract (control flow). For example, when a probabilistic program including one if statement as shown in FIG. 3 is given, the control flow selection unit 110 identifies the if statement and performs control flows 1 and 2 as shown in FIG. Extract.
  • the control flow 1 corresponds to the processing path when the condition “z0 ⁇ 0” in the if statement is true, and the beta function is used as the sampling function.
  • the control flow 2 corresponds to the processing path when the condition "z0 ⁇ 0" in the if statement is false, and the gamma function is used as the sampling function.
  • the control flow selection unit 110 When each control flow in the stochastic program is extracted, the control flow selection unit 110 constitutes a series program of each control flow from the stochastic program. For example, as a serial program corresponding to the control flow 1, the control flow selection unit 110 replaces “if (z0 ⁇ 0)” in the stochastic program with “obsave (z0 ⁇ 0)” as shown in FIG. do. Although not shown, as a series program corresponding to the control flow 2, the control flow selection unit 110 similarly replaces the stochastic program “if (z0 ⁇ 0)” with “obsave (z0 ⁇ 0)”.
  • control flow selection unit 110 selects one of the extracted control flows and passes it to the program optimization unit 120. Initially, the control flow selection unit 110 may randomly select one control flow. Hereinafter, the control flow selection unit 110 may select the next control flow based on the sampling result by the optimized program, as will be described later.
  • the program optimization unit 120 applies a predetermined conversion rule to the program of the selected control flow by back propagation, and optimizes the program. Specifically, when the control flow is acquired from the control flow selection unit 110, the program optimization unit 120 sequentially applies a predetermined conversion rule in the direction opposite to the processing order of the serial program of the acquired control flow, and the program is reprogrammed. Optimize the program by converting the instructions on each line from the lower line to the highest line. For example, the program optimization unit 120 converts each line of the program in the direction opposite to the processing order by using a roller that scans the program from the lowest row to the highest row. The roller has an internal state and converts each line of the program according to the conversion rule described later while changing the internal state according to the scan.
  • the program optimization unit 120 deletes the line and sets the internal state to "const (1)".
  • Const (1) is a function that always returns a value of 1.
  • the conversion rule converts the line to "const (1)” and sets the internal state to "const (1)”.
  • the program optimization unit 120 Sets the internal state f to "char ( ⁇ )", maintains the instruction, and adds "weight f". Since x is involved in the internal state f, the internal state f needs to be used for weighting (weight f). ⁇ is
  • must be a Boolean formula, not a fuzzy predicate.
  • is chosen as f ⁇ (xsup)> 0.
  • the improved version of the fifth conversion rule when the line to be converted is a stochastic substitution instruction "x to Dist (e)" and x appears in the internal state f, it is possible to improve the efficiency of area limitation. be. If the improved version is applicable, that is, if ⁇ , ⁇ that satisfies the conditions described below is found, the improved version is applied, and if not, the fifth conversion rule described above is applied. You may.
  • the formulas ⁇ and ⁇ are
  • the program optimization unit 120 sets the internal state f to “char ( ⁇ )” and sets the instruction to “x ⁇ (Dist (e)
  • ⁇ ” is the probability distribution "Dist (e)”. Is a probability distribution limiting "" to the region where ⁇ holds, and "p ( ⁇
  • the program optimization unit 120 applies the above-mentioned conversion rule and optimizes the serial program of the control flow 1 as shown in FIG.
  • the program optimization unit 120 applies the first conversion rule to the lowest line "return z" of the serial program, sets the internal state to "const (1)", and erases the line.
  • the program optimization unit 120 applies an improved version of the fifth conversion rule to the top-level line "z0 to uniform (-4,4)" of the serial program, and sets the internal state to "const (1)". Is set to, and the line is converted to "z0 to uniform (-1,0)" and "weight (const (1/8)".
  • the above-mentioned conversion rule ⁇ is True, and char ( ⁇ ) is always. It becomes 1, that is, const (1).
  • x of the conversion rule corresponds to z0
  • Dist (e) corresponds to uniform (-4,4).
  • ⁇ ) is uniform (-1,0)
  • the program optimization unit 120 passes the optimized program to the sampling unit 130.
  • the sampling unit 130 generates a sample according to the optimized program. Specifically, the sampling unit 130 generates a predetermined number of samples according to the optimized program of the serial program of the selected control flow. The generated sample excludes the sample that does not logically contribute to the calculation of the output of the series program in advance, and improves the sampling efficiency. After generating a predetermined number of samples, the sampling unit 130 causes the control flow selection unit 110 to select the next control flow. For example, the following control flow may be randomly selected or may be an unselected control flow. Similarly, the program optimization unit 120 optimizes the serial program of the selected control flow, and the sampling unit 130 generates a predetermined number of samples according to the optimized program.
  • the sampling unit 130 calculates the likelihood of the sample generated for each control flow, and notifies the control flow selection unit 110 of the calculated likelihood as the sampling result. ..
  • the likelihood of a sample is the product of the weights given by each of the weighting instructions passed when the sample was generated. Since "observ (x)" is an abbreviation for "weight (char (x))", if the sample does not satisfy the formula x when it passes the "observ (x)" instruction, the sample is likely. The degree is 0.
  • the control flow selection unit 110 may select a control flow based on the acquired likelihood. For example, the control flow selection unit 110 may select a control flow having a relatively high likelihood with a high probability and a control flow having a relatively low likelihood with a low probability.
  • the likelihood of the sample generated from the control flow 1 was 0.063 and the likelihood of the sample generated from the control flow 2 was 0.13 by the simulation.
  • the distribution of the samples as shown can be obtained.
  • control flow was extracted based on the if statement.
  • the present disclosure is not limited to this, and a control flow may be extracted based on a while statement as a branch control structure.
  • the present disclosure may be applied to a stochastic program as shown in FIG.
  • the control flow may be extracted according to the number of loops of the while loop. That is, the serial program when the white loop is executed once, the serial program when the white loop is executed twice, ..., The serial program when the white loop is executed n times are extracted and extracted, respectively.
  • the above-mentioned program optimization and sampling processing are executed for the serialized program. [Sampling process] Next, with reference to FIG.
  • FIG. 14 is a flowchart showing a sampling process according to an embodiment of the present disclosure.
  • step S101 the sampling device 100 acquires a stochastic program. Specifically, the sampling device 100 acquires a probabilistic program for realizing Bayesian estimation.
  • step S102 the sampling device 100 selects a control flow corresponding to each branch of the stochastic program. Specifically, the sampling device 100 extracts a control flow corresponding to each branch of the if statement of the acquired stochastic program, and selects a control flow to be processed from the extracted control flow. Then, the sampling device 100 extracts the serial program corresponding to the selected control flow.
  • step S103 the sampling device 100 back-propagates a predetermined conversion rule to the program of the selected control flow to optimize the program. Specifically, the sampling device 100 applies a predetermined conversion rule to each row in the direction opposite to the processing order of the serial program of the selected control flow, and converts the serial program.
  • the optimized program preliminarily excludes samples that do not logically contribute to calculating the output of the series program.
  • step S104 the sampling device 100 generates a sample according to the optimized program. Specifically, the sampling device 100 repeatedly executes the optimized program, generates a predetermined number of samples, and stores the generated samples. Further, the sampling device 100 calculates the likelihood for each control flow with respect to the stored sample.
  • step S105 the sampling device 100 determines whether the end condition is satisfied.
  • the end condition for example, S101 to S104 may be executed a predetermined number of times.
  • the sampling device 100 ends the sampling process. On the other hand, when the end condition is not satisfied (S105: NO), the sampling device 100 returns to step S102 and selects the next control flow.
  • the sampling device 100 and the sampling process described above may be applied to, for example, sampling for testing an automated driving system. That is, events such as accidents generally do not occur with such a high probability.
  • the event X in the "observe (X)" to be analyzed is also a rare event, and it is highly likely that most of the samples collected by sampling for analyzing the event will be discarded.
  • the sampling method of the present disclosure it is possible to exclude in advance the range in which the event X cannot logically occur, and it is possible to efficiently generate a sample suitable for the analysis target.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Artificial Intelligence (AREA)
  • Computational Mathematics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Evolutionary Computation (AREA)
  • Mathematical Analysis (AREA)
  • Algebra (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Stored Programmes (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Measurement And Recording Of Electrical Phenomena And Electrical Characteristics Of The Living Body (AREA)
  • Image Processing (AREA)
  • Other Investigation Or Analysis Of Materials By Electrical Means (AREA)

Abstract

確率的プログラミングのための新規なサンプリング手法を提供することである。本発明の一態様は、確率的プログラムの各分岐に対応する制御フローを選択する制御フロー選択部と、前記選択した制御フローのプログラムに所定の変換規則を逆伝搬によって適用し、前記プログラムを最適化するプログラム最適化部と、前記最適化したプログラムに従ってサンプルを生成するサンプリング部と、を有するサンプリング装置に関する。

Description

サンプリング装置及びサンプリング方法
 本開示は、サンプリング装置及びサンプリング方法に関する。
 ベイズ推定は、観測事象(観測された事実)から推定した事柄(それの起因である原因事象)を確率的な意味で推論する統計的手法である。例えば、ベイズ推定は、ロケット制御、自動運転、衝突回避、迷惑メールフィルタリング、医療問診、学力テスト、音声解析及び合成、ゲノム解析、天文学、心理学、創薬、素材、エネルギー、セマンティック検索、ネット通販の販促、深層学習等の多分野に適用されている。
 ベイズ推定を実現するため確率的プログラミング(PPL)が用いられる。確率的プログラミングを利用することによって、統計モデルをプログラムの形式で表現でき、統計モデル解析に際して様々な手法が提供できる。
 統計モデルとして、サンプリングを前提としたフレームワークが利用されることが多い。例えば、サンプリング手法として、連続モンテカルロ法(SMC)、マルコフチェーン・モンテカルロ法(MCMC)、変分推論(VI)等が知られている。
Aditya V. Nori and Chung-Kil Hur, "R2: an efficient MCMC sampler for probabilistic programs," AAAI'14: Proceedings of the Twenty-Eighth AAAI Conference on Artificial Intelligence, July 2014, pp 2476-2482 Yuan Zhou, Hongseok Yang, Yee Whye Teh and Tom Rainforth, "Divide, Conquer, and Combine: a New Inference Strategy for Probabilistic Programs with Stochastic Support", (https://arxiv.org/pdf/1910.13324.pdf)
 本開示の課題は、確率的プログラミングのための新規なサンプリング手法を提供することである。
 上記課題を解決するため、本発明の一態様は、確率的プログラムの各分岐に対応する制御フローを選択する制御フロー選択部と、前記選択した制御フローのプログラムに所定の変換規則を逆伝搬によって適用し、前記プログラムを最適化するプログラム最適化部と、前記最適化したプログラムに従ってサンプルを生成するサンプリング部と、を有するサンプリング装置に関する。
 本開示によると、確率的プログラミングのための新規なサンプリング手法を提供することができる。
ベイズ推定の具体例を示す概略図である。 ベイズ推定のための確率的プログラムを示すコード図である。 確率的プログラムにおける異なる分布を示す概略図である。 確率的プログラムによるサンプリング結果を示す概略図である。 本開示の一実施例によるサンプリング装置を示す概略図である。 本開示の一実施例によるサンプリング装置のハードウェア構成を示すブロック図である。 本開示の一実施例によるサンプリング装置の機能構成を示すブロック図である。 本開示の一実施例による制御フローを示す概略図である。 本開示の一実施例による確率的プログラミングの変換規則を示す概略図である。 本開示の一実施例による確率的プログラミングの変換規則を示す概略図である。 本開示の一実施例による確率的プログラムの変換過程を示す概略図である。 本開示の一実施例によるシミュレーション結果を示す概略図である。 本開示の一実施例による確率的プログラムを示すコード図である。 本開示の一実施例によるサンプリング処理を示すフローチャートである。
 以下の実施例では、確率的プログラミングのためのサンプリング装置が開示される。
[ベイズ推定と確率的プログラミング]
 ベイズ推定とは、事前分布P(X)と条件付き分布P(D|X)とからベイズの定理によって事後分布P(X|D)を導出することである。例えば、ベイズ推定のための確率モデルは、図1に示されるようなベイジアンネットワークによって記述されうる。ベイズ推定によって、図示されたベイジアンネットワークから、例えば、Johnが通報した(JohnCalls)という事象とMarryが通報した(MaryCalls)という事象との双方が事前確率として成り立つ場合に(JohnCalls=true&MarryCalls=true)強盗に入られるという事象Bが生起する確率P(B|JohnCalls=true&MaryCalls=true)を事後確率として導出することができる。図示された具体例では、P(B|JohnCalls=true&MaryCalls=true)=P(JohnCalls=true&MaryCalls=true|B)・P(B)/P(JohnCalls=true&MaryCalls=true)~0.2841となる。
 このようなベイズ推定を実現するため、確率的プログラミングが利用される。図1に示された確率モデルは、例えば、図2に示されるような確率的プログラムとして記述可能である。ここで、所望される事後確率P(B|JohnCalls=true&MaryCalls=true)は、図示された確率的プログラムにおいて、“observe(johnCalls&&maryCalls)”が成り立つ場合の“return burglary”によって出力できる。
 図示された確率的プログラムでは、ランダムにブール値を返すflip関数が利用されているが、確率的プログラミングでは、様々な確率分布に従うサンプリング関数が利用可能である。例えば、図3に示される確率的プログラムでは、一様分布に従うサンプリング関数uniform、ベータ分布に従うサンプリング関数beta、及びガンマ分布に従うサンプリング関数gammaが利用される。そして、パラメータz0が負又は非負であるかに応じて処理が枝分かれし、beta関数が利用される制御フローと、gamma関数が利用される制御フローとに分かれる。しかしながら、このように異なる複数の確率分布が利用される場合、制御フロー間における確率分布のスムーズさが欠けるという問題が考えられる。この場合、ランダムに移動して目標の分布を取得するMCMC法では、確率分布の切り替えタイミングを決定することが困難であり、また、分布テンプレートを用いてデータに当てはめるVI法では、スムーズさに欠ける分布に適したテンプレートを見出すことが難しい。
 また、図2に示される確率的プログラムでは、JohnCalls=true&MaryCalls=trueは稀にしか生起しない事象であり、図4に示されるように、“observe(johnCalls&&maryCalls)”が成立するサンプルは稀にしか生成されない。すなわち、生成される大部分のサンプルは利用されず、計算リソースの浪費となる。
[概略]
 本開示の一実施例によるサンプリング装置100は、図5に示されるように、確率的プログラムを受け付けると、受け付けた確率的プログラムのif文などの条件分岐構造に着目して複数の制御フローを抽出する。そして、サンプリング装置100は、いずれかの制御フローを選択し、後述される条件伝搬に従って、選択した制御フローのプログラムを最適化し、最適化したプログラムに従ってサンプルを生成する。この条件伝搬では、“observe”の成立条件を論理的に充足しないサンプリングが排除されるように、所定の変換規則に従ってプログラムが変換される。そして、サンプリング装置100は、サンプリング結果に基づき次の制御フローを選択し、同様にして選択した制御フローのプログラムを最適化し、最適化したプログラムに従ってサンプルを生成する。
 ここで、サンプリング装置100は、例えば、図6に示されるように、CPU(Central Processing Unit)などのプロセッサ101、RAM(Random Access Memory)、フラッシュメモリなどのメモリ102、ストレージ103、及び入出力(I/O)インタフェース104によるハードウェア構成を有してもよい。
 プロセッサ101は、後述されるサンプリング装置100の各種処理を実行する。
 メモリ102は、サンプリング装置100における各種データ及びプログラムを格納し、特に作業用データ、実行中のプログラムなどのためのワーキングメモリとして機能する。具体的には、メモリ102は、ハードディスク103からロードされた後述される各種処理を実行及び制御するためのプログラムなどを格納し、プロセッサ101によるプログラムの実行中にワーキングメモリとして機能する。
 ハードディスク103は、サンプリング装置100における各種データ及びプログラムを格納する。
 I/Oインタフェース104は、ユーザからの命令、入力データなどを受け付け、出力結果を表示、再生などすると共に、外部装置との間でデータを入出力するためのインタフェースである。例えば、I/Oインタフェース104は、USB(Universal Serial Bus)、通信回線、キーボード、マウス、ディスプレイ、マイクロフォン、スピーカなどの各種データを入出力するためのデバイスであってもよい。
 しかしながら、本開示によるサンプリング装置100は、上述したハードウェア構成に限定されず、他の何れか適切なハードウェア構成を有してもよい。例えば、サンプリング装置100による各種処理の1つ以上は、これを実現するよう配線化された処理回路又は電子回路により実現されてもよい。
[サンプリング装置]
 次に、図7~13を参照して、本開示の一実施例によるサンプリング装置100を説明する。図7は、本開示の一実施例によるサンプリング装置100の機能構成を示すブロック図である。
 図7に示されるように、サンプリング装置100は、制御フロー選択部110、プログラム最適化部120及びサンプリング部130を有する。
 制御フロー選択部110は、確率的プログラムの各分岐に対応する制御フローを選択する。具体的には、処理対象の確率的プログラムが与えられると、制御フロー選択部110は、確率的プログラムにおけるif文などの分岐に関する制御構造を特定し、確率的プログラムの各分岐に対応する処理パス(制御フロー)を抽出する。例えば、図3に示されるような1つのif文を含む確率的プログラムが与えられると、制御フロー選択部110は、当該if文を特定し、図8に示されるような制御フロー1,2を抽出する。ここで、制御フロー1は、if文における条件“z0<0”がtrueの場合の処理パスに相当し、beta関数がサンプリング関数として利用される。他方、制御フロー2は、if文における条件“z0<0”がfalseの場合の処理パスに相当し、gamma関数がサンプリング関数として利用される。
 確率的プログラムにおける各制御フローを抽出すると、制御フロー選択部110は、確率的プログラムから各制御フローの直列プログラムを構成する。例えば、制御フロー1に対応する直列プログラムとして、制御フロー選択部110は、図5に示されるように、確率的プログラムの“if(z0<0)”を“observe(z0<0)”に置換する。図示しないが、制御フロー2に対応する直列プログラムとして、制御フロー選択部110は、同様に確率的プログラムの“if(z0≧0)”を“observe(z0≧0)”に置換する。
 このようにして、各制御フローの直列プログラムを構成すると、制御フロー選択部110は、抽出した制御フローの1つを選択し、プログラム最適化部120にわたす。初期的には、制御フロー選択部110は、ランダムに1つの制御フローを選択してもよい。以降、制御フロー選択部110は、後述されるように、最適化されたプログラムによるサンプリング結果に基づき次の制御フローを選択してもよい。
 プログラム最適化部120は、選択した制御フローのプログラムに所定の変換規則を逆伝搬によって適用し、プログラムを最適化する。具体的には、制御フロー選択部110から制御フローを取得すると、プログラム最適化部120は、取得した制御フローの直列プログラムの処理順序と逆方向に所定の変換規則を順次適用し、プログラムの最下位行から最上位行まで各行の命令を変換してプログラムを最適化する。例えば、プログラム最適化部120は、プログラムを最下位行から最上位行まで走査するローラを用いて、処理順序と逆方向にプログラムの各行を変換する。ローラは内部状態を有すると共に、走査に従って内部状態を遷移させながら、後述する変換規則に従ってプログラムの各行を変換する。
 第1の変換規則として、変換対象の行が“return x”であるとき、プログラム最適化部120は、当該行を消去し、内部状態を“const(1)”に設定する。ここで、“const(1)”は、常に値1を返す関数である。例えば、変換対象の行が“return z”であるとき、当該変換規則は、当該行を“const(1)”に変換し、内部状態を“const(1)”に設定する。
 第2の変換規則として、変換対象の行が決定的代入命令“x:=e”であるとき、プログラム最適化部120は、図9に示されるように、内部状態fを“f[e/x]”に置き換え、“x:=e”を維持する。ここで、“f[e/x]”は、fの中の変数xをeに置き換えたものである。例えば、変換対象の行が“z:=z0+y”であって、内部状態が“char(0<=z<=2)”であるとき、当該変換規則は、当該行を維持し、内部状態を“char(0<=z0+y<=2)”に設定する。ここで、“char(x)”は、論理式xの特性関数であり、xが真である場合に1を返し、そうでない場合に0を返す。
 第3の変換規則として、変換対象の行が重み付け命令“weight(g)”であるとき、プログラム最適化部120は、図9に示されるように、内部状態fを“f×g”に置き換え、“weight(g)”を消去する。ここで、“f×g”は、関数fの出力値と関数gの出力値との積を返す関数である。また、“observe(x)”は、“weight(char(x))”の略記である。例えば、変換対象の行が“observe(z0<0)”であって、内部状態が“char(-1<=z0<=2)”であるとき、当該変換規則は、当該行を消去し、内部状態を“char((-1<=z0<=2)∧(z0<0))=char(-1<=z0<0)”に設定する。
 第4の変換規則として、変換対象の行が確率的代入命令“x~Dist(e)”であって、内部状態fにxが現れないとき、図10に示されるように、プログラム最適化部120は、当該命令及び内部状態を維持する。
 第5の変換規則として、変換対象の行が確率的代入命令“x~Dist(e)”であって、内部状態fにxが現れるとき、図10に示されるように、プログラム最適化部120は、内部状態fを“char(ψ)”に設定し、当該命令を維持すると共に“weight f”を追加する。xが内部状態fに関与するため、内部状態fは重み付けに使う必要がある(weight f)。ψは、
Figure JPOXMLDOC01-appb-M000001
を充足する任意の論理式であってもよい。ただし、ψはファジー述語でなく、ブール値論理式でなければならない。
 ここで、ψの選び方として、論理式
Figure JPOXMLDOC01-appb-M000002
をψとしてもよい。しかしながら、量化子∃は論理演算を非常に困難にする。また、ψをtrueにしてもよい。しかしながら、情報量がなく、無駄なサンプルを省くという効果がなくなるので、以下の選び方が適用できない場合にのみTrueを選ぶ。そこで、f・>0の真がxに関して単調である、すなわち、f・(x1)>0であって、x1≦x2であることがf・(x2)>0であることを意味し、さらに、
Figure JPOXMLDOC01-appb-M000003
が上界xsupを有すると仮定したとき、ψをf・(xsup)>0と選ぶ。例えば、変換対象の行が“y~beta(1,1)”であって、内部状態が“char(0<=z0+y)”であるとき、当該変換規則は、当該行を維持し、内部状態を“char(0<=z0+1)”に設定する。
 さらに、第5の変換規則の改良版として、変換対象の行が確率的代入命令“x~Dist(e)”であって、内部状態fにxが現れるとき、領域制限という効率化が可能である。当該改良版が適用可能である場合、すなわち、後述するような条件を充足するξ,ψが見つかるとき、当該改良版を適用し、そうでない場合、上述した第5の変換規則を適用するようにしてもよい。論理式ξ,ψが、
Figure JPOXMLDOC01-appb-M000004
の条件を充足するとき、図10に示されるように、プログラム最適化部120は、内部状態fを“char(ψ)”に設定し、当該命令を“x~(Dist(e)|ξ)に置き換えると共に、“weight(p(ξ|x~Dist(e))”及び“weight(f)”を追加する。ここで、“Dist(e)|ξ”は、確率分布“Dist(e)”をξの成立する領域に制限した確率分布であり、“p(ξ|x~Dist(e)”は、Dist(e)に沿って選んだxがξをtrueにする確率である。
 例えば、プログラム最適化部120は、上述した変換規則を適用し、図11に示されるように、制御フロー1の直列プログラムを最適化する。
 まず、プログラム最適化部120は、直列プログラムの最下位行“return z”に対して第1の変換規則を適用し、内部状態を“const(1)”に設定し、当該行を消去する。
 次に、プログラム最適化部120は、直列プログラムの“observe(0<=z<=2)”に対して第3の変換規則を適用し、内部状態を“char(0<=z<=2)”に設定し、当該行を消去する。
 次に、プログラム最適化部120は、直列プログラムの“z:=z0+y”に対して第2の変換規則を適用し、内部状態を“char(0<=z0+y<=2)”に設定し、当該行“z:=z0+y”を維持する。
 次に、プログラム最適化部120は、直列プログラムの“y~beta(1,1)”に対して第5の変換規則を適用し、内部状態を“char(-1<=z0<=2)”に設定し、当該行を“y~beta(1,1)”及び“observe(0<=z0+y<=2)”に変換する。
 次に、プログラム最適化部120は、直列プログラムの“observe(z0<0)”に対して第3の変換規則を適用し、内部状態を“char(-1<=z0<0)”(=char((-1<=z0<=2)∧(z0<0)))に設定し、当該行を消去する。
 最後に、プログラム最適化部120は、直列プログラム最上位行“z0~uniform(-4,4)”に対して第5の変換規則の改良版を適用し、内部状態を“const(1)”に設定し、当該行を“z0~uniform(-1,0)”及び“weight(const(1/8)”に変換する。上述した変換規則のψはTrueであり、char(ψ)は常に1となり、すなわち、const(1)である。また、変換規則のxはz0に相当し、ξは-1<=z0<=0に相当する。Dist(e)はuniform(-4,4)であり、Dist(e)|ξ)はuniform(-1,0)であり、p(ξ|x~Dist(e))は、z0をuniform(-4,4)から選んだ際に-1<=z0<=0を充たす確率であり、1/8である。
 プログラム最適化部120は、最適化されたプログラムをサンプリング部130にわたす。
 サンプリング部130は、最適化したプログラムに従ってサンプルを生成する。具体的には、サンプリング部130は、選択された制御フローの直列プログラムの最適化されたプログラムに従って所定数のサンプルを生成する。生成されるサンプルは、直列プログラムの出力を算出するのに論理的に寄与しないサンプルを予め排除したものであり、サンプリング効率を向上させる。所定数のサンプルを生成すると、サンプリング部130は、制御フロー選択部110に次の制御フローを選択させる。例えば、次の制御フローは、ランダムに選択されてもよいし、あるいは、未選択の制御フローであってもよい。同様にして、プログラム最適化部120は、選択された制御フローの直列プログラムを最適化し、サンプリング部130は、最適化されたプログラムに従って所定数のサンプルを生成する。
 このようにしてプールされたサンプルに対して、サンプリング部130は、各制御フローに対して生成されたサンプルの尤度を算出し、算出した尤度をサンプリング結果として制御フロー選択部110に通知する。ここで、サンプルの尤度とは,当該サンプルが生成された際に通過した重み付け命令のそれぞれが付与する重みの積である。“observe(x)”は、“weight(char(x))”の略記であるため、当該サンプルが“observe(x)”命令を通過した際に論理式xを充足しない場合、当該サンプルの尤度は0となる。制御フロー選択部110は、取得した尤度に基づき制御フローを選択してもよい。例えば、制御フロー選択部110は、相対的に高い尤度の制御フローを高い確率で選択し、相対的に低い尤度の制御フローを低い確率で選択してもよい。
 例えば、図12に示されるように、シミュレーションによって、制御フロー1から生成されたサンプルの尤度は0.063であり、制御フロー2から生成されたサンプルの尤度は0.13となった。制御フロー1,2から生成されたサンプルを重畳することによって、図示されるようなサンプルの分布を取得することができる。
 なお、上述した確率的プログラムでは、if文に基づき制御フローが抽出された。しかしながら、本開示はこれに限定されず、分岐の制御構造としてwhile文に基づき制御フローが抽出されてもよい。例えば、本開示は、図13に示されるような確率的プログラムに適用されてもよい。例えば、whileループのループ回数に応じて制御フローが抽出されてもよい。すなわち、whileループが1回実行される際の直列プログラム、whileループが2回実行される際の直列プログラム、・・・、whileループがn回実行される際の直列プログラムがそれぞれ抽出され、抽出された直列プログラムに対して上述したプログラム最適化及びサンプリング処理が実行される。
[サンプリング処理]
 次に、図14を参照して、本開示の一実施例によるサンプリング処理を説明する。当該サンプリング処理は、上述したサンプリング装置100によって実行され、例えば、サンプリング装置100の1つ以上のメモリに格納されたプログラムを1つ以上のプロセッサが実行することによって実現されうる。図14は、本開示の一実施例によるサンプリング処理を示すフローチャートである。
 図14に示されるように、ステップS101において、サンプリング装置100は、確率的プログラムを取得する。具体的には、サンプリング装置100は、ベイズ推定を実現するための確率的プログラムを取得する。
 ステップS102において、サンプリング装置100は、確率的プログラムの各分岐に対応する制御フローを選択する。具体的には、サンプリング装置100は、取得した確率的プログラムのif文の各分岐に対応する制御フローを抽出し、抽出した制御フローから処理対象の制御フローを選択する。そして、サンプリング装置100は、選択した制御フローに対応する直列プログラムを抽出する。
 ステップS103において、サンプリング装置100は、選択した制御フローのプログラムに所定の変換規則を逆伝搬し、プログラムを最適化する。具体的には、サンプリング装置100は、選択した制御フローの直列プログラムの処理順序と逆方向に各行に所定の変換規則を適用し、直列プログラムを変換する。最適化したプログラムは、直列プログラムの出力を算出するのに論理的に寄与しないサンプルを予め排除したものである。
 ステップS104において、サンプリング装置100は、最適化したプログラムに従ってサンプルを生成する。具体的には、サンプリング装置100は、最適化したプログラムを繰り返し実行し、所定数のサンプルを生成し、生成したサンプルを保存する。また、サンプリング装置100は、保存しているサンプルに対して制御フロー毎の尤度を算出する。
 ステップS105において、サンプリング装置100は、終了条件を充足したか判断する。終了条件としては、例えば、所定の繰り返し回数だけS101~S104を実行したことであってもよい。
 終了条件が充足された場合(S105:YES)、サンプリング装置100は、当該サンプリング処理を終了する。他方、終了条件が充足されない場合(S105:NO)、サンプリング装置100は、ステップS102に戻って、次の制御フローを選択する。
 上述したサンプリング装置100及びサンプリング処理は、例えば、自動運転システムのテストのためのサンプリングに適用されてもよい。すなわち、事故等の事象は一般にはそれほど高い確率で生起するものでない。例えば、解析対象の“observe(X)”における事象Xも稀な事象であり、当該事象を解析するためのサンプリングで収集したサンプルの大部分は破棄される可能性が高い。本開示のサンプリング手法を利用することによって、当該事象Xが論理的に起こりえない範囲を予め排除することが可能であり、解析対象に適したサンプルを効率的に生成することが可能になる。
 以上、本発明の実施例について詳述したが、本発明は上述した特定の実施形態に限定されるものではなく、特許請求の範囲に記載された本発明の要旨の範囲内において、種々の変形・変更が可能である。
 本国際出願は2020年12月28日に出願された日本国特許出願2020-218906号に基づく優先権を主張するものであり、2020-218906号の全内容をここに本国際出願に援用する。
100 サンプリング装置
110 制御フロー選択部
120 プログラム最適化部
130 サンプリング部

Claims (8)

  1.  確率的プログラムの各分岐に対応する制御フローを選択する制御フロー選択部と、
     前記選択した制御フローのプログラムに所定の変換規則を逆伝搬によって適用し、前記プログラムを最適化するプログラム最適化部と、
     前記最適化したプログラムに従ってサンプルを生成するサンプリング部と、
    を有するサンプリング装置。
  2.  前記プログラム最適化部は、前記選択した制御フローのプログラムに、確率分布適用領域の制限を含む所定の変換規則を逆伝搬によって適用する、請求項1に記載のサンプリング装置。
  3.  前記制御フロー選択部は、サンプリング結果に基づき前記制御フローを選択する、請求項1に記載のサンプリング装置。
  4.  前記確率的プログラムは、ベイズ推定を実現するためのプログラムを含む、請求項1に記載のサンプリング装置。
  5.  確率的プログラムの各分岐に対応する制御フローを選択するステップと、
     前記選択した制御フローのプログラムに所定の変換規則を逆伝搬によって適用し、前記プログラムを最適化するステップと、
     前記最適化したプログラムに従ってサンプルを生成するステップと、
    をコンピュータが実行するサンプリング方法。
  6.  前記プログラムを最適化するステップは、前記選択した制御フローのプログラムに、確率分布適用領域の制限を含む所定の変換規則を逆伝搬によって適用する、請求項5に記載のサンプリング方法。
  7.  前記選択するステップは、サンプリング結果に基づき前記制御フローを選択する、請求項5に記載のサンプリング方法。
  8.  前記確率的プログラムは、ベイズ推定を実現するためのプログラムを含む、請求項5に記載のサンプリング方法。
PCT/JP2021/047811 2020-12-28 2021-12-23 サンプリング装置及びサンプリング方法 WO2022145332A1 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN202180086506.7A CN116670642A (zh) 2020-12-28 2021-12-23 采样装置及采样方法
JP2022573033A JPWO2022145332A1 (ja) 2020-12-28 2021-12-23
EP21915192.5A EP4270178A4 (en) 2020-12-28 2021-12-23 SAMPLING DEVICE AND SAMPLING PROCEDURE
US18/338,078 US20230333829A1 (en) 2020-12-28 2023-06-20 Sampling device and sampling method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2020218906 2020-12-28
JP2020-218906 2020-12-28

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/338,078 Continuation US20230333829A1 (en) 2020-12-28 2023-06-20 Sampling device and sampling method

Publications (1)

Publication Number Publication Date
WO2022145332A1 true WO2022145332A1 (ja) 2022-07-07

Family

ID=82259356

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2021/047811 WO2022145332A1 (ja) 2020-12-28 2021-12-23 サンプリング装置及びサンプリング方法

Country Status (5)

Country Link
US (1) US20230333829A1 (ja)
EP (1) EP4270178A4 (ja)
JP (1) JPWO2022145332A1 (ja)
CN (1) CN116670642A (ja)
WO (1) WO2022145332A1 (ja)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090319458A1 (en) * 2008-06-20 2009-12-24 Microsoft Corporation Compiler for Probabilistic Programs
US20150095277A1 (en) * 2013-09-30 2015-04-02 Oracle International Corporation Data-parallel probabilistic inference
US20160063390A1 (en) * 2014-09-03 2016-03-03 Microsoft Corporation Probabilistic Assertions and Verifying Them

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090319458A1 (en) * 2008-06-20 2009-12-24 Microsoft Corporation Compiler for Probabilistic Programs
US20150095277A1 (en) * 2013-09-30 2015-04-02 Oracle International Corporation Data-parallel probabilistic inference
US20160063390A1 (en) * 2014-09-03 2016-03-03 Microsoft Corporation Probabilistic Assertions and Verifying Them

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ADITYA V. NORICHUNG-KIL HUR: "R2: an efficient MCMC sampler for probabilistic programs", AAAI'14: PROCEEDINGS OF THE TWENTY-EIGHTH AAAI CONFERENCE ON ARTIFICIAL INTELLIGENCE, July 2014 (2014-07-01), pages 2476 - 2482
See also references of EP4270178A4
YUAN ZHOUHONGSEOK YANGYEE WHYE TEHTOM RAINFORTH: "Divide, Conquer, and Combine", A NEW INFERENCE STRATEGY FOR PROBABILISTIC PROGRAMS WITH STOCHASTIC SUPPORT

Also Published As

Publication number Publication date
US20230333829A1 (en) 2023-10-19
EP4270178A4 (en) 2024-05-22
CN116670642A (zh) 2023-08-29
JPWO2022145332A1 (ja) 2022-07-07
EP4270178A1 (en) 2023-11-01

Similar Documents

Publication Publication Date Title
Byrd et al. A stochastic quasi-Newton method for large-scale optimization
Salmerón et al. A review of inference algorithms for hybrid Bayesian networks
US7421380B2 (en) Gradient learning for probabilistic ARMA time-series models
Deng et al. An adaptive empirical Bayesian method for sparse deep learning
JP2023510922A (ja) 複雑な多次元の制約を対象とする高いコスト関数の最適化
US11657289B2 (en) Computational graph optimization
Pauwels et al. Bayesian network based predictions of business processes
Ten Broeke et al. The use of surrogate models to analyse agent-based models
Lin et al. A scheduling algorithm based on reinforcement learning for heterogeneous environments
Liang et al. Crude oil price prediction using deep reinforcement learning
WO2022145332A1 (ja) サンプリング装置及びサンプリング方法
Mitrai et al. Taking the human out of decomposition-based optimization via artificial intelligence, Part II: Learning to initialize
Wijesuriya et al. Bayes-adaptive planning for data-efficient verification of uncertain Markov decision processes
Mascaro et al. A flexible method for parameterizing ranked nodes in Bayesian networks using Beta distributions
Xiang et al. Compressing Bayesian networks: Swarm-based descent, efficiency, and posterior accuracy
Ізонін An Ensemble Method for the Regression Model Parameter Adjustments: Direct Approach
Foster et al. Variational estimators for bayesian optimal experimental design
Ballarini et al. Expressive statistical model checking of genetic networks with delayed stochastic dynamics
Hrabec et al. Hybrid algorithm for wait-and-see network design problem
Kim et al. Optimizing 3D structure of H2O molecule using DDPG
Infantes et al. Learning to Solve Job Shop Scheduling Under Uncertainty
Fan et al. Review of Large-Scale Simulation Optimization
Billio et al. Bayesian inference in dynamic models with latent factors
Chen et al. A novel interval estimation framework for wind power forecasting using multi-objective gradient descent optimization
Rucker et al. Infinite action contextual bandits with reusable data exhaust

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21915192

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022573033

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 202180086506.7

Country of ref document: CN

WWE Wipo information: entry into national phase

Ref document number: 2021915192

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2021915192

Country of ref document: EP

Effective date: 20230728