featrixsphere 0.2.1221__py3-none-any.whl → 0.2.1230__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 CHANGED
@@ -38,7 +38,7 @@ Example:
38
38
  ... labels=['Experiment A', 'Experiment B'])
39
39
  """
40
40
 
41
- __version__ = "0.2.1221"
41
+ __version__ = "0.2.1230"
42
42
  __author__ = "Featrix"
43
43
  __email__ = "support@featrix.com"
44
44
  __license__ = "MIT"
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
- # Clean up input_filename: extract just the filename if it's an absolute path
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
- # Extract just the filename - client should upload file first
4171
- cleaned_filename = input_path.name
4172
- print(f"⚠️ Note: Extracted filename '{cleaned_filename}' from absolute path '{input_filename}'")
4173
- print(f" Make sure the file has been uploaded to the server first")
4174
- data["input_filename"] = cleaned_filename
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: featrixsphere
3
- Version: 0.2.1221
3
+ Version: 0.2.1230
4
4
  Summary: Transform any CSV into a production-ready ML model in minutes, not months.
5
5
  Home-page: https://github.com/Featrix/sphere
6
6
  Author: Featrix
@@ -0,0 +1,9 @@
1
+ featrixsphere/__init__.py,sha256=tnkQwrMlNHh8-4w9WYVZYPiQww0g-5xlzvUEH_Cm1qE,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.1230.dist-info/METADATA,sha256=lBjYeP-nnr3rNJ7DnoArU7W853OAL_L1N2PXvVBAIDI,16232
6
+ featrixsphere-0.2.1230.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ featrixsphere-0.2.1230.dist-info/entry_points.txt,sha256=QreJeYfD_VWvbEqPmMXZ3pqqlFlJ1qZb-NtqnyhEldc,51
8
+ featrixsphere-0.2.1230.dist-info/top_level.txt,sha256=AyN4wjfzlD0hWnDieuEHX0KckphIk_aC73XCG4df5uU,14
9
+ featrixsphere-0.2.1230.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,,