Example #1
0
def parse_result_file(filename):
    result = []
    with open(filename) as f:
        data ={}
        timeInNextLine = False

        for line in f:

            if "round" in line:
                data['round'] = get_round(line)
            elif "elapsed" in line:
                timeInNextLine = True
            elif "iterations" in line:
                data['iterations'] = get_iterations(line)
            elif "totalcost" in line:
                data['totalcost'] = get_totalcost(line)
                data['converged'] = True
                result.append(data)
                data = {}
            elif timeInNextLine:
                timeInNextLine = False
                data['time'] = get_time(line)

    f.close()

    df = pd.DataFrame(result)
    stats.compute_stats(df)
Example #2
0
def slave_job(myrank):
    # define the slave
    slave = mns.Slave(myrank, verbose=False)
    # master defines the tasks
    tasks, keys = mns.bcast(None)
    bb = mns.bcast(None)
    slave.barrier(0)

    #pd.read_pickle(file_tiles_to_stats)
    done = False
    #print('slave #%3i is ready to go' % (slave.islave))
    # do_stats_task(slave.islave)
    while not (done):
        itask = slave.get_async_task()
        # itask = slave.islave
        if itask > -1:
            tile = keys[itask]
            print('** slave #%3i processes task %i / tile %s' %
                  (slave.islave, itask, tile))
            stats.compute_stats(bb, tile)

        else:
            done = True

    # slaves work
    slave.barrier(1)

    # master gathers the dataframes
    slave.barrier(2)
Example #3
0
def monoproc_job():
    tasks, keys = define_tasks(resume=True)

    bb = tiles.read_tiles()

    for itask in tasks:
        tile = keys[itask]
        print('** processes tile %s' % tile)
        stats.compute_stats(bb, tile)
Example #4
0
def main():
  #build the list of test words
  f = open(TESTFILE, 'r')
  segments = map(lambda f: f.strip('\n'), f.readlines())
  f.close()
  
  #build dictionary of words vs segments
  for word in segments:
    tmp = word.split('\t')
    STANDARD[tmp[0]] = tmp[1] #put the kv pairing
    WORDS[tmp[0]] = 0

  #print WORDS
  get_segments()
  prune(11)
  discover_new_morphemes()
  segment_words()
  print "Statistics for Dejean algorithm segmentation"
  print "********************************************"
  print compute_stats(CUTS, CORRECT_CUTS, TRUE_BOUNDARIES)
  print
Example #5
0
def main():
  #build the list of test words
  f = open(TESTFILE, 'r')
  segments = map(lambda f: f.strip('\n'), f.readlines())
  f.close()
  
  #build dictionary of words vs segments
  for word in segments:
    tmp = word.split('\t')
    WORDS[tmp[0]] = tmp[1] #put the kv pairing
 
  #RTRIE.pretty_print()
  successor_segmentor()
  print "Successor Stats"
  print "****************"
  print compute_stats(CUTS, CORRECT_CUTS, TRUE_BOUNDARIES)
  print
  predecessor_segmentor()
  print "Predecessor Stats"
  print "****************"
  print compute_stats(CUTS, CORRECT_CUTS, TRUE_BOUNDARIES)
  print
Example #6
0
# 1. Combine multi line messages
# 4. Map phone numbers to users
# 2. Extract emojis
# 5. Sentiment analysis
# FILES AND LOCATIONS # of images, videos, voicemessages and locations
#   GIF omitted
#   image omitted
#   video omitted
#   audio omitted
#   ā€ˇContact card omitted
#   Location: https://maps.google.com/?q=-13.523442,-71.950256
# TIMESPAN: how long did the chat go
# TIMELINE: when and how much you where messaging
# TOTAL NUMBERS days you are chatting, message/word/letter count
# TOPS most active day


if __name__ == "__main__":
    with time_it('Reading'):
        with open('_chat.txt', 'r') as f:
            chat = f.readlines()
        with open('numbers.json', 'r') as f:
            user_number_map = json.load(f)

    with time_it('Parsing'):
        grouped_messages = Message.parse_chat(chat, user_number_map)

    with time_it('Stats'):
        stats = compute_stats(grouped_messages)
        pprint(stats)
Example #7
0
#!/usr/bin/env python

import numpy as np
from stats import Statistics, compute_stats

n = 10
data = np.empty(n)
my_stats = Statistics()
for i in range(n):
    value = 0.3 * i
    my_stats.add(value)
    data[i] = value
print(my_stats.mean())
my_stats = compute_stats(data)
print(my_stats.mean())