Example #1
0
def ratio(cd, models, suppress=False):
    """For a compressed data set and a set of models, calculate the ratio
    of data elements that make up the data set.
    """
    mc = [0] * len(models)

    if suppress:
        suppress.suppress(2)

    for d in cd:
        bm = optimalModel(d, models)[0]
        if not (bm == -1):
            mc[bm] += 1

    if suppress:
        suppress.restore(2)

    r = [(t * 1.0) / len(cd) for t in mc]

    return r, mc
Example #2
0
def ratio(cd, models, suppress = False):
    """For a compressed data set and a set of models, calculate the ratio
    of data elements that make up the data set.
    """
    mc = [0] * len(models)
    
    if suppress:
        suppress.suppress(2)

    for d in cd:
        bm = optimalModel(d, models)[0]
        if not (bm == -1):
            mc[bm] += 1

    if suppress:
        suppress.restore(2)
    
    r = [(t * 1.0)/len(cd) for t in mc]
    
    return r, mc
Example #3
0
"""cluster_score.py
Author: James Howard

Short program to give the score of a given clustering
"""

import pybb.math.markov_anneal as markov_anneal
import pybb.data.dataio as dataio
import pybb.math.hmmextra as hmmextra
import os
import pybb.suppress as suppress

suppress.suppress(2)
from ghmm import *

suppress.restore(2)

readLocation = "../../runs/clean/models/"

if __name__ == "__main__":
    files = os.listdir(readLocation)

    suppress.suppress(2)
    for f in files:
        print f
        #It is a data file.
        if f.split('.')[-1] == 'dat':

            #Open files
            fn = dataio.loadData(readLocation + str(f))
            fn.matrixToModel(fn.modelList)
Example #4
0
"""cluster_score.py
Author: James Howard

Short program to give the score of a given clustering
"""

import pybb.math.markov_anneal as markov_anneal
import pybb.data.dataio as dataio
import pybb.math.hmmextra as hmmextra
import os
import pybb.suppress as suppress
suppress.suppress(2)
from ghmm import *
suppress.restore(2)

readLocation = "../../runs/clean/models/"

if __name__ == "__main__":
    files = os.listdir(readLocation)

    suppress.suppress(2)
    for f in files:
        print f
        #It is a data file.
        if f.split('.')[-1] == 'dat':
        
            #Open files
            fn = dataio.loadData(readLocation + str(f))
            fn.matrixToModel(fn.modelList)
            
            sigma = IntegerRange(0, fn.obs)