예제 #1
0
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()
예제 #2
0
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()
예제 #3
0
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)
예제 #4
0
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