{"id":28194,"library":"snorkel","title":"Snorkel","description":"A system for quickly generating training data with weak supervision. Uses labeling functions and probabilistic models to create noisy labels. Current version 0.10.0, supports Python >=3.11. Releases are infrequent; maintenance updates only.","status":"active","version":"0.10.0","language":"python","source_language":"en","source_url":"https://github.com/snorkel-team/snorkel/","tags":["weak supervision","labeling","data programming","ml","nlp"],"install":[{"cmd":"pip install snorkel","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"LabelModel was moved to snorkel.labeling.model in v0.9.4, but still accessible via old path for backward compatibility.","wrong":"from snorkel.labeling import LabelModel","symbol":"LabelModel","correct":"from snorkel.labeling.model import LabelModel"},{"note":"LFAnalysis is in snorkel.labeling, not other submodules.","wrong":"from snorkel.labeling import LabelingFunction","symbol":"LFAnalysis","correct":"from snorkel.labeling import LFAnalysis"},{"note":"Must import from snorkel.classification.","wrong":"from snorkel import SnorkelClassifier","symbol":"SnorkelClassifier","correct":"from snorkel.classification import SnorkelClassifier"}],"quickstart":{"code":"from snorkel.labeling import labeling_function, LFAnalysis\nfrom snorkel.labeling.model import LabelModel\nimport numpy as np\n\n@labeling_function()\ndef lf_keyword(x):\n    # Return 1 if 'keyword' in text else 0\n    return 1 if 'keyword' in x else 0\n\n# Example data\ndata = ['text with keyword', 'no match']\n# Apply LFs (simulate L matrix)\nL = np.array([[1, 0], [0, 0])\n# Train LabelModel\nlabel_model = LabelModel(cardinality=2, verbose=True)\nlabel_model.fit(L_train=L, n_epochs=500, log_freq=100, seed=123)\npredictions = label_model.predict(L=L)","lang":"python","description":"Basic Snorkel flow: define labeling functions, generate label matrix, train LabelModel."},"warnings":[{"fix":"Use Python >=3.11, or install snorkel==0.9.9 if locked to older Python.","message":"Snorkel 0.10.0 dropped support for Python <3.11. If your environment uses Python 3.10 or earlier, you must downgrade to snorkel <=0.9.9 or upgrade Python.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Always specify n_epochs (e.g., 500) when calling fit().","message":"LabelModel.fit() requires n_epochs to be explicitly set; default is None and will raise error. Many users forget to set n_epochs.","severity":"gotcha","affected_versions":">=0.9.1"},{"fix":"Use from snorkel.labeling.model import LabelModel.","message":"LabelModel renamed from 'LabelModel' to 'LabelModel' (still same) but old path snorkel.labeling.LabelModel still works but discouraged.","severity":"deprecated","affected_versions":">=0.9.4"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Call label_model.fit(...) before predict().","cause":"Calling predict() without first calling fit() on LabelModel.","error":"ValueError: Label model must be fit before calling predict."},{"fix":"Upgrade snorkel: pip install --upgrade snorkel. Or import from snorkel.labeling import LabelModel if using older version.","cause":"Installed snorkel version <0.9.4 where the model submodule did not exist.","error":"ModuleNotFoundError: No module named 'snorkel.labeling.model'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}