C = int(options.C)
K = int(options.K)
iterations = int(options.I)

print "init dataset"
dataset = []
N = 0
for row in sys.stdin:
  if (N % 100000 == 0): print "processed " + str(N) + " rows."
  splitrow = row.split("\t")
  dataset.append(map(int, splitrow))
  N += 1
print "finished dataset"

hyperP = MME.MultinomialMixtureModelHyperparams(C, K, [1]*C, [1]*K)

finalModel = MMB.computeDirichletMixture(dataset, hyperP, iterations, int(options.B), float(options.R))

logging.debug("Final Model:")
outputModel = sys.stdin
if (options.outputModel): outputModel = open(options.outputModel, 'w')
finalModel.outputToFile(outputModel)

#finalModel.outputToTSV(sys.stdout)

(worst, worstN, worstC) = MME.worstFit(dataset, finalModel)
print "worst", worst
print "worst N", worstN
print "worst: ", dataset[worstN]
print "worst C", worstC
예제 #2
0
    raise ValueError('Invalid log level: %s' % loglevel)
logging.basicConfig(level=numeric_level)

C = int(options.C)
iterations = int(options.I)

print "init dataset"
dataset = []
N = 0
for row in sys.stdin:
  if (N % 100000 == 0): print "processed " + str(N) + " rows."
  splitrow = row.split("\t")
  dataset.append(map(int, splitrow))
  N += 1
print "finished dataset"

hyperP = MME.MultinomialMixtureModelHyperparams(C, 168, [1]*C, [1]*168)

finalModel = MME.computeDirichletMixture(dataset, hyperP, iterations)

logging.debug("Final Model:")
outputModel = sys.stdin
if (options.outputModel): outputModel = open(options.outputModel, 'w')
finalModel.outputToFile(outputModel)

finalModel.outputToTSV(sys.stdout)

(worseLogProb, worstN, worstC) = MME.worstFit(dataset, finalModel)
print "worstLogProb", worseLogProb
print "worst N", worstN
print "worst C", worstC
예제 #3
0
    raise ValueError('Invalid log level: %s' % loglevel)
logging.basicConfig(level=numeric_level)

C = int(options.C)
iterations = int(options.I)

print "init dataset"
dataset = []
N = 0
for row in sys.stdin:
    if (N % 100000 == 0): print "processed " + str(N) + " rows."
    splitrow = row.split("\t")
    dataset.append(map(int, splitrow))
    N += 1
print "finished dataset"

hyperP = MME.MultinomialMixtureModelHyperparams(C, 168, [1] * C, [1] * 168)

finalModel = MME.computeDirichletMixture(dataset, hyperP, iterations)

logging.debug("Final Model:")
outputModel = sys.stdin
if (options.outputModel): outputModel = open(options.outputModel, 'w')
finalModel.outputToFile(outputModel)

finalModel.outputToTSV(sys.stdout)

(worseLogProb, worstN, worstC) = MME.worstFit(dataset, finalModel)
print "worstLogProb", worseLogProb
print "worst N", worstN
print "worst C", worstC
C = int(options.C)
K = int(options.K)
iterations = int(options.I)

print "init dataset"
dataset = []
N = 0
for row in sys.stdin:
    if (N % 100000 == 0): print "processed " + str(N) + " rows."
    splitrow = row.split("\t")
    dataset.append(map(int, splitrow))
    N += 1
print "finished dataset"

hyperP = MME.MultinomialMixtureModelHyperparams(C, K, [1] * C, [1] * K)

finalModel = MMB.computeDirichletMixture(dataset, hyperP, iterations,
                                         int(options.B), float(options.R))

logging.debug("Final Model:")
outputModel = sys.stdin
if (options.outputModel): outputModel = open(options.outputModel, 'w')
finalModel.outputToFile(outputModel)

#finalModel.outputToTSV(sys.stdout)

(worst, worstN, worstC) = MME.worstFit(dataset, finalModel)
print "worst", worst
print "worst N", worstN
print "worst C", worstC