You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2017/10/25 12:09:19 UTC

[kibble] branch master updated (d9d499e -> 14a974f)

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git.


    from d9d499e  regen JS
     new 6040295  trying another way of estimating happiness
     new 81fd8b5  Try another happiness approach
     new 14a974f  missing a field

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 api/pages/mail/mood-timeseries.py |  2 +-
 api/pages/mail/mood.py            | 26 ++++++++++++++++++++------
 2 files changed, 21 insertions(+), 7 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@kibble.apache.org" <co...@kibble.apache.org>'].

[kibble] 01/03: trying another way of estimating happiness

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git

commit 60402955614510d21cb3b63341a933838ca0422d
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Oct 25 13:44:17 2017 +0200

    trying another way of estimating happiness
    
    - average the goods, G
    - average the bads, B
    - let happiness be K*(G/B) where K is the AbV in a really cheap vodka.
    - Normalize by max value, M
    
    Sounds legit, right?!
---
 api/pages/mail/mood.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/api/pages/mail/mood.py b/api/pages/mail/mood.py
index bfdf8fe..a2f418d 100644
--- a/api/pages/mail/mood.py
+++ b/api/pages/mail/mood.py
@@ -220,10 +220,13 @@ def run(API, environ, indata, session):
     else:
         mood_compiled = global_mood_compiled
     MAX = max(mood_compiled.values())
-    bads = (mood_compiled.get('anger', 0)*1.25 + mood_compiled.get('fear', 0)*1.25 + mood_compiled.get('sadness', 0) + mood_compiled.get('disgust', 0)*1.5) / 4
+    bads = (mood_compiled.get('anger', 0) + mood_compiled.get('fear', 0) + mood_compiled.get('sadness', 0) + mood_compiled.get('disgust', 0)) / 4
     neutrals = (mood_compiled.get('tentative', 0) + mood_compiled.get('analytical', 0) /2)
-    goods = (mood_compiled.get('joy', 0)*1.5 + mood_compiled.get('confident', 0)) / 2
-    swingometer = max(0, min(100, (50 + goods - bads) / max(1, (MAX/100))))
+    goods = (mood_compiled.get('joy', 0) + mood_compiled.get('confident', 0)) / 2
+    happ = 25
+    happ /= bads
+    happ *= goods
+    swingometer = max(0, min(100, happ/(max(100, MAX)/100)))
     
     JSON_OUT = {
         'relativeMode': True,

-- 
To stop receiving notification emails like this one, please contact
"commits@kibble.apache.org" <co...@kibble.apache.org>.

[kibble] 03/03: missing a field

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git

commit 14a974f0c920192aa6d124eb15d5cead481ef342
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Oct 25 14:09:12 2017 +0200

    missing a field
---
 api/pages/mail/mood-timeseries.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/api/pages/mail/mood-timeseries.py b/api/pages/mail/mood-timeseries.py
index a43b85c..257a1d9 100644
--- a/api/pages/mail/mood-timeseries.py
+++ b/api/pages/mail/mood-timeseries.py
@@ -180,7 +180,7 @@ def run(API, environ, indata, session):
         )
     
     timeseries = []
-    M = ['joy', 'sadness', 'tentative', 'confident', 'anger', 'fear', 'analytical']
+    M = ['joy', 'sadness', 'tentative', 'confident', 'anger', 'fear', 'analytical', 'disgust']
     
     for tz in res['aggregations']['history']['buckets']:
         moods = {}

-- 
To stop receiving notification emails like this one, please contact
"commits@kibble.apache.org" <co...@kibble.apache.org>.

[kibble] 02/03: Try another happiness approach

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git

commit 81fd8b5d1e5fd2e86e1449f4b5045d68df544792
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Oct 25 14:09:04 2017 +0200

    Try another happiness approach
    
    - if relative, give 100 (norm) to missing fields
    - calc goods
    - calc bads
    - calc neutrals
    - find max(goods, bads)
    - goods give 50 * (goods/max)
    - bads subtract 50 * (bads/max)
    - neutral adds neutral/2 (essentially 50 at perfectly neutral)
---
 api/pages/mail/mood.py | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/api/pages/mail/mood.py b/api/pages/mail/mood.py
index a2f418d..89819b5 100644
--- a/api/pages/mail/mood.py
+++ b/api/pages/mail/mood.py
@@ -216,18 +216,29 @@ def run(API, environ, indata, session):
         for mood, el in res['aggregations'].items():
             moods[mood] = el['value']
         for k, v in moods.items():
-            mood_compiled[k] = int(100 * int( (v / max(1,emls)) * 100) / max(1, global_mood_compiled.get(k, 100)))
+            mood_compiled[k] = int(100 * int( ( v / max(1,emls)) * 100) / max(1, global_mood_compiled.get(k, 100)))
     else:
         mood_compiled = global_mood_compiled
-    MAX = max(mood_compiled.values())
-    bads = (mood_compiled.get('anger', 0) + mood_compiled.get('fear', 0) + mood_compiled.get('sadness', 0) + mood_compiled.get('disgust', 0)) / 4
-    neutrals = (mood_compiled.get('tentative', 0) + mood_compiled.get('analytical', 0) /2)
-    goods = (mood_compiled.get('joy', 0) + mood_compiled.get('confident', 0)) / 2
-    happ = 25
-    happ /= bads
-    happ *= goods
-    swingometer = max(0, min(100, happ/(max(100, MAX)/100)))
     
+    # If relative mode and a field is missing, assume 100 (norm)
+    if indata.get('relative'):
+        for M in ['joy', 'sadness', 'tentative', 'confident', 'anger', 'fear', 'analytical', 'disgust']:
+            if mood_compiled.get(M, 0) == 0:
+                mood_compiled[M] = 100
+    
+    # Compile an overall happiness level
+    bads = (mood_compiled.get('anger', 0) + mood_compiled.get('fear', 0) + mood_compiled.get('sadness', 0) + mood_compiled.get('disgust', 0)) / 2
+    neutrals = (mood_compiled.get('tentative', 0) + mood_compiled.get('analytical', 0) ) / 4
+    goods = (mood_compiled.get('joy', 0) + mood_compiled.get('confident', 0))
+    MAX = max(goods, bads)
+    happ = neutrals
+    if bads > 0:
+        happ -= (bads/MAX)*50
+    if goods > 0:
+        happ += (goods/MAX)*50
+    swingometer = max(0, min(100, happ))
+    
+    # JSON out!
     JSON_OUT = {
         'relativeMode': True,
         'text': txt,

-- 
To stop receiving notification emails like this one, please contact
"commits@kibble.apache.org" <co...@kibble.apache.org>.