kumoai 2.14.0.dev202512181731__cp312-cp312-macosx_11_0_arm64.whl → 2.14.0.dev202512301731__cp312-cp312-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kumoai/__init__.py +23 -26
- kumoai/_version.py +1 -1
- kumoai/client/client.py +6 -0
- kumoai/client/jobs.py +24 -0
- kumoai/experimental/rfm/__init__.py +22 -22
- kumoai/experimental/rfm/backend/local/graph_store.py +12 -21
- kumoai/experimental/rfm/backend/local/sampler.py +0 -3
- kumoai/experimental/rfm/backend/local/table.py +25 -24
- kumoai/experimental/rfm/backend/snow/sampler.py +106 -61
- kumoai/experimental/rfm/backend/snow/table.py +146 -51
- kumoai/experimental/rfm/backend/sqlite/sampler.py +127 -78
- kumoai/experimental/rfm/backend/sqlite/table.py +94 -47
- kumoai/experimental/rfm/base/__init__.py +6 -7
- kumoai/experimental/rfm/base/column.py +97 -5
- kumoai/experimental/rfm/base/expression.py +44 -0
- kumoai/experimental/rfm/base/sampler.py +5 -17
- kumoai/experimental/rfm/base/source.py +1 -1
- kumoai/experimental/rfm/base/sql_sampler.py +68 -9
- kumoai/experimental/rfm/base/table.py +284 -120
- kumoai/experimental/rfm/graph.py +139 -86
- kumoai/experimental/rfm/infer/__init__.py +6 -4
- kumoai/experimental/rfm/infer/dtype.py +6 -1
- kumoai/experimental/rfm/infer/multicategorical.py +1 -1
- kumoai/experimental/rfm/infer/stype.py +35 -0
- kumoai/experimental/rfm/relbench.py +76 -0
- kumoai/experimental/rfm/rfm.py +4 -20
- kumoai/trainer/distilled_trainer.py +175 -0
- kumoai/utils/display.py +51 -0
- {kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202512301731.dist-info}/METADATA +1 -1
- {kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202512301731.dist-info}/RECORD +33 -30
- kumoai/experimental/rfm/base/column_expression.py +0 -16
- kumoai/experimental/rfm/base/sql_table.py +0 -113
- {kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202512301731.dist-info}/WHEEL +0 -0
- {kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202512301731.dist-info}/licenses/LICENSE +0 -0
- {kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202512301731.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Literal, Mapping, Optional, Union, overload
|
|
3
|
+
|
|
4
|
+
from kumoapi.distilled_model_plan import DistilledModelPlan
|
|
5
|
+
from kumoapi.jobs import DistillationJobRequest, DistillationJobResource
|
|
6
|
+
|
|
7
|
+
from kumoai import global_state
|
|
8
|
+
from kumoai.client.jobs import TrainingJobID
|
|
9
|
+
from kumoai.graph import Graph
|
|
10
|
+
from kumoai.pquery.training_table import TrainingTable, TrainingTableJob
|
|
11
|
+
from kumoai.trainer.job import TrainingJob, TrainingJobResult
|
|
12
|
+
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class DistillationTrainer:
|
|
17
|
+
r"""A trainer supports creating a Kumo machine learning model
|
|
18
|
+
for use in an online serving endpoint. The distllation process involes
|
|
19
|
+
training a shallow model on a :class:`~kumoai.pquery.PredictiveQuery` using
|
|
20
|
+
the embeddings generated by a base model :args:`base_training_job_id`.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
model_plan: The distilled model plan to use for the distillation process.
|
|
24
|
+
base_training_job_id: The ID of the base training job to use for the distillation process.
|
|
25
|
+
""" # noqa: E501
|
|
26
|
+
|
|
27
|
+
def __init__(
|
|
28
|
+
self,
|
|
29
|
+
model_plan: DistilledModelPlan,
|
|
30
|
+
base_training_job_id: TrainingJobID,
|
|
31
|
+
) -> None:
|
|
32
|
+
self.model_plan: DistilledModelPlan = model_plan
|
|
33
|
+
self.base_training_job_id: TrainingJobID = base_training_job_id
|
|
34
|
+
|
|
35
|
+
# Cached from backend:
|
|
36
|
+
self._training_job_id: Optional[TrainingJobID] = None
|
|
37
|
+
|
|
38
|
+
# Metadata ################################################################
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def is_trained(self) -> bool:
|
|
42
|
+
r"""Returns ``True`` if this trainer instance has successfully been
|
|
43
|
+
trained (and is therefore ready for prediction); ``False`` otherwise.
|
|
44
|
+
"""
|
|
45
|
+
raise NotImplementedError(
|
|
46
|
+
"Checking if a distilled trainer is trained is not "
|
|
47
|
+
"implemented yet.")
|
|
48
|
+
|
|
49
|
+
@overload
|
|
50
|
+
def fit(
|
|
51
|
+
self,
|
|
52
|
+
graph: Graph,
|
|
53
|
+
train_table: Union[TrainingTable, TrainingTableJob],
|
|
54
|
+
) -> TrainingJobResult:
|
|
55
|
+
pass
|
|
56
|
+
|
|
57
|
+
@overload
|
|
58
|
+
def fit(
|
|
59
|
+
self,
|
|
60
|
+
graph: Graph,
|
|
61
|
+
train_table: Union[TrainingTable, TrainingTableJob],
|
|
62
|
+
*,
|
|
63
|
+
non_blocking: Literal[False],
|
|
64
|
+
) -> TrainingJobResult:
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
@overload
|
|
68
|
+
def fit(
|
|
69
|
+
self,
|
|
70
|
+
graph: Graph,
|
|
71
|
+
train_table: Union[TrainingTable, TrainingTableJob],
|
|
72
|
+
*,
|
|
73
|
+
non_blocking: Literal[True],
|
|
74
|
+
) -> TrainingJob:
|
|
75
|
+
pass
|
|
76
|
+
|
|
77
|
+
@overload
|
|
78
|
+
def fit(
|
|
79
|
+
self,
|
|
80
|
+
graph: Graph,
|
|
81
|
+
train_table: Union[TrainingTable, TrainingTableJob],
|
|
82
|
+
*,
|
|
83
|
+
non_blocking: bool,
|
|
84
|
+
) -> Union[TrainingJob, TrainingJobResult]:
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
def fit(
|
|
88
|
+
self,
|
|
89
|
+
graph: Graph,
|
|
90
|
+
train_table: Union[TrainingTable, TrainingTableJob],
|
|
91
|
+
*,
|
|
92
|
+
non_blocking: bool = False,
|
|
93
|
+
custom_tags: Mapping[str, str] = {},
|
|
94
|
+
) -> Union[TrainingJob, TrainingJobResult]:
|
|
95
|
+
r"""Fits a model to the specified graph and training table, with the
|
|
96
|
+
strategy defined by :class:`DistilledTrainer`'s :obj:`model_plan`.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
graph: The :class:`~kumoai.graph.Graph` object that represents the
|
|
100
|
+
tables and relationships that Kumo will learn from.
|
|
101
|
+
train_table: The :class:`~kumoai.pquery.TrainingTable`, or
|
|
102
|
+
in-progress :class:`~kumoai.pquery.TrainingTableJob`, that
|
|
103
|
+
represents the training data produced by a
|
|
104
|
+
:class:`~kumoai.pquery.PredictiveQuery` on :obj:`graph`.
|
|
105
|
+
non_blocking: Whether this operation should return immediately
|
|
106
|
+
after launching the training job, or await completion of the
|
|
107
|
+
training job.
|
|
108
|
+
custom_tags: Additional, customer defined k-v tags to be associated
|
|
109
|
+
with the job to be launched. Job tags are useful for grouping
|
|
110
|
+
and searching jobs.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
Union[TrainingJobResult, TrainingJob]:
|
|
114
|
+
If ``non_blocking=False``, returns a training job object. If
|
|
115
|
+
``non_blocking=True``, returns a training job future object.
|
|
116
|
+
"""
|
|
117
|
+
# TODO(manan, siyang): remove soon:
|
|
118
|
+
job_id = train_table.job_id
|
|
119
|
+
assert job_id is not None
|
|
120
|
+
|
|
121
|
+
train_table_job_api = global_state.client.generate_train_table_job_api
|
|
122
|
+
pq_id = train_table_job_api.get(job_id).config.pquery_id
|
|
123
|
+
assert pq_id is not None
|
|
124
|
+
|
|
125
|
+
custom_table = None
|
|
126
|
+
if isinstance(train_table, TrainingTable):
|
|
127
|
+
custom_table = train_table._custom_train_table
|
|
128
|
+
|
|
129
|
+
# NOTE the backend implementation currently handles sequentialization
|
|
130
|
+
# between a training table future and a training job; that is, if the
|
|
131
|
+
# training table future is still executing, the backend will wait on
|
|
132
|
+
# the job ID completion before executing a training job. This preserves
|
|
133
|
+
# semantics for both futures, ensures that Kumo works as expected if
|
|
134
|
+
# used only via REST API, and allows us to avoid chaining calllbacks
|
|
135
|
+
# in an ugly way here:
|
|
136
|
+
api = global_state.client.distillation_job_api
|
|
137
|
+
self._training_job_id = api.create(
|
|
138
|
+
DistillationJobRequest(
|
|
139
|
+
dict(custom_tags),
|
|
140
|
+
pquery_id=pq_id,
|
|
141
|
+
base_training_job_id=self.base_training_job_id,
|
|
142
|
+
distilled_model_plan=self.model_plan,
|
|
143
|
+
graph_snapshot_id=graph.snapshot(non_blocking=non_blocking),
|
|
144
|
+
train_table_job_id=job_id,
|
|
145
|
+
custom_train_table=custom_table,
|
|
146
|
+
))
|
|
147
|
+
|
|
148
|
+
out = TrainingJob(job_id=self._training_job_id)
|
|
149
|
+
if non_blocking:
|
|
150
|
+
return out
|
|
151
|
+
return out.attach()
|
|
152
|
+
|
|
153
|
+
@classmethod
|
|
154
|
+
def _load_from_job(
|
|
155
|
+
cls,
|
|
156
|
+
job: DistillationJobResource,
|
|
157
|
+
) -> 'DistillationTrainer':
|
|
158
|
+
trainer = cls(job.config.distilled_model_plan,
|
|
159
|
+
job.config.base_training_job_id)
|
|
160
|
+
trainer._training_job_id = job.job_id
|
|
161
|
+
return trainer
|
|
162
|
+
|
|
163
|
+
@classmethod
|
|
164
|
+
def load(cls, job_id: TrainingJobID) -> 'DistillationTrainer':
|
|
165
|
+
r"""Creates a :class:`~kumoai.trainer.Trainer` instance from a training
|
|
166
|
+
job ID.
|
|
167
|
+
"""
|
|
168
|
+
raise NotImplementedError(
|
|
169
|
+
"Loading a distilled trainer from a job ID is not implemented yet."
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
@classmethod
|
|
173
|
+
def load_from_tags(cls, tags: Mapping[str, str]) -> 'DistillationTrainer':
|
|
174
|
+
raise NotImplementedError(
|
|
175
|
+
"Loading a distilled trainer from tags is not implemented yet.")
|
kumoai/utils/display.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from collections.abc import Sequence
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
|
|
5
|
+
from kumoai import in_notebook, in_snowflake_notebook
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def message(msg: str) -> None:
|
|
9
|
+
msg = msg.replace("`", "'") if not in_notebook() else msg
|
|
10
|
+
|
|
11
|
+
if in_snowflake_notebook():
|
|
12
|
+
import streamlit as st
|
|
13
|
+
st.markdown(msg)
|
|
14
|
+
elif in_notebook():
|
|
15
|
+
from IPython.display import Markdown, display
|
|
16
|
+
display(Markdown(msg))
|
|
17
|
+
else:
|
|
18
|
+
print(msg)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def title(msg: str) -> None:
|
|
22
|
+
message(f"### {msg}" if in_notebook() else f"{msg}:")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def italic(msg: str) -> None:
|
|
26
|
+
message(f"*{msg}*" if in_notebook() else msg)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def unordered_list(items: Sequence[str]) -> None:
|
|
30
|
+
if in_notebook():
|
|
31
|
+
msg = '\n'.join([f"- {item}" for item in items])
|
|
32
|
+
else:
|
|
33
|
+
msg = '\n'.join([f"• {item.replace('`', '')}" for item in items])
|
|
34
|
+
message(msg)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def dataframe(df: pd.DataFrame) -> None:
|
|
38
|
+
if in_snowflake_notebook():
|
|
39
|
+
import streamlit as st
|
|
40
|
+
st.dataframe(df, hide_index=True)
|
|
41
|
+
elif in_notebook():
|
|
42
|
+
from IPython.display import display
|
|
43
|
+
try:
|
|
44
|
+
if hasattr(df.style, 'hide'):
|
|
45
|
+
display(df.style.hide(axis='index')) # pandas=2
|
|
46
|
+
else:
|
|
47
|
+
display(df.style.hide_index()) # pandas<1.3
|
|
48
|
+
except ImportError:
|
|
49
|
+
print(df.to_string(index=False)) # missing jinja2
|
|
50
|
+
else:
|
|
51
|
+
print(df.to_string(index=False))
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
kumoai/_logging.py,sha256=U2_5ROdyk92P4xO4H2WJV8EC7dr6YxmmnM-b7QX9M7I,886
|
|
2
2
|
kumoai/mixin.py,sha256=MP413xzuCqWhxAPUHmloLA3j4ZyF1tEtfi516b_hOXQ,812
|
|
3
|
-
kumoai/_version.py,sha256=
|
|
3
|
+
kumoai/_version.py,sha256=zkmtgpHzS-8suGoRkSmHrktIFS142gX_ptBF0P9S3u4,39
|
|
4
4
|
kumoai/kumolib.cpython-312-darwin.so,sha256=xQvdWHx9xmQ11y3F3ywxJv6A0sDk6D3-2fQbxSdM1z4,232576
|
|
5
|
-
kumoai/__init__.py,sha256=
|
|
5
|
+
kumoai/__init__.py,sha256=x6Emn6VesHQz0wR7ZnbddPRYO9A5-0JTHDkzJ3Ocq6w,10907
|
|
6
6
|
kumoai/formatting.py,sha256=jA_rLDCGKZI8WWCha-vtuLenVKTZvli99Tqpurz1H84,953
|
|
7
7
|
kumoai/futures.py,sha256=oJFIfdCM_3nWIqQteBKYMY4fPhoYlYWE_JA2o6tx-ng,3737
|
|
8
8
|
kumoai/jobs.py,sha256=NrdLEFNo7oeCYSy-kj2nAvCFrz9BZ_xrhkqHFHk5ksY,2496
|
|
@@ -11,41 +11,42 @@ kumoai/databricks.py,sha256=e6E4lOFvZHXFwh4CO1kXU1zzDU3AapLQYMxjiHPC-HQ,476
|
|
|
11
11
|
kumoai/spcs.py,sha256=N31d7rLa-bgYh8e2J4YzX1ScxGLqiVXrqJnCl1y4Mts,4139
|
|
12
12
|
kumoai/_singleton.py,sha256=UTwrbDkoZSGB8ZelorvprPDDv9uZkUi1q_SrmsyngpQ,836
|
|
13
13
|
kumoai/experimental/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
kumoai/experimental/rfm/
|
|
15
|
-
kumoai/experimental/rfm/
|
|
14
|
+
kumoai/experimental/rfm/relbench.py,sha256=cVsxxV3TIL3PLEoYb-8tAVW3GSef6NQAd3rxdHJL63I,2276
|
|
15
|
+
kumoai/experimental/rfm/graph.py,sha256=H9lIQLDkL5zJMwEHh7PgruvMUxWsjpynXUT7gnmTTUM,46351
|
|
16
|
+
kumoai/experimental/rfm/__init__.py,sha256=TAy2TntkZdwB82wURsZasUsQ-yi06LEXT2u2qTNCVxc,6965
|
|
16
17
|
kumoai/experimental/rfm/sagemaker.py,sha256=6fyXO1Jd_scq-DH7kcv6JcV8QPyTbh4ceqwQDPADlZ0,4963
|
|
17
|
-
kumoai/experimental/rfm/rfm.py,sha256=
|
|
18
|
+
kumoai/experimental/rfm/rfm.py,sha256=Qna-oSk5lgzmVC_KPolYo5Y6m81qKpyw9wfrvirT3Oc,49526
|
|
18
19
|
kumoai/experimental/rfm/authenticate.py,sha256=G2RkRWznMVQUzvhvbKhn0bMCY7VmoNYxluz3THRqSdE,18851
|
|
19
20
|
kumoai/experimental/rfm/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
21
|
kumoai/experimental/rfm/backend/sqlite/__init__.py,sha256=jl-DBbhsqQ-dUXyWhyQTM1AU2qNAtXCmi1mokdhtBTg,902
|
|
21
|
-
kumoai/experimental/rfm/backend/sqlite/table.py,sha256=
|
|
22
|
-
kumoai/experimental/rfm/backend/sqlite/sampler.py,sha256=
|
|
22
|
+
kumoai/experimental/rfm/backend/sqlite/table.py,sha256=WqYtd_rwlawItRMXZUfv14qdyU6huQmODuFjDo483dI,6683
|
|
23
|
+
kumoai/experimental/rfm/backend/sqlite/sampler.py,sha256=_D9C5mj3oL4J2qZFap3emvTy2jxzth3dEWZPfr4dmEE,16201
|
|
23
24
|
kumoai/experimental/rfm/backend/local/__init__.py,sha256=2s9sSA-E-8pfkkzCH4XPuaSxSznEURMfMgwEIfYYPsg,1014
|
|
24
|
-
kumoai/experimental/rfm/backend/local/table.py,sha256=
|
|
25
|
-
kumoai/experimental/rfm/backend/local/graph_store.py,sha256=
|
|
26
|
-
kumoai/experimental/rfm/backend/local/sampler.py,sha256=
|
|
25
|
+
kumoai/experimental/rfm/backend/local/table.py,sha256=GKeYGcu52ztCU8EBMqp5UVj85E145Ug41xiCPiTCXq4,3489
|
|
26
|
+
kumoai/experimental/rfm/backend/local/graph_store.py,sha256=RHhkI13KpdPxqb4vXkwEwuFiX5DkrEsfZsOLywNnrvU,11294
|
|
27
|
+
kumoai/experimental/rfm/backend/local/sampler.py,sha256=UKxTjsYs00sYuV_LAlDuZOvQq0BZzPCzZK1Fki2Fd70,10726
|
|
27
28
|
kumoai/experimental/rfm/backend/snow/__init__.py,sha256=BYfsiuJ4Ee30GjG9EuUtitMHXnRfvVKi85zNlIwldV4,993
|
|
28
|
-
kumoai/experimental/rfm/backend/snow/table.py,sha256
|
|
29
|
-
kumoai/experimental/rfm/backend/snow/sampler.py,sha256=
|
|
29
|
+
kumoai/experimental/rfm/backend/snow/table.py,sha256=9N7TOcXX8hhAjCawnhuvQCArBFTCdng3gBakunUxg90,8892
|
|
30
|
+
kumoai/experimental/rfm/backend/snow/sampler.py,sha256=zvPsgVnDfvskcnPWsIcqxw-Fn9DsCLfdoLE-m3bjeww,11483
|
|
30
31
|
kumoai/experimental/rfm/pquery/__init__.py,sha256=X0O3EIq5SMfBEE-ii5Cq6iDhR3s3XMXB52Cx5htoePw,152
|
|
31
32
|
kumoai/experimental/rfm/pquery/pandas_executor.py,sha256=MwSvFRwLq-z19LEdF0G0AT7Gj9tCqu-XLEA7mNbqXwc,18454
|
|
32
33
|
kumoai/experimental/rfm/pquery/executor.py,sha256=gs5AVNaA50ci8zXOBD3qt5szdTReSwTs4BGuEyx4BEE,2728
|
|
33
|
-
kumoai/experimental/rfm/infer/multicategorical.py,sha256=
|
|
34
|
+
kumoai/experimental/rfm/infer/multicategorical.py,sha256=lNO_8aJw1whO6QVEMB3PRWMNlEEiX44g3v4tP88TSQY,1119
|
|
34
35
|
kumoai/experimental/rfm/infer/categorical.py,sha256=VwNaKwKbRYkTxEJ1R6gziffC8dGsEThcDEfbi-KqW5c,853
|
|
35
36
|
kumoai/experimental/rfm/infer/time_col.py,sha256=oNenUK6P7ql8uwShodtQ73uG1x3fbFWT78jRcF9DLTI,1789
|
|
36
37
|
kumoai/experimental/rfm/infer/pkey.py,sha256=IaJI5GHK8ds_a3AOr3YYVgUlSmYYEgr4Nu92s2RyBV4,4412
|
|
37
38
|
kumoai/experimental/rfm/infer/id.py,sha256=ZIO0DWIoiEoS_8MVc5lkqBfkTWWQ0yGCgjkwLdaYa_Q,908
|
|
38
|
-
kumoai/experimental/rfm/infer/dtype.py,sha256=
|
|
39
|
-
kumoai/experimental/rfm/infer/__init__.py,sha256=
|
|
39
|
+
kumoai/experimental/rfm/infer/dtype.py,sha256=FyAqvtrOWQC9hGrhQ7sC4BAI6c9k6ew-fo8ClS1sewM,2782
|
|
40
|
+
kumoai/experimental/rfm/infer/__init__.py,sha256=8GDxQKd0pxZULdk7mpwl3CsOpL4v2HPuPEsbi2t_vzc,519
|
|
40
41
|
kumoai/experimental/rfm/infer/timestamp.py,sha256=vM9--7eStzaGG13Y-oLYlpNJyhL6f9dp17HDXwtl_DM,1094
|
|
41
|
-
kumoai/experimental/rfm/
|
|
42
|
-
kumoai/experimental/rfm/base/
|
|
43
|
-
kumoai/experimental/rfm/base/
|
|
44
|
-
kumoai/experimental/rfm/base/table.py,sha256=
|
|
45
|
-
kumoai/experimental/rfm/base/
|
|
46
|
-
kumoai/experimental/rfm/base/
|
|
47
|
-
kumoai/experimental/rfm/base/source.py,sha256=
|
|
48
|
-
kumoai/experimental/rfm/base/column.py,sha256=
|
|
42
|
+
kumoai/experimental/rfm/infer/stype.py,sha256=fu4zsOB-C7jNeMnq6dsK4bOZSewe7PtZe_AkohSRLoM,894
|
|
43
|
+
kumoai/experimental/rfm/base/sql_sampler.py,sha256=qurkEVlMhDZw3d9SM2uGud6TMv_Wx_iqWoCgEKd_g9o,5094
|
|
44
|
+
kumoai/experimental/rfm/base/__init__.py,sha256=rjmMux5lG8srw1bjQGcFQFv6zET9e5riP81nPkw28Jg,724
|
|
45
|
+
kumoai/experimental/rfm/base/table.py,sha256=JWaSOcVYfGveUHFZpu85CUr4trLt1PJmAtgsz3QC8N8,26534
|
|
46
|
+
kumoai/experimental/rfm/base/sampler.py,sha256=tXYnVEyKC5NjSIpe8pNYp0V3Qbg-KbUE_QB0Emy2YiQ,30882
|
|
47
|
+
kumoai/experimental/rfm/base/expression.py,sha256=Y7NtLTnKlx6euG_N3fLTcrFKheB6P5KS_jhCfoXV9DE,1252
|
|
48
|
+
kumoai/experimental/rfm/base/source.py,sha256=bwu3GU2TvIXR2fwKAmJ1-5BDoNXMnI1SU3Fgdk8lWnc,301
|
|
49
|
+
kumoai/experimental/rfm/base/column.py,sha256=GXzLC-VpShr6PecUzaj1MJKc_PHzfW5Jn9bOYPA8fFA,4965
|
|
49
50
|
kumoai/encoder/__init__.py,sha256=VPGs4miBC_WfwWeOXeHhFomOUocERFavhKf5fqITcds,182
|
|
50
51
|
kumoai/graph/graph.py,sha256=iyp4klPIMn2ttuEqMJvsrxKb_tmz_DTnvziIhCegduM,38291
|
|
51
52
|
kumoai/graph/__init__.py,sha256=n8X4X8luox4hPBHTRC9R-3JzvYYMoR8n7lF1H4w4Hzc,228
|
|
@@ -56,6 +57,7 @@ kumoai/artifact_export/job.py,sha256=GEisSwvcjK_35RgOfsLXGgxMTXIWm765B_BW_Kgs-V0
|
|
|
56
57
|
kumoai/artifact_export/__init__.py,sha256=BsfDrc3mCHpO9-BqvqKm8qrXDIwfdaoH5UIoG4eQkc4,238
|
|
57
58
|
kumoai/utils/datasets.py,sha256=ptKIUoBONVD55pTVNdRCkQT3NWdN_r9UAUu4xewPa3U,2928
|
|
58
59
|
kumoai/utils/__init__.py,sha256=6S-UtwjeLpnCYRCCIEWhkitPYGaqOGXC1ChE13DzXiU,256
|
|
60
|
+
kumoai/utils/display.py,sha256=eXlw4B72y6zEruWYOfwvfqxfMBTL9AsPtWfw3BjaWqQ,1397
|
|
59
61
|
kumoai/utils/progress_logger.py,sha256=3aYOoVSbQv5i9m2T8IqMydofKf6iNB1jxsl1uGjHZz8,9265
|
|
60
62
|
kumoai/utils/sql.py,sha256=f6lR6rBEW7Dtk0NdM26dOZXUHDizEHb1WPlBCJrwoq0,118
|
|
61
63
|
kumoai/utils/forecasting.py,sha256=-nDS6ucKNfQhTQOfebjefj0wwWH3-KYNslIomxwwMBM,7415
|
|
@@ -93,12 +95,12 @@ kumoai/pquery/predictive_query.py,sha256=UXn1s8ztubYZMNGl4ijaeidMiGlFveb1TGw9qI5
|
|
|
93
95
|
kumoai/pquery/prediction_table.py,sha256=QPDH22X1UB0NIufY7qGuV2XW7brG3Pv--FbjNezzM2g,10776
|
|
94
96
|
kumoai/pquery/training_table.py,sha256=elmPDZx11kPiC_dkOhJcBUGtHKgL32GCBvZ9k6U0pMg,15809
|
|
95
97
|
kumoai/client/pquery.py,sha256=IQ8As-OOJOkuMoMosphOsA5hxQYLCbzOQJO7RezK8uY,7091
|
|
96
|
-
kumoai/client/client.py,sha256=
|
|
98
|
+
kumoai/client/client.py,sha256=npTLooBtmZ9xOo7AbEiYQTh9wFktsGSEpSEfdB7vdB4,8715
|
|
97
99
|
kumoai/client/graph.py,sha256=zvLEDExLT_RVbUMHqVl0m6tO6s2gXmYSoWmPF6YMlnA,3831
|
|
98
100
|
kumoai/client/online.py,sha256=pkBBh_DEC3GAnPcNw6bopNRlGe7EUbIFe7_seQqZRaw,2720
|
|
99
101
|
kumoai/client/source_table.py,sha256=VCsCcM7KYcnjGP7HLTb-AOSEGEVsJTWjk8bMg1JdgPU,2101
|
|
100
102
|
kumoai/client/__init__.py,sha256=MkyOuMaHQ2c8GPxjBDQSVFhfRE2d2_6CXQ6rxj4ps4w,64
|
|
101
|
-
kumoai/client/jobs.py,sha256=
|
|
103
|
+
kumoai/client/jobs.py,sha256=z3By5MWvWdJ_wYFyJA34pD4NueOXvXEqrAANWEpp4Pk,18066
|
|
102
104
|
kumoai/client/utils.py,sha256=lz1NubwMDHCwzQRowRXm7mjAoYRd5UjRQIwXdtWAl90,3849
|
|
103
105
|
kumoai/client/connector.py,sha256=x3i2aBTJTEMZvYRcWkY-UfWVOANZjqAso4GBbcshFjw,3920
|
|
104
106
|
kumoai/client/table.py,sha256=cQG-RPm-e91idEgse1IPJDvBmzddIDGDkuyrR1rq4wU,3235
|
|
@@ -110,9 +112,10 @@ kumoai/trainer/job.py,sha256=Wk69nzFhbvuA3nEvtCstI04z5CxkgvQ6tHnGchE0Lkg,44938
|
|
|
110
112
|
kumoai/trainer/baseline_trainer.py,sha256=LlfViNOmswNv4c6zJJLsyv0pC2mM2WKMGYx06ogtEVc,4024
|
|
111
113
|
kumoai/trainer/__init__.py,sha256=zUdFl-f-sBWmm2x8R-rdVzPBeU2FaMzUY5mkcgoTa1k,939
|
|
112
114
|
kumoai/trainer/online_serving.py,sha256=9cddb5paeZaCgbUeceQdAOxysCtV5XP-KcsgFz_XR5w,9566
|
|
115
|
+
kumoai/trainer/distilled_trainer.py,sha256=2pPs5clakNxkLfaak7uqPJOrpTWe1RVVM7ztDSqQZvU,6484
|
|
113
116
|
kumoai/trainer/trainer.py,sha256=hBXO7gwpo3t59zKFTeIkK65B8QRmWCwO33sbDuEAPlY,20133
|
|
114
|
-
kumoai-2.14.0.
|
|
115
|
-
kumoai-2.14.0.
|
|
116
|
-
kumoai-2.14.0.
|
|
117
|
-
kumoai-2.14.0.
|
|
118
|
-
kumoai-2.14.0.
|
|
117
|
+
kumoai-2.14.0.dev202512301731.dist-info/RECORD,,
|
|
118
|
+
kumoai-2.14.0.dev202512301731.dist-info/WHEEL,sha256=V1loQ6TpxABu1APUg0MoTRBOzSKT5xVc3skizX-ovCU,136
|
|
119
|
+
kumoai-2.14.0.dev202512301731.dist-info/top_level.txt,sha256=YjU6UcmomoDx30vEXLsOU784ED7VztQOsFApk1SFwvs,7
|
|
120
|
+
kumoai-2.14.0.dev202512301731.dist-info/METADATA,sha256=XW8jzm0aptnoLAkWA04ZBBd_H9QnrcVQLUO5ZaF_HJk,2557
|
|
121
|
+
kumoai-2.14.0.dev202512301731.dist-info/licenses/LICENSE,sha256=TbWlyqRmhq9PEzCaTI0H0nWLQCCOywQM8wYH8MbjfLo,1102
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
from typing import Any, TypeAlias
|
|
3
|
-
|
|
4
|
-
from kumoapi.typing import Dtype
|
|
5
|
-
|
|
6
|
-
from kumoai.mixin import CastMixin
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@dataclass(frozen=True)
|
|
10
|
-
class ColumnExpressionSpec(CastMixin):
|
|
11
|
-
name: str
|
|
12
|
-
expr: str
|
|
13
|
-
dtype: Dtype | None = None
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
ColumnExpressionType: TypeAlias = ColumnExpressionSpec | dict[str, Any]
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
from abc import abstractmethod
|
|
2
|
-
from collections import defaultdict
|
|
3
|
-
from collections.abc import Sequence
|
|
4
|
-
from functools import cached_property
|
|
5
|
-
from typing import Any
|
|
6
|
-
|
|
7
|
-
from kumoapi.model_plan import MissingType
|
|
8
|
-
|
|
9
|
-
from kumoai.experimental.rfm.base import (
|
|
10
|
-
ColumnExpressionType,
|
|
11
|
-
SourceForeignKey,
|
|
12
|
-
Table,
|
|
13
|
-
)
|
|
14
|
-
from kumoai.utils import quote_ident
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class SQLTable(Table):
|
|
18
|
-
r"""A :class:`SQLTable` specifies a :class:`Table` backed by a SQL
|
|
19
|
-
database.
|
|
20
|
-
|
|
21
|
-
Args:
|
|
22
|
-
name: The logical name of this table.
|
|
23
|
-
source_name: The physical name of this table in the database. If set to
|
|
24
|
-
``None``, ``name`` is being used.
|
|
25
|
-
columns: The selected physical columns of this table.
|
|
26
|
-
column_expressions: The logical columns of this table.
|
|
27
|
-
primary_key: The name of the primary key of this table, if it exists.
|
|
28
|
-
time_column: The name of the time column of this table, if it exists.
|
|
29
|
-
end_time_column: The name of the end time column of this table, if it
|
|
30
|
-
exists.
|
|
31
|
-
"""
|
|
32
|
-
def __init__(
|
|
33
|
-
self,
|
|
34
|
-
name: str,
|
|
35
|
-
source_name: str | None = None,
|
|
36
|
-
columns: Sequence[str] | None = None,
|
|
37
|
-
column_expressions: Sequence[ColumnExpressionType] | None = None,
|
|
38
|
-
primary_key: MissingType | str | None = MissingType.VALUE,
|
|
39
|
-
time_column: str | None = None,
|
|
40
|
-
end_time_column: str | None = None,
|
|
41
|
-
) -> None:
|
|
42
|
-
|
|
43
|
-
self._connection: Any
|
|
44
|
-
self._source_name = source_name or name
|
|
45
|
-
|
|
46
|
-
super().__init__(
|
|
47
|
-
name=name,
|
|
48
|
-
columns=[],
|
|
49
|
-
primary_key=None,
|
|
50
|
-
time_column=None,
|
|
51
|
-
end_time_column=None,
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
if isinstance(primary_key, MissingType):
|
|
55
|
-
primary_key = self._source_primary_key
|
|
56
|
-
|
|
57
|
-
# Add column expressions with highest priority:
|
|
58
|
-
self._add_column_expressions(column_expressions or [])
|
|
59
|
-
|
|
60
|
-
if columns is None:
|
|
61
|
-
for column_name in self._source_column_dict.keys():
|
|
62
|
-
if column_name not in self:
|
|
63
|
-
self.add_column(column_name)
|
|
64
|
-
else:
|
|
65
|
-
for column_name in columns:
|
|
66
|
-
self.add_column(column_name)
|
|
67
|
-
|
|
68
|
-
if primary_key is not None:
|
|
69
|
-
if primary_key not in self:
|
|
70
|
-
self.add_column(primary_key)
|
|
71
|
-
self.primary_key = primary_key
|
|
72
|
-
|
|
73
|
-
if time_column is not None:
|
|
74
|
-
if time_column not in self:
|
|
75
|
-
self.add_column(time_column)
|
|
76
|
-
self.time_column = time_column
|
|
77
|
-
|
|
78
|
-
if end_time_column is not None:
|
|
79
|
-
if end_time_column not in self:
|
|
80
|
-
self.add_column(end_time_column)
|
|
81
|
-
self.end_time_column = end_time_column
|
|
82
|
-
|
|
83
|
-
@property
|
|
84
|
-
def fqn(self) -> str:
|
|
85
|
-
r"""The fully-qualified quoted source table name."""
|
|
86
|
-
return quote_ident(self._source_name)
|
|
87
|
-
|
|
88
|
-
# Column ##################################################################
|
|
89
|
-
|
|
90
|
-
def _add_column_expressions(
|
|
91
|
-
self,
|
|
92
|
-
columns: Sequence[ColumnExpressionType],
|
|
93
|
-
) -> None:
|
|
94
|
-
pass
|
|
95
|
-
|
|
96
|
-
# Abstract Methods ########################################################
|
|
97
|
-
|
|
98
|
-
@cached_property
|
|
99
|
-
def _source_foreign_key_dict(self) -> dict[str, SourceForeignKey]:
|
|
100
|
-
fkeys = self._get_source_foreign_keys()
|
|
101
|
-
# NOTE Drop all keys that link to multiple keys in the same table since
|
|
102
|
-
# we don't support composite keys yet:
|
|
103
|
-
table_pkeys: dict[str, set[str]] = defaultdict(set)
|
|
104
|
-
for fkey in fkeys:
|
|
105
|
-
table_pkeys[fkey.dst_table].add(fkey.primary_key)
|
|
106
|
-
return {
|
|
107
|
-
fkey.name: fkey
|
|
108
|
-
for fkey in fkeys if len(table_pkeys[fkey.dst_table]) == 1
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
@abstractmethod
|
|
112
|
-
def _get_source_foreign_keys(self) -> list[SourceForeignKey]:
|
|
113
|
-
pass
|
|
File without changes
|
{kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202512301731.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202512301731.dist-info}/top_level.txt
RENAMED
|
File without changes
|