An error occurred while loading the file. Please try again.
-
Thibault Hallouin authored
The bootstrapping method is based on a non-overlapping block sampling with replacement, where the blocks are years of data. The number of samples and the sample length (i.e the number of year blocks) are both customisable. The method is accessible both for deterministic and probabilistic evaluation where a new axis is added. For now, the metrics for all the samples are returned, but in the future, some summary statistics would be implemented (e.g. quantiles or mean/standard deviation). /!\ For determinist evaluation, the n-dimensional functionality became untenable such that the number of dimensions was fixed and restricted to 2D tensors. New unit tests are included to test both the bootstrapping generator and the numerical results obtained with the bootstrapping turned on.
16ce8f4e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/usr/bin/env python
#
# Generated Fri Jul 2 13:32:50 2004 by generateDS.py.
#
import sys
from xml.dom import minidom
from xml.sax import handler, make_parser
import ??? as supermod
class purchase_orderSub(supermod.purchase_order):
def __init__(self, customer=None, date='', line_item=None, shipper=None):
supermod.purchase_order.__init__(self, customer, date, line_item, shipper)
#
# XMLBehaviors
#
def calculate_average_price(self, date, category, *args):
pass
def calculate_average_price_precond(self, date, category, *args):
pass
def calculate_average_price_postcond(self, date, category, *args):
pass
def calculate_average_price_wrapper(self, date, category, *args):
self.calculate_average_price_precond(*args)
self.calculate_average_price(date, category, *args)
self.calculate_average_price_postcond(*args)
def get_daily_volume(self, date, category, *args):
pass
def get_daily_volume_wrapper(self, date, category, *args):
self.get_daily_volume(date, category, *args)
supermod.purchase_order.subclass = purchase_orderSub
# end class purchase_orderSub
class customerSub(supermod.customer):
def __init__(self, name='', address=''):
supermod.customer.__init__(self, name, address)
#
# XMLBehaviors
#
supermod.customer.subclass = customerSub
# end class customerSub
class line_itemSub(supermod.line_item):
def __init__(self, description='', per_unit_ounces=0.0, price=0.0, quantity=-1):
supermod.line_item.__init__(self, description, per_unit_ounces, price, quantity)
#
# XMLBehaviors
#
supermod.line_item.subclass = line_itemSub
# end class line_itemSub
class shipperSub(supermod.shipper):
def __init__(self, name='', per_ounce_rate=0.0):
supermod.shipper.__init__(self, name, per_ounce_rate)
#
# XMLBehaviors
#
supermod.shipper.subclass = shipperSub
# end class shipperSub
def saxParse(inFileName):
parser = make_parser()
documentHandler = supermod.SaxPurchase_orderHandler()
parser.setDocumentHandler(documentHandler)
parser.parse('file:%s' % inFileName)
rootObj = documentHandler.getRoot()
#sys.stdout.write('<?xml version="1.0" ?>\n')
#rootObj.export(sys.stdout, 0)
return rootObj
def saxParseString(inString):
parser = make_parser()
documentHandler = supermod.SaxContentHandler()
parser.setDocumentHandler(documentHandler)
parser.feed(inString)
parser.close()
rootObj = documentHandler.getRoot()
#sys.stdout.write('<?xml version="1.0" ?>\n')
#rootObj.export(sys.stdout, 0)
return rootObj
def parse(inFilename):
doc = minidom.parse(inFilename)
rootNode = doc.childNodes[0]
rootObj = supermod.purchase_order.factory()
rootObj.build(rootNode)
#sys.stdout.write('<?xml version="1.0" ?>\n')
#rootObj.export(sys.stdout, 0)
doc = None
return rootObj
def parseString(inString):
doc = minidom.parseString(inString)
rootNode = doc.childNodes[0]
rootObj = supermod.purchase_order.factory()
rootObj.build(rootNode)
doc = None
#sys.stdout.write('<?xml version="1.0" ?>\n')
#rootObj.export(sys.stdout, 0)
return rootObj
def parseLiteral(inFilename):
doc = minidom.parse(inFilename)
rootNode = doc.childNodes[0]
rootObj = supermod.purchase_order.factory()
rootObj.build(rootNode)
#sys.stdout.write('from po_sub import *\n\n')
#sys.stdout.write('rootObj = purchase_order(\n')
#rootObj.exportLiteral(sys.stdout, 0)
#sys.stdout.write(')\n')
doc = None
return rootObj
USAGE_TEXT = """
Usage: python ???.py <infilename>
"""
def usage():
print USAGE_TEXT
sys.exit(-1)
def main():
args = sys.argv[1:]
if len(args) != 1:
usage()
infilename = args[0]
root = parse(infilename)
sys.stdout.write('<?xml version="1.0" ?>\n')
root.export(sys.stdout, 0)
if __name__ == '__main__':
main()
#import pdb
#pdb.run('main()')