rishanthrajendhran commited on
Commit
3b81331
·
verified ·
1 Parent(s): 93c4897

Card: quick start with the idealens package (classify, extract, score)

Browse files
Files changed (1) hide show
  1. README.md +11 -3
README.md CHANGED
@@ -34,16 +34,24 @@ idealens run docs.jsonl -o scores.jsonl --model IdeaLens-LogisticClassifier
34
 
35
  Input is JSONL with a `text` field per document. To score outlines you already have, use `idealens score outlines.jsonl -o scores.jsonl --model IdeaLens-LogisticClassifier`. Score outlines as extracted; the paraphrasing step is only for training data.
36
 
37
- In Python:
38
 
39
  ```python
40
  import idealens as il
41
 
 
 
 
42
  with il.Detector("IdeaLens-LogisticClassifier") as det:
43
- records = il.run(texts, det) # classify, extract and score
44
- print(records[0]["p_human"], records[0]["verdict"]["ai"])
 
 
 
45
  ```
46
 
 
 
47
  ## Thresholds
48
 
49
  `thresholds.json` holds this model's cuts at 0.1%, 0.5%, 1%, 2% and 5% false-positive rates, fitted on the 80,000 human
 
34
 
35
  Input is JSONL with a `text` field per document. To score outlines you already have, use `idealens score outlines.jsonl -o scores.jsonl --model IdeaLens-LogisticClassifier`. Score outlines as extracted; the paraphrasing step is only for training data.
36
 
37
+ In Python, step by step:
38
 
39
  ```python
40
  import idealens as il
41
 
42
+ texts = [open("document.txt").read()]
43
+ formats = il.classify(texts) # one of the eight formats per document
44
+ outlines = il.extract(texts, formats) # role-labelled outlines
45
  with il.Detector("IdeaLens-LogisticClassifier") as det:
46
+ records = det.score_outlines(outlines, format=formats)
47
+
48
+ r = records[0]
49
+ print(r["p_human"], r["verdict"]["ai"]) # P(human); flagged at the 1% global cut?
50
+ print(outlines[0].render()) # the outline that was scored
51
  ```
52
 
53
+ Or in one call: `records = il.run(texts, det)`. `classify` and `extract` use Gemini 3.7 Flash, the extractor the thresholds were fitted with (`GEMINI_API_KEY`); pass `provider=idealens.providers.make(...)` to use Vertex, OpenAI, Anthropic, OpenRouter or a local server. The [package README](https://github.com/RishanthRajendhran/IdeaLens#ways-to-use-idealens) covers the other ways to run it.
54
+
55
  ## Thresholds
56
 
57
  `thresholds.json` holds this model's cuts at 0.1%, 0.5%, 1%, 2% and 5% false-positive rates, fitted on the 80,000 human