Skip to content

Commit 4c227a0

Browse files
authored
Model baseline model imports to snorkel/labeling/model (#1535)
1 parent 4c36133 commit 4c227a0

File tree

7 files changed

+15
-19
lines changed

7 files changed

+15
-19
lines changed

docs/packages.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
"lf.nlp.NLPLabelingFunction",
1818
"lf.nlp.nlp_labeling_function",
1919
"lf.nlp_spark.SparkNLPLabelingFunction",
20-
"lf.nlp_spark.spark_nlp_labeling_function"
20+
"lf.nlp_spark.spark_nlp_labeling_function",
21+
"model.baselines.MajorityClassVoter",
22+
"model.baselines.MajorityLabelVoter",
23+
"model.baselines.RandomVoter",
24+
"model.label_model.LabelModel"
2125
],
2226
"map": [
2327
"spark.make_spark_mapper"

docs/packages/labeling.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Programmatic data set labeling: LF creation, models, and analysis utilities.
1212
apply.dask.DaskLFApplier
1313
LFAnalysis
1414
LFApplier
15-
LabelModel
15+
model.label_model.LabelModel
1616
LabelingFunction
17-
MajorityClassVoter
18-
MajorityLabelVoter
17+
model.baselines.MajorityClassVoter
18+
model.baselines.MajorityLabelVoter
1919
lf.nlp.NLPLabelingFunction
2020
PandasLFApplier
2121
apply.dask.PandasParallelLFApplier
22-
RandomVoter
22+
model.baselines.RandomVoter
2323
apply.spark.SparkLFApplier
2424
lf.nlp_spark.SparkNLPLabelingFunction
2525
filter_unlabeled_dataframe

snorkel/labeling/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,4 @@
44
from .apply.core import LFApplier # noqa: F401
55
from .apply.pandas import PandasLFApplier # noqa: F401
66
from .lf.core import LabelingFunction, labeling_function # noqa: F401
7-
from .model.baselines import ( # noqa: F401
8-
MajorityClassVoter,
9-
MajorityLabelVoter,
10-
RandomVoter,
11-
)
12-
from .model.label_model import LabelModel # noqa: F401
137
from .utils import filter_unlabeled_dataframe # noqa: F401

snorkel/labeling/model/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .baselines import MajorityClassVoter, MajorityLabelVoter, RandomVoter # noqa: F401
2+
from .label_model import LabelModel # noqa: F401

test/labeling/model/test_baseline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import numpy as np
44

5-
from snorkel.labeling import MajorityClassVoter, MajorityLabelVoter, RandomVoter
5+
from snorkel.labeling.model import MajorityClassVoter, MajorityLabelVoter, RandomVoter
66

77

88
class BaselineModelTest(unittest.TestCase):

test/labeling/model/test_label_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import torch.nn as nn
1010
import torch.optim as optim
1111

12-
from snorkel.labeling import LabelModel
12+
from snorkel.labeling.model import LabelModel
1313
from snorkel.labeling.model.label_model import TrainConfig
1414
from snorkel.synthetic.synthetic_data import generate_simple_label_matrix
1515

test/labeling/test_convergence.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66
import pytest
77
import torch
88

9-
from snorkel.labeling import (
10-
LabelingFunction,
11-
LabelModel,
12-
PandasLFApplier,
13-
labeling_function,
14-
)
9+
from snorkel.labeling import LabelingFunction, PandasLFApplier, labeling_function
10+
from snorkel.labeling.model import LabelModel
1511
from snorkel.preprocess import preprocessor
1612
from snorkel.types import DataPoint
1713

0 commit comments

Comments
 (0)