paulbricman commited on
Commit
f8dc69d
1 Parent(s): a6d1b90

fix: tweak activation expressions

Browse files
Files changed (3) hide show
  1. .gitignore +2 -1
  2. __pycache__/util.cpython-38.pyc +0 -0
  3. util.py +7 -7
.gitignore CHANGED
@@ -1 +1,2 @@
1
- conceptarium/*
 
1
+ conceptarium/*
2
+ __pycache__/*
__pycache__/util.cpython-38.pyc CHANGED
Binary files a/__pycache__/util.cpython-38.pyc and b/__pycache__/util.cpython-38.pyc differ
util.py CHANGED
@@ -41,27 +41,27 @@ def remember(query, model, behavior='balanced', top_k=50):
41
  for idx, result in enumerate(results):
42
  if behavior == 'balanced':
43
  results[idx]['activation'] = (result['score']
44
- + 0.1 *
45
  (np.log(
46
  conceptarium[result['corpus_id']].interest / (1 - 0.9))
47
  - 0.9 * np.log((time.time() - conceptarium[result['corpus_id']].timestamp) / 3600))) \
48
- * np.random.normal(1, 0.1)
49
  elif behavior == 'antimemory':
50
  results[idx]['activation'] = (result['score']
51
- - 0.1 *
52
  (np.log(
53
  conceptarium[result['corpus_id']].interest / (1 - 0.9))
54
  + 0.9 * np.log((time.time() - conceptarium[result['corpus_id']].timestamp) / 3600))) \
55
- * np.random.normal(1, 0.1)
56
  elif behavior == 'contextonly':
57
  results[idx]['activation'] = result['score']
58
  elif behavior == 'noisy':
59
  results[idx]['activation'] = (result['score']
60
- + 0.1 *
61
  (np.log(
62
  conceptarium[result['corpus_id']].interest / (1 - 0.9))
63
  - 0.9 * np.log((time.time() - conceptarium[result['corpus_id']].timestamp) / 3600))) \
64
- * np.random.normal(1, 0.5)
65
 
66
  results = sorted(
67
  results, key=lambda result: result['activation'], reverse=True)
@@ -89,7 +89,7 @@ def get_modality(content):
89
 
90
 
91
  def compensate_modality_mismatch(result):
92
- result['score'] *= 3.2
93
  return result
94
 
95
 
41
  for idx, result in enumerate(results):
42
  if behavior == 'balanced':
43
  results[idx]['activation'] = (result['score']
44
+ + 0.02 *
45
  (np.log(
46
  conceptarium[result['corpus_id']].interest / (1 - 0.9))
47
  - 0.9 * np.log((time.time() - conceptarium[result['corpus_id']].timestamp) / 3600))) \
48
+ * np.random.normal(1, 0.05)
49
  elif behavior == 'antimemory':
50
  results[idx]['activation'] = (result['score']
51
+ - 0.02 *
52
  (np.log(
53
  conceptarium[result['corpus_id']].interest / (1 - 0.9))
54
  + 0.9 * np.log((time.time() - conceptarium[result['corpus_id']].timestamp) / 3600))) \
55
+ * np.random.normal(1, 0.05)
56
  elif behavior == 'contextonly':
57
  results[idx]['activation'] = result['score']
58
  elif behavior == 'noisy':
59
  results[idx]['activation'] = (result['score']
60
+ + 0.02 *
61
  (np.log(
62
  conceptarium[result['corpus_id']].interest / (1 - 0.9))
63
  - 0.9 * np.log((time.time() - conceptarium[result['corpus_id']].timestamp) / 3600))) \
64
+ * np.random.normal(1, 0.2)
65
 
66
  results = sorted(
67
  results, key=lambda result: result['activation'], reverse=True)
89
 
90
 
91
  def compensate_modality_mismatch(result):
92
+ result['score'] *= 3.5
93
  return result
94
 
95