featrixsphere 0.2.1221__py3-none-any.whl → 0.2.1229__py3-none-any.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.
- featrixsphere/__init__.py +1 -1
- featrixsphere/client.py +61 -7
- {featrixsphere-0.2.1221.dist-info → featrixsphere-0.2.1229.dist-info}/METADATA +1 -1
- featrixsphere-0.2.1229.dist-info/RECORD +9 -0
- featrixsphere-0.2.1221.dist-info/RECORD +0 -9
- {featrixsphere-0.2.1221.dist-info → featrixsphere-0.2.1229.dist-info}/WHEEL +0 -0
- {featrixsphere-0.2.1221.dist-info → featrixsphere-0.2.1229.dist-info}/entry_points.txt +0 -0
- {featrixsphere-0.2.1221.dist-info → featrixsphere-0.2.1229.dist-info}/top_level.txt +0 -0
featrixsphere/__init__.py
CHANGED
featrixsphere/client.py
CHANGED
|
@@ -4111,6 +4111,7 @@ class FeatrixSphereClient:
|
|
|
4111
4111
|
|
|
4112
4112
|
def train_on_foundational_model(self, foundation_model_id: str, target_column: str, target_column_type: str,
|
|
4113
4113
|
input_filename: str = None,
|
|
4114
|
+
df = None,
|
|
4114
4115
|
name: str = None,
|
|
4115
4116
|
session_name_prefix: str = None,
|
|
4116
4117
|
epochs: int = 0, batch_size: int = 0, learning_rate: float = 0.001,
|
|
@@ -4132,6 +4133,8 @@ class FeatrixSphereClient:
|
|
|
4132
4133
|
target_column: Name of the target column to predict
|
|
4133
4134
|
target_column_type: Type of target column ("set" or "scalar")
|
|
4134
4135
|
input_filename: Optional input data file (uses foundation model's data if not provided)
|
|
4136
|
+
df: Optional pandas DataFrame with training data (uses foundation model's data if not provided).
|
|
4137
|
+
Use input_filename OR df (not both) to train predictor on different data than the foundation model.
|
|
4135
4138
|
name: Optional name for the new session
|
|
4136
4139
|
session_name_prefix: Optional prefix for session ID. Session will be named <prefix>-<uuid>
|
|
4137
4140
|
epochs: Number of training epochs (default: 0; automatic)
|
|
@@ -4151,6 +4154,48 @@ class FeatrixSphereClient:
|
|
|
4151
4154
|
print(f"Training predictor on foundation model {foundation_model_id}...")
|
|
4152
4155
|
print(f" Target: {target_column} ({target_column_type})")
|
|
4153
4156
|
|
|
4157
|
+
# Validate that only one data source is provided
|
|
4158
|
+
if input_filename and df is not None:
|
|
4159
|
+
raise ValueError("Provide either input_filename or df, not both")
|
|
4160
|
+
|
|
4161
|
+
# If DataFrame provided, save to temp file and upload it
|
|
4162
|
+
temp_file = None
|
|
4163
|
+
if df is not None:
|
|
4164
|
+
import pandas as pd
|
|
4165
|
+
import tempfile
|
|
4166
|
+
import os
|
|
4167
|
+
|
|
4168
|
+
if not isinstance(df, pd.DataFrame):
|
|
4169
|
+
raise ValueError("df must be a pandas DataFrame")
|
|
4170
|
+
|
|
4171
|
+
if verbose:
|
|
4172
|
+
print(f"📊 Using provided DataFrame ({len(df)} rows, {len(df.columns)} columns)")
|
|
4173
|
+
|
|
4174
|
+
# Create temporary CSV file
|
|
4175
|
+
temp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.csv', delete=False)
|
|
4176
|
+
temp_file_path = temp_file.name
|
|
4177
|
+
temp_file.close()
|
|
4178
|
+
|
|
4179
|
+
# Save DataFrame to temp file
|
|
4180
|
+
df.to_csv(temp_file_path, index=False)
|
|
4181
|
+
|
|
4182
|
+
if verbose:
|
|
4183
|
+
print(f"📁 Saved to temporary file: {os.path.basename(temp_file_path)}")
|
|
4184
|
+
print(f"📤 Uploading file to server...")
|
|
4185
|
+
|
|
4186
|
+
# Upload the file
|
|
4187
|
+
uploaded_filename = self.upload_file(temp_file_path)
|
|
4188
|
+
input_filename = uploaded_filename
|
|
4189
|
+
|
|
4190
|
+
if verbose:
|
|
4191
|
+
print(f"✅ File uploaded: {input_filename}")
|
|
4192
|
+
|
|
4193
|
+
# Clean up temp file
|
|
4194
|
+
try:
|
|
4195
|
+
os.unlink(temp_file_path)
|
|
4196
|
+
except Exception:
|
|
4197
|
+
pass # Ignore cleanup errors
|
|
4198
|
+
|
|
4154
4199
|
data = {
|
|
4155
4200
|
"foundation_model_id": foundation_model_id,
|
|
4156
4201
|
"target_column": target_column,
|
|
@@ -4162,17 +4207,26 @@ class FeatrixSphereClient:
|
|
|
4162
4207
|
}
|
|
4163
4208
|
|
|
4164
4209
|
if input_filename:
|
|
4165
|
-
#
|
|
4166
|
-
# The file should be uploaded first or already exist on the server
|
|
4210
|
+
# If absolute path provided, upload the file first
|
|
4167
4211
|
from pathlib import Path
|
|
4168
4212
|
input_path = Path(input_filename)
|
|
4169
4213
|
if input_path.is_absolute():
|
|
4170
|
-
#
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4214
|
+
# Upload the file first, then use the uploaded filename
|
|
4215
|
+
if not input_path.exists():
|
|
4216
|
+
raise FileNotFoundError(f"Input file not found: {input_filename}")
|
|
4217
|
+
|
|
4218
|
+
if verbose:
|
|
4219
|
+
print(f"📤 Uploading file from absolute path: {input_filename}")
|
|
4220
|
+
|
|
4221
|
+
# Upload the file
|
|
4222
|
+
uploaded_filename = self.upload_file(str(input_path))
|
|
4223
|
+
|
|
4224
|
+
if verbose:
|
|
4225
|
+
print(f"✅ File uploaded as: {uploaded_filename}")
|
|
4226
|
+
|
|
4227
|
+
data["input_filename"] = uploaded_filename
|
|
4175
4228
|
else:
|
|
4229
|
+
# Relative filename - assume it's already on the server
|
|
4176
4230
|
data["input_filename"] = input_filename
|
|
4177
4231
|
if name:
|
|
4178
4232
|
data["name"] = name
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
featrixsphere/__init__.py,sha256=DEdcEduSBsw68Ph6BuxpHiBXauP0gGVZUk4w5krgwU4,1888
|
|
2
|
+
featrixsphere/cli.py,sha256=AW9O3vCvCNJ2UxVGN66eRmeN7XLSiHJlvK6JLZ9UJXc,13358
|
|
3
|
+
featrixsphere/client.py,sha256=y5x_zTSryHMy-R7pleySQnkpdoztcSxq8D2cdtwNLpM,381173
|
|
4
|
+
featrixsphere/test_client.py,sha256=4SiRbib0ms3poK0UpnUv4G0HFQSzidF3Iswo_J2cjLk,11981
|
|
5
|
+
featrixsphere-0.2.1229.dist-info/METADATA,sha256=Y5AwjOmojP46zRuFAx9VRYksJcMaZ08lSHTqHloVZPk,16232
|
|
6
|
+
featrixsphere-0.2.1229.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
featrixsphere-0.2.1229.dist-info/entry_points.txt,sha256=QreJeYfD_VWvbEqPmMXZ3pqqlFlJ1qZb-NtqnyhEldc,51
|
|
8
|
+
featrixsphere-0.2.1229.dist-info/top_level.txt,sha256=AyN4wjfzlD0hWnDieuEHX0KckphIk_aC73XCG4df5uU,14
|
|
9
|
+
featrixsphere-0.2.1229.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
featrixsphere/__init__.py,sha256=P6lNvrcNRFDLvHiBlcFeM-UTp0SymQm5msQQHX6W8XU,1888
|
|
2
|
-
featrixsphere/cli.py,sha256=AW9O3vCvCNJ2UxVGN66eRmeN7XLSiHJlvK6JLZ9UJXc,13358
|
|
3
|
-
featrixsphere/client.py,sha256=lwPu6RQVA5zps9DTYrVlPhRv8_8PEdFGI11hezLSEyA,379068
|
|
4
|
-
featrixsphere/test_client.py,sha256=4SiRbib0ms3poK0UpnUv4G0HFQSzidF3Iswo_J2cjLk,11981
|
|
5
|
-
featrixsphere-0.2.1221.dist-info/METADATA,sha256=k8SrUaI9oa3JaTObnLVQGMA-iyoZM7wLdWnzluqh-Ms,16232
|
|
6
|
-
featrixsphere-0.2.1221.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
featrixsphere-0.2.1221.dist-info/entry_points.txt,sha256=QreJeYfD_VWvbEqPmMXZ3pqqlFlJ1qZb-NtqnyhEldc,51
|
|
8
|
-
featrixsphere-0.2.1221.dist-info/top_level.txt,sha256=AyN4wjfzlD0hWnDieuEHX0KckphIk_aC73XCG4df5uU,14
|
|
9
|
-
featrixsphere-0.2.1221.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|