Skip to content

Instantly share code, notes, and snippets.

@TkrUdagawa
Last active January 21, 2016 09:03
Show Gist options
  • Save TkrUdagawa/a366be6110cc986d0f49 to your computer and use it in GitHub Desktop.
Save TkrUdagawa/a366be6110cc986d0f49 to your computer and use it in GitHub Desktop.
======== test.py ====================
from jubatus.anomaly import client
from jubatus.common import Datum
cl = client.Anomaly("127.0.0.1", 9199, "test", 0)
for num in range(20):
d = Datum({str(1): num})
print cl.add(d)
cl.clear()
print "model cleared"
for num in range(20):
d = Datum({str(1): num})
print cl.add(d)
======== result ================
id_with_score{id: 0, score: inf}
id_with_score{id: 1, score: inf}
id_with_score{id: 2, score: 1.0}
id_with_score{id: 3, score: 0.900000035763}
id_with_score{id: 4, score: 0.933333396912}
id_with_score{id: 5, score: 0.9375}
id_with_score{id: 6, score: 0.949999988079}
id_with_score{id: 7, score: 0.954545497894}
id_with_score{id: 8, score: 0.961038887501}
id_with_score{id: 9, score: 0.964285671711}
id_with_score{id: 10, score: 0.968253970146}
id_with_score{id: 11, score: 1.06961035728}
id_with_score{id: 12, score: 1.11855649948}
id_with_score{id: 13, score: 1.15561783314}
id_with_score{id: 14, score: 1.1839697361}
id_with_score{id: 15, score: 1.20820200443}
id_with_score{id: 16, score: 1.23136866093}
id_with_score{id: 17, score: 1.24647593498}
id_with_score{id: 18, score: 1.25451350212}
id_with_score{id: 19, score: 1.2572978735}
model cleared
id_with_score{id: 20, score: 1.0}
id_with_score{id: 21, score: inf}
id_with_score{id: 22, score: inf}
id_with_score{id: 23, score: inf}
id_with_score{id: 24, score: inf}
id_with_score{id: 25, score: inf}
id_with_score{id: 26, score: inf}
id_with_score{id: 27, score: inf}
id_with_score{id: 28, score: inf}
id_with_score{id: 29, score: inf}
id_with_score{id: 30, score: inf}
id_with_score{id: 31, score: 2.08631134033}
id_with_score{id: 32, score: 1.58240151405}
id_with_score{id: 33, score: 1.4021487236}
id_with_score{id: 34, score: 1.33156836033}
id_with_score{id: 35, score: 1.29726779461}
id_with_score{id: 36, score: 1.27834665775}
id_with_score{id: 37, score: 1.26611256599}
id_with_score{id: 38, score: 1.26019585133}
id_with_score{id: 39, score: 1.25729799271}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment