}

    state.__setstate__(record)

    self.assertEqual(state.ROWID, record['ROWID'])
    self.assertEqual(state.anomalyScore, record['anomalyScore'])
    self.assertEqual(state.anomalyVector, record['anomalyVector'])
    self.assertEqual(state.anomalyLabel, record['anomalyLabel'])
    self.assertEqual(state.setByUser, record['setByUser'])




  def mockRemoveIds(self, ids):
    self.helper.clamodel._getAnomalyClassifier().getSelf()._knn._numPatterns -= len(ids)
    for idx in ids:
      if idx in self.helper.clamodel._getAnomalyClassifier().getSelf().getParameter('categoryRecencyList'):
        self.helper.clamodel._getAnomalyClassifier().getSelf().getParameter('categoryRecencyList').remove(idx)




if __name__ == '__main__':
  parser = TestOptionParser()
  options, args = parser.parse_args()

  # Form the command line for the unit test framework
  args = [sys.argv[0]] + args
  unittest.main(argv=args)

예제 #2
0
                    print
            if VERBOSITY > 1:
                print tp.getStats()

            # Ensure our predictions are accurate for each sequence
            self.assertGreater(tp.getStats()['predictionScoreAvg2'], 0.8)
            print("tp.getStats()['predictionScoreAvg2'] = ",
                  tp.getStats()['predictionScoreAvg2'])

        print "TPConstant basicTest ok"

    def testCppTpBasic(self):
        self._basicTest(self.cppTp)

    def testPyTpBasic(self):
        self._basicTest(self.pyTp)

    def testIdenticalTps(self):
        self.assertTrue(fdrutils.tpDiff2(self.cppTp, self.pyTp))


if __name__ == "__main__":
    parser = TestOptionParser()
    options, _ = parser.parse_args()
    SEED = options.seed
    VERBOSITY = options.verbosity

    np.random.seed(SEED)

    unittest.main()
예제 #3
0
          print
      if VERBOSITY > 1:
        print tp.getStats()

      # Ensure our predictions are accurate for each sequence
      self.assertGreater(tp.getStats()['predictionScoreAvg2'], 0.8)
      print ("tp.getStats()['predictionScoreAvg2'] = ",
             tp.getStats()['predictionScoreAvg2'])

    print "TPConstant basicTest ok"

  def testCppTpBasic(self):
    self._basicTest(self.cppTp)

  def testPyTpBasic(self):
    self._basicTest(self.pyTp)

  def testIdenticalTps(self):
    self.assertTrue(fdrutils.tpDiff2(self.cppTp, self.pyTp))


if __name__=="__main__":
  parser = TestOptionParser()
  options, _ = parser.parse_args()
  SEED = options.seed
  VERBOSITY = options.verbosity

  np.random.seed(SEED)

  unittest.main()
            "anomalyVector": "Vector",
            "anomalyLabel": "Label",
            "setByUser": False
        }

        state.__setstate__(record)

        self.assertEqual(state.ROWID, record['ROWID'])
        self.assertEqual(state.anomalyScore, record['anomalyScore'])
        self.assertEqual(state.anomalyVector, record['anomalyVector'])
        self.assertEqual(state.anomalyLabel, record['anomalyLabel'])
        self.assertEqual(state.setByUser, record['setByUser'])

    def mockRemoveIds(self, ids):
        self.helper.htm_prediction_model._getAnomalyClassifier().getSelf(
        )._knn._numPatterns -= len(ids)
        for idx in ids:
            if idx in self.helper.htm_prediction_model._getAnomalyClassifier(
            ).getSelf().getParameter('categoryRecencyList'):
                self.helper.htm_prediction_model._getAnomalyClassifier(
                ).getSelf().getParameter('categoryRecencyList').remove(idx)


if __name__ == '__main__':
    parser = TestOptionParser()
    options, args = parser.parse_args()

    # Form the command line for the unit test framework
    args = [sys.argv[0]] + args
    unittest.main(argv=args)