Skip to content
This repository was archived by the owner on Aug 9, 2024. It is now read-only.
This repository was archived by the owner on Aug 9, 2024. It is now read-only.

Example on README did not work #311

@bkowshik

Description

@bkowshik

Example on README

import mwapi
from revscoring import ScorerModel
from revscoring.extractors.api.extractor import Extractor

with open("models/enwiki.damaging.linear_svc.model") as f:
    scorer_model = ScorerModel.load(f)

extractor = Extractor(mwapi.Session(host="https://en.wikipedia.org", user_agent="revscoring demo"))
feature_values = list(extractor.extract(123456789, scorer_model.features))

print(scorer_model.score(feature_values))
# {'prediction': True, 'probability': {False: 0.4694409344514984, True: 0.5305590655485017}}

Error message

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-1-a72266a26745> in <module>()
      3 from revscoring.extractors.api.extractor import Extractor
      4
----> 5 with open("models/enwiki.damaging.linear_svc.model") as f:
      6     scorer_model = ScorerModel.load(f)
      7

FileNotFoundError: [Errno 2] No such file or directory: 'models/enwiki.damaging.linear_svc.model'

I am 🤔 what should be done to get the example working.


cc: @halfak @geohacker

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions