コード例 #1
0
ファイル: main.py プロジェクト: akkinenirajesh/distributions
 def __init__(self):
     self.clustering = PitmanYor.from_dict({
         'alpha': 100.0,
         'd': 0.1,
     })
     self.feature = nich.Shared.from_dict({
         'mu': 0.0,
         'kappa': 0.1,
         'sigmasq': 0.01,
         'nu': 1.0,
     })
コード例 #2
0
ファイル: main.py プロジェクト: zbxzc35/distributions
 def __init__(self):
     self.clustering = PitmanYor.from_dict({
         'alpha': 100.0,
         'd': 0.1,
     })
     self.feature = nich.Shared.from_dict({
         'mu': 0.0,
         'kappa': 0.1,
         'sigmasq': 0.01,
         'nu': 1.0,
     })
コード例 #3
0
ファイル: generate.py プロジェクト: dlovell/loom
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import os
import random
import parsable
from distributions.lp.clustering import PitmanYor
from loom.util import tempdir
from distributions.io.stream import open_compressed
import loom.schema
import loom.hyperprior
import loom.config
import loom.runner
parsable = parsable.Parsable()

CLUSTERING = PitmanYor.from_dict({'alpha': 2.0, 'd': 0.1})


def generate_kinds(feature_count):
    '''
    Generate an exponential kind structure, e.g.,
    [o|oo|oooo|oooooooo|oooooooooooooooo|oooooooooooooooooooooooooooooooo]
    '''
    featureid_to_kindid = []
    for i in xrange(feature_count):
        featureid_to_kindid.extend([i] * (2 ** i))
        if len(featureid_to_kindid) >= feature_count:
            break
    featureid_to_kindid = featureid_to_kindid[:feature_count]
    random.shuffle(featureid_to_kindid)
    return featureid_to_kindid
コード例 #4
0
        'alpha': [.5, 1.5],
        'gamma': [.5, 1.5],
    },
    'gp': {
        'alpha': [.5, 1.5],
        'inv_beta': [.5, 1.5],
    },
    'nich': {
        'kappa': [.5, 1.5],
        'mu': [-1., 1.],
        'nu': [.5, 1.5],
        'sigmasq': [.5, 1.5],
    }
}

CLUSTERING = PitmanYor.from_dict({'alpha': 2.0, 'd': 0.1})

if __name__ == '__main__' and sys.stdout.isatty():
    colorize = {
        'Info': '\x1b[34mInfo\x1b[0m',
        'Warn': '\x1b[33mWarn\x1b[0m',
        'Fail': '\x1b[31mFail\x1b[0m',
        'Pass': '******',
    }
else:
    colorize = {}


def LOG(prefix, casename, comment=''):
    prefix = colorize.get(prefix, prefix)
    message = '{: <4} {: <18} {}'.format(prefix, casename, comment)
コード例 #5
0
ファイル: test_posterior_enum.py プロジェクト: jostheim/loom
KIND_MAX_SIZE = 205
GRID_SIZE = 2

PITMAN_YOR_GRID = [{"alpha": 2.0, "d": 0.1}, {"alpha": 10.0, "d": 0.1}]

HYPER_PRIOR = {
    "topology": PITMAN_YOR_GRID,
    "clustering": PITMAN_YOR_GRID,
    "bb": {"alpha": [0.5, 2.0], "beta": [0.5, 2.0]},
    "dd": {"alpha": [0.5, 1.5]},
    "dpd": {"alpha": [0.5, 1.5], "gamma": [0.5, 1.5]},
    "gp": {"alpha": [0.5, 1.5], "inv_beta": [0.5, 1.5]},
    "nich": {"kappa": [0.5, 1.5], "mu": [-1.0, 1.0], "nu": [0.5, 1.5], "sigmasq": [0.5, 1.5]},
}

CLUSTERING = PitmanYor.from_dict({"alpha": 2.0, "d": 0.1})

if __name__ == "__main__" and sys.stdout.isatty():
    colorize = {
        "Info": "\x1b[34mInfo\x1b[0m",
        "Warn": "\x1b[33mWarn\x1b[0m",
        "Fail": "\x1b[31mFail\x1b[0m",
        "Pass": "******",
    }
else:
    colorize = {}


def LOG(prefix, casename, comment=""):
    prefix = colorize.get(prefix, prefix)
    message = "{: <4} {: <18} {}".format(prefix, casename, comment)