Skip to content

Commit

Permalink
make new param goodness actually work woo
Browse files Browse the repository at this point in the history
  • Loading branch information
ldevesine committed Oct 6, 2015
1 parent 20ff61f commit 9aaeba7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ai_testing.py
Expand Up @@ -24,7 +24,7 @@
core['all']['depth interval'] = (0,10)
env = environment.Environment(core)

result = engine.build_argument(conclusions.Conclusion('keep layer counting', (0, 10)),env)
result = engine.build_argument(conclusions.Conclusion('stop layer counting', (0, 10)),env)
print result

# a bunch of rules that Kathleen tried!
Expand Down
13 changes: 6 additions & 7 deletions src/calvin/reasoning/calculations.py
Expand Up @@ -157,11 +157,7 @@ def synth_gaussian(core, mean, variation):
def past_avg_temp(core, *args):
return 'cake'

def known_depth_proxies(*args):
return 'pants'


def get_normal_peak_behavior(core,depthlist,proxylist):
def get_normal_peak_behavior(core, depths):
'''
returns a peak comparison object
warning: doesn't work right if you're too close to the top
Expand All @@ -172,6 +168,7 @@ def get_normal_peak_behavior(core,depthlist,proxylist):
# give list of dictionaries? to peak comparison object creator
# get current peak dict
# object.within(current_peak_dict)
depthlist, proxylist = depths

alldepths = sorted(core.keys())
length = len(depthlist)
Expand Down Expand Up @@ -230,19 +227,21 @@ def count_peaks(core,depthlist,proxy_name,strictness=10):

return numPeaks

def count_peaks_per_proxy(core,depthlist,proxylist):
def count_peaks_per_proxy(core, depths):
# call count_peaks for each proxy
depthlist, proxylist = depths
peaklist = [count_peaks(core,depthlist,proxy_name) for proxy_name in proxylist]
return peaklist

def number_of_peaks_is_normal(core,depthlist,proxylist):
def number_of_peaks_is_normal(core, depths):
'''
go back to half the depth
look at 3 other depth intervals, each proxy series in those depth intervals
see if your current interval has 'not enough bumps' in each data series, in comparison to 'normal'
if current number of bumps per series is not normal, return evidence AGAINST
if it IS normal, return evidence FOR
'''
depthlist, proxylist = depths
currentpeaklist = count_peaks_per_proxy(core,depthlist,proxylist)
NormalPeakComparer = get_normal_peak_behavior(core,depthlist,proxylist)
result = NormalPeakComparer.within(currentpeaklist)
Expand Down
3 changes: 2 additions & 1 deletion src/calvin/reasoning/environment.py
Expand Up @@ -55,8 +55,9 @@ def fill_params(self, param_list):
elif param in definitions:
value = definitions[param](self)
self.setvar(new_key, value)
fill.append(value)
else:
fill.append(new_key)
fill.append(new_key)
else:
fill.append(param)
return fill
Expand Down
1 change: 0 additions & 1 deletion src/calvin/reasoning/rules.py
Expand Up @@ -94,7 +94,6 @@ def __init__(self, name, *params):

def run(self, working_env):
paramset = working_env.fill_params(self.params)
print 'observation', self.name, self.params, paramset
try:
value = observations.apply(self.name, *paramset)
except:
Expand Down

0 comments on commit 9aaeba7

Please sign in to comment.