def _plot(eprobs):
  print 'plotting'
  probs = numpy.array([0.5, 0.5])
  lst = [oneclasstree.bayesian(eprobs[:x,:])[1] for x in range(1, eprobs.shape[0]+1)]
  plt.figure()
  plt.plot(lst)
  plt.show()
def _plot(eprobs):
    print 'plotting'
    probs = numpy.array([0.5, 0.5])
    lst = [
        oneclasstree.bayesian(eprobs[:x, :])[1]
        for x in range(1, eprobs.shape[0] + 1)
    ]
    plt.figure()
    plt.plot(lst)
    plt.show()
try:
    with open(classifier, 'rb') as f:
        classifier = pickle.load(f)
        assert hasattr(classifier, 'classify')
except:
    print "could not load classifier"
    print_help()
    exit()


def _plot(eprobs):
    print 'plotting'
    probs = numpy.array([0.5, 0.5])
    lst = [
        oneclasstree.bayesian(eprobs[:x, :])[1]
        for x in range(1, eprobs.shape[0] + 1)
    ]
    plt.figure()
    plt.plot(lst)
    plt.show()


for pcap in remainder:
    X = pacumen.make_feature_vectors_from_pcap(pcap)
    eprobs = classifier.classify(X)
    if visualize:
        _plot(eprobs)
    eprobs = oneclasstree.bayesian(eprobs)
    print '%f  %s' % (eprobs[1], pcap)
if classifier == None or len(remainder) < 1:
  print_help()
  exit()

try:
  with open(classifier, 'rb') as f:
    classifier = pickle.load(f)
    assert hasattr(classifier, 'classify')
except:
  print "could not load classifier"
  print_help()
  exit()

def _plot(eprobs):
  print 'plotting'
  probs = numpy.array([0.5, 0.5])
  lst = [oneclasstree.bayesian(eprobs[:x,:])[1] for x in range(1, eprobs.shape[0]+1)]
  plt.figure()
  plt.plot(lst)
  plt.show()


for pcap in remainder:
  X = pacumen.make_feature_vectors_from_pcap(pcap)
  eprobs = classifier.classify(X)
  if visualize:
    _plot(eprobs)
  eprobs = oneclasstree.bayesian(eprobs)
  print '%f  %s' % (eprobs[1], pcap)
示例#5
0
def classify_pcap(classifier, pcap):
  fv = make_feature_vectors_from_pcap(pcap)
  result = classifier.classify(fv)
  result = oneclasstree.bayesian(result)[1]
  #print pcap, result, result > 0.5
  return result