datfid 0.1.18__tar.gz → 0.1.19__tar.gz
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.
Potentially problematic release.
This version of datfid might be problematic. Click here for more details.
- {datfid-0.1.18 → datfid-0.1.19}/PKG-INFO +1 -1
- {datfid-0.1.18 → datfid-0.1.19}/datfid/client.py +36 -6
- {datfid-0.1.18 → datfid-0.1.19}/datfid.egg-info/PKG-INFO +1 -1
- {datfid-0.1.18 → datfid-0.1.19}/setup.py +1 -1
- {datfid-0.1.18 → datfid-0.1.19}/LICENSE +0 -0
- {datfid-0.1.18 → datfid-0.1.19}/README.md +0 -0
- {datfid-0.1.18 → datfid-0.1.19}/datfid/__init__.py +0 -0
- {datfid-0.1.18 → datfid-0.1.19}/datfid.egg-info/SOURCES.txt +0 -0
- {datfid-0.1.18 → datfid-0.1.19}/datfid.egg-info/dependency_links.txt +0 -0
- {datfid-0.1.18 → datfid-0.1.19}/datfid.egg-info/requires.txt +0 -0
- {datfid-0.1.18 → datfid-0.1.19}/datfid.egg-info/top_level.txt +0 -0
- {datfid-0.1.18 → datfid-0.1.19}/setup.cfg +0 -0
|
@@ -16,8 +16,24 @@ class FitResult(SimpleNamespace):
|
|
|
16
16
|
|
|
17
17
|
@property
|
|
18
18
|
def id(self):
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
import pandas as pd
|
|
20
|
+
if hasattr(self, "df") and isinstance(self.df, pd.DataFrame) and "ID" in self.df.columns:
|
|
21
|
+
return pd.DataFrame(self.df["ID"].astype(str).unique())
|
|
22
|
+
return pd.DataFrame([])
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def ID(self):
|
|
26
|
+
import pandas as pd
|
|
27
|
+
if hasattr(self, "df") and isinstance(self.df, pd.DataFrame) and "ID" in self.df.columns:
|
|
28
|
+
return pd.DataFrame(self.df["ID"].astype(str).unique())
|
|
29
|
+
return pd.DataFrame([])
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def Id(self):
|
|
33
|
+
import pandas as pd
|
|
34
|
+
if hasattr(self, "df") and isinstance(self.df, pd.DataFrame) and "ID" in self.df.columns:
|
|
35
|
+
return pd.DataFrame(self.df["ID"].astype(str).unique())
|
|
36
|
+
return pd.DataFrame([])
|
|
21
37
|
|
|
22
38
|
@staticmethod
|
|
23
39
|
def _df4(rows_list):
|
|
@@ -43,6 +59,20 @@ class FitResult(SimpleNamespace):
|
|
|
43
59
|
kwargs["df"] = pd.DataFrame(kwargs["df"])
|
|
44
60
|
super().__init__(**kwargs)
|
|
45
61
|
|
|
62
|
+
class FitResultDict(dict):
|
|
63
|
+
@property
|
|
64
|
+
def id(self):
|
|
65
|
+
return pd.DataFrame({"ID": list(self.keys())})
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def ID(self):
|
|
69
|
+
return pd.DataFrame({"ID": list(self.keys())})
|
|
70
|
+
|
|
71
|
+
@property
|
|
72
|
+
def Id(self):
|
|
73
|
+
return pd.DataFrame({"ID": list(self.keys())})
|
|
74
|
+
|
|
75
|
+
|
|
46
76
|
class DATFIDClient:
|
|
47
77
|
def __init__(self, token: str):
|
|
48
78
|
self.api_url = "https://datfid-org-datfid-sdk.hf.space/"
|
|
@@ -190,7 +220,7 @@ class DATFIDClient:
|
|
|
190
220
|
current_features: Optional[list] = None,
|
|
191
221
|
filter_by_significance: bool = False,
|
|
192
222
|
meanvar_test: bool = False
|
|
193
|
-
) ->
|
|
223
|
+
) -> FitResultDict:
|
|
194
224
|
"""
|
|
195
225
|
Fit a model individual by individual using the DATFID API.
|
|
196
226
|
|
|
@@ -234,10 +264,10 @@ class DATFIDClient:
|
|
|
234
264
|
if response.status_code != 200:
|
|
235
265
|
raise Exception(f"Model fit failed: {response.text}")
|
|
236
266
|
|
|
237
|
-
raw = response.json()
|
|
267
|
+
raw = response.json()
|
|
238
268
|
# Wrap each per-id result into a SimpleNamespace for dot access:
|
|
239
|
-
result_per_id = {str(k): FitResult(**v) for k, v in raw.items()}
|
|
240
|
-
return result_per_id #
|
|
269
|
+
result_per_id = FitResultDict({str(k): FitResult(**v) for k, v in raw.items()})
|
|
270
|
+
return result_per_id # FitResultDict[str, SimpleNamespace]
|
|
241
271
|
|
|
242
272
|
def forecast_model_ind(
|
|
243
273
|
self,
|
|
@@ -17,7 +17,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
17
17
|
|
|
18
18
|
setup(
|
|
19
19
|
name="datfid",
|
|
20
|
-
version="0.1.
|
|
20
|
+
version="0.1.19",
|
|
21
21
|
description="SDK to access the DATFID API hosted on Hugging Face Spaces",
|
|
22
22
|
long_description=long_description,
|
|
23
23
|
long_description_content_type="text/markdown", # Important!
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|