outdatedLabs 0.1.0__tar.gz → 0.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: outdatedLabs
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A secure package for training machine learning models
5
5
  Home-page: https://github.com/Mouli51ch/OutDated
6
6
  Author: OutDated Team
@@ -30,9 +30,9 @@ Dynamic: requires-dist
30
30
  Dynamic: requires-python
31
31
  Dynamic: summary
32
32
 
33
- # OutDatedLabs - Secure Machine Learning Training Package
33
+ # OutdatedLabs - Secure Machine Learning Training Package
34
34
 
35
- A Python package for secure machine learning model training using the ML training server.
35
+ A secure and easy-to-use package for training machine learning models with remote server support.
36
36
 
37
37
  ## Installation
38
38
 
@@ -42,73 +42,59 @@ pip install outdatedLabs
42
42
 
43
43
  ## Quick Start
44
44
 
45
+ Use the package in your code:
45
46
  ```python
46
47
  from outdatedLabs import SecureModel
47
48
 
48
49
  # Create a linear regression model
49
50
  model = SecureModel.linearRegression()
50
51
 
51
- # Optionally set a custom server URL
52
- model.set_server_url("http://your-server:8000")
53
-
54
52
  # Train the model
55
- model.fit(
53
+ model.train(
56
54
  dataset_hash="your_dataset_hash",
57
55
  features=["feature1", "feature2"],
58
56
  target="target_column"
59
57
  )
60
58
 
61
- # Make predictions
62
- predictions = model.predict(X)
63
-
64
59
  # Get training metrics
65
60
  metrics = model.get_metrics()
66
61
  print(metrics)
62
+
63
+ # Download and load the trained model
64
+ model.download_model()
65
+ loaded_model = model.load_model()
67
66
  ```
68
67
 
69
68
  ## Features
70
69
 
71
- - Secure model training using encrypted datasets
72
- - Support for linear regression models
70
+ - Secure model training with remote server support
71
+ - Automatic dataset download and cleanup
73
72
  - Progress tracking with tqdm
74
- - Comprehensive error handling and logging
75
- - Easy-to-use interface
76
- - Configurable server URL
73
+ - Comprehensive error handling
74
+ - Detailed logging
75
+ - Support for multiple algorithms (currently Linear Regression)
76
+
77
+ ## Configuration
78
+
79
+ The package connects to a local ML training server by default at `http://localhost:3000`. You can change the server URL when creating a model:
80
+
81
+ ```python
82
+ model = SecureModel.linearRegression(server_url="http://your-server:3000")
83
+ ```
77
84
 
78
85
  ## API Reference
79
86
 
80
87
  ### SecureModel
81
88
 
82
- The main class for secure model training.
89
+ The main class for model training and management.
83
90
 
84
91
  #### Methods
85
92
 
86
- - `linearRegression(server_url: str = "http://localhost:8000") -> SecureModel`
87
- - Create a new linear regression model instance
88
-
89
- - `set_server_url(server_url: str) -> SecureModel`
90
- - Set a custom URL for the ML training server
91
-
92
- - `fit(dataset_hash: str, features: List[str] = None, target: str = None, params: Dict[str, Any] = None) -> SecureModel`
93
- - Train the model using the specified dataset
94
-
95
- - `predict(X: Union[pd.DataFrame, List[List[float]]]) -> List[float]`
96
- - Make predictions using the trained model
97
-
98
- - `score(X: Union[pd.DataFrame, List[List[float]]], y: List[float]) -> Dict[str, float]`
99
- - Calculate model performance metrics
100
-
101
- - `get_metrics() -> Dict[str, Any]`
102
- - Get training metrics
103
-
104
- ## Requirements
105
-
106
- - Python 3.7+
107
- - requests
108
- - joblib
109
- - pandas
110
- - scikit-learn
111
- - tqdm
93
+ - `linearRegression(server_url: str = "http://localhost:3000")`: Create a Linear Regression model
94
+ - `train(dataset_hash: str, features: List[str], target: str)`: Train the model
95
+ - `get_metrics() -> Dict`: Get training metrics
96
+ - `download_model() -> str`: Download the trained model
97
+ - `load_model() -> Any`: Load the trained model
112
98
 
113
99
  ## License
114
100
 
@@ -0,0 +1,69 @@
1
+ # OutdatedLabs - Secure Machine Learning Training Package
2
+
3
+ A secure and easy-to-use package for training machine learning models with remote server support.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install outdatedLabs
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ Use the package in your code:
14
+ ```python
15
+ from outdatedLabs import SecureModel
16
+
17
+ # Create a linear regression model
18
+ model = SecureModel.linearRegression()
19
+
20
+ # Train the model
21
+ model.train(
22
+ dataset_hash="your_dataset_hash",
23
+ features=["feature1", "feature2"],
24
+ target="target_column"
25
+ )
26
+
27
+ # Get training metrics
28
+ metrics = model.get_metrics()
29
+ print(metrics)
30
+
31
+ # Download and load the trained model
32
+ model.download_model()
33
+ loaded_model = model.load_model()
34
+ ```
35
+
36
+ ## Features
37
+
38
+ - Secure model training with remote server support
39
+ - Automatic dataset download and cleanup
40
+ - Progress tracking with tqdm
41
+ - Comprehensive error handling
42
+ - Detailed logging
43
+ - Support for multiple algorithms (currently Linear Regression)
44
+
45
+ ## Configuration
46
+
47
+ The package connects to a local ML training server by default at `http://localhost:3000`. You can change the server URL when creating a model:
48
+
49
+ ```python
50
+ model = SecureModel.linearRegression(server_url="http://your-server:3000")
51
+ ```
52
+
53
+ ## API Reference
54
+
55
+ ### SecureModel
56
+
57
+ The main class for model training and management.
58
+
59
+ #### Methods
60
+
61
+ - `linearRegression(server_url: str = "http://localhost:3000")`: Create a Linear Regression model
62
+ - `train(dataset_hash: str, features: List[str], target: str)`: Train the model
63
+ - `get_metrics() -> Dict`: Get training metrics
64
+ - `download_model() -> str`: Download the trained model
65
+ - `load_model() -> Any`: Load the trained model
66
+
67
+ ## License
68
+
69
+ MIT License
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="outdatedLabs",
5
- version="0.1.0",
5
+ version="0.1.2",
6
6
  packages=find_packages(where="src"),
7
7
  package_dir={"": "src"},
8
8
  install_requires=[
@@ -23,7 +23,7 @@ logger = logging.getLogger(__name__)
23
23
  class SecureModel:
24
24
  """Secure Model Training Class"""
25
25
 
26
- def __init__(self, server_url: str = "http://localhost:8000"):
26
+ def __init__(self, server_url: str = "http://localhost:3000"):
27
27
  """
28
28
  Initialize the SecureModel.
29
29
 
@@ -35,6 +35,18 @@ class SecureModel:
35
35
  self.model = None
36
36
  self.metrics = None
37
37
 
38
+ # Test server connection
39
+ try:
40
+ response = requests.get(f"{self.server_url}/health")
41
+ response.raise_for_status()
42
+ logger.info(f"Successfully connected to server at {self.server_url}")
43
+ except requests.exceptions.ConnectionError:
44
+ logger.error(f"Could not connect to server at {self.server_url}. Please ensure the server is running.")
45
+ raise
46
+ except requests.exceptions.RequestException as e:
47
+ logger.error(f"Error connecting to server: {str(e)}")
48
+ raise
49
+
38
50
  def set_server_url(self, server_url: str) -> 'SecureModel':
39
51
  """
40
52
  Set the training server URL.
@@ -47,10 +59,23 @@ class SecureModel:
47
59
  """
48
60
  self.server_url = server_url.rstrip('/')
49
61
  logger.info(f"Server URL set to: {self.server_url}")
62
+
63
+ # Test new server connection
64
+ try:
65
+ response = requests.get(f"{self.server_url}/health")
66
+ response.raise_for_status()
67
+ logger.info(f"Successfully connected to new server at {self.server_url}")
68
+ except requests.exceptions.ConnectionError:
69
+ logger.error(f"Could not connect to server at {self.server_url}. Please ensure the server is running.")
70
+ raise
71
+ except requests.exceptions.RequestException as e:
72
+ logger.error(f"Error connecting to server: {str(e)}")
73
+ raise
74
+
50
75
  return self
51
76
 
52
77
  @classmethod
53
- def linearRegression(cls, server_url: str = "http://localhost:8000") -> 'SecureModel':
78
+ def linearRegression(cls, server_url: str = "http://localhost:3000") -> 'SecureModel':
54
79
  """
55
80
  Create a Linear Regression model.
56
81
 
@@ -124,20 +149,29 @@ class SecureModel:
124
149
  """Wait for the training job to complete."""
125
150
  with tqdm(desc="Training", unit="s") as pbar:
126
151
  while True:
127
- response = requests.get(f"{self.server_url}/train/{self.job_id}/status")
128
- response.raise_for_status()
129
- status = response.json()
130
-
131
- if status["status"] == "COMPLETE":
132
- logger.info("Training completed successfully")
133
- self.metrics = requests.get(f"{self.server_url}/train/{self.job_id}/metrics").json()
134
- break
135
- elif status["status"] == "FAILED":
136
- error = status.get("error", "Unknown error")
137
- raise Exception(f"Training failed: {error}")
138
-
139
- time.sleep(check_interval)
140
- pbar.update(check_interval)
152
+ try:
153
+ response = requests.get(f"{self.server_url}/train/{self.job_id}/status")
154
+ response.raise_for_status()
155
+ status = response.json()
156
+
157
+ # Convert status to uppercase for case-insensitive comparison
158
+ current_status = status["status"].upper()
159
+
160
+ if current_status == "COMPLETE":
161
+ logger.info("Training completed successfully")
162
+ self.metrics = requests.get(f"{self.server_url}/train/{self.job_id}/metrics").json()
163
+ pbar.close()
164
+ return
165
+ elif current_status == "FAILED":
166
+ error = status.get("error", "Unknown error")
167
+ pbar.close()
168
+ raise Exception(f"Training failed: {error}")
169
+
170
+ time.sleep(check_interval)
171
+ pbar.update(check_interval)
172
+ except Exception as e:
173
+ pbar.close()
174
+ raise Exception(f"Error checking training status: {str(e)}")
141
175
 
142
176
  def _download_model(self) -> None:
143
177
  """Download the trained model."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: outdatedLabs
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A secure package for training machine learning models
5
5
  Home-page: https://github.com/Mouli51ch/OutDated
6
6
  Author: OutDated Team
@@ -30,9 +30,9 @@ Dynamic: requires-dist
30
30
  Dynamic: requires-python
31
31
  Dynamic: summary
32
32
 
33
- # OutDatedLabs - Secure Machine Learning Training Package
33
+ # OutdatedLabs - Secure Machine Learning Training Package
34
34
 
35
- A Python package for secure machine learning model training using the ML training server.
35
+ A secure and easy-to-use package for training machine learning models with remote server support.
36
36
 
37
37
  ## Installation
38
38
 
@@ -42,73 +42,59 @@ pip install outdatedLabs
42
42
 
43
43
  ## Quick Start
44
44
 
45
+ Use the package in your code:
45
46
  ```python
46
47
  from outdatedLabs import SecureModel
47
48
 
48
49
  # Create a linear regression model
49
50
  model = SecureModel.linearRegression()
50
51
 
51
- # Optionally set a custom server URL
52
- model.set_server_url("http://your-server:8000")
53
-
54
52
  # Train the model
55
- model.fit(
53
+ model.train(
56
54
  dataset_hash="your_dataset_hash",
57
55
  features=["feature1", "feature2"],
58
56
  target="target_column"
59
57
  )
60
58
 
61
- # Make predictions
62
- predictions = model.predict(X)
63
-
64
59
  # Get training metrics
65
60
  metrics = model.get_metrics()
66
61
  print(metrics)
62
+
63
+ # Download and load the trained model
64
+ model.download_model()
65
+ loaded_model = model.load_model()
67
66
  ```
68
67
 
69
68
  ## Features
70
69
 
71
- - Secure model training using encrypted datasets
72
- - Support for linear regression models
70
+ - Secure model training with remote server support
71
+ - Automatic dataset download and cleanup
73
72
  - Progress tracking with tqdm
74
- - Comprehensive error handling and logging
75
- - Easy-to-use interface
76
- - Configurable server URL
73
+ - Comprehensive error handling
74
+ - Detailed logging
75
+ - Support for multiple algorithms (currently Linear Regression)
76
+
77
+ ## Configuration
78
+
79
+ The package connects to a local ML training server by default at `http://localhost:3000`. You can change the server URL when creating a model:
80
+
81
+ ```python
82
+ model = SecureModel.linearRegression(server_url="http://your-server:3000")
83
+ ```
77
84
 
78
85
  ## API Reference
79
86
 
80
87
  ### SecureModel
81
88
 
82
- The main class for secure model training.
89
+ The main class for model training and management.
83
90
 
84
91
  #### Methods
85
92
 
86
- - `linearRegression(server_url: str = "http://localhost:8000") -> SecureModel`
87
- - Create a new linear regression model instance
88
-
89
- - `set_server_url(server_url: str) -> SecureModel`
90
- - Set a custom URL for the ML training server
91
-
92
- - `fit(dataset_hash: str, features: List[str] = None, target: str = None, params: Dict[str, Any] = None) -> SecureModel`
93
- - Train the model using the specified dataset
94
-
95
- - `predict(X: Union[pd.DataFrame, List[List[float]]]) -> List[float]`
96
- - Make predictions using the trained model
97
-
98
- - `score(X: Union[pd.DataFrame, List[List[float]]], y: List[float]) -> Dict[str, float]`
99
- - Calculate model performance metrics
100
-
101
- - `get_metrics() -> Dict[str, Any]`
102
- - Get training metrics
103
-
104
- ## Requirements
105
-
106
- - Python 3.7+
107
- - requests
108
- - joblib
109
- - pandas
110
- - scikit-learn
111
- - tqdm
93
+ - `linearRegression(server_url: str = "http://localhost:3000")`: Create a Linear Regression model
94
+ - `train(dataset_hash: str, features: List[str], target: str)`: Train the model
95
+ - `get_metrics() -> Dict`: Get training metrics
96
+ - `download_model() -> str`: Download the trained model
97
+ - `load_model() -> Any`: Load the trained model
112
98
 
113
99
  ## License
114
100
 
@@ -1,83 +0,0 @@
1
- # OutDatedLabs - Secure Machine Learning Training Package
2
-
3
- A Python package for secure machine learning model training using the ML training server.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- pip install outdatedLabs
9
- ```
10
-
11
- ## Quick Start
12
-
13
- ```python
14
- from outdatedLabs import SecureModel
15
-
16
- # Create a linear regression model
17
- model = SecureModel.linearRegression()
18
-
19
- # Optionally set a custom server URL
20
- model.set_server_url("http://your-server:8000")
21
-
22
- # Train the model
23
- model.fit(
24
- dataset_hash="your_dataset_hash",
25
- features=["feature1", "feature2"],
26
- target="target_column"
27
- )
28
-
29
- # Make predictions
30
- predictions = model.predict(X)
31
-
32
- # Get training metrics
33
- metrics = model.get_metrics()
34
- print(metrics)
35
- ```
36
-
37
- ## Features
38
-
39
- - Secure model training using encrypted datasets
40
- - Support for linear regression models
41
- - Progress tracking with tqdm
42
- - Comprehensive error handling and logging
43
- - Easy-to-use interface
44
- - Configurable server URL
45
-
46
- ## API Reference
47
-
48
- ### SecureModel
49
-
50
- The main class for secure model training.
51
-
52
- #### Methods
53
-
54
- - `linearRegression(server_url: str = "http://localhost:8000") -> SecureModel`
55
- - Create a new linear regression model instance
56
-
57
- - `set_server_url(server_url: str) -> SecureModel`
58
- - Set a custom URL for the ML training server
59
-
60
- - `fit(dataset_hash: str, features: List[str] = None, target: str = None, params: Dict[str, Any] = None) -> SecureModel`
61
- - Train the model using the specified dataset
62
-
63
- - `predict(X: Union[pd.DataFrame, List[List[float]]]) -> List[float]`
64
- - Make predictions using the trained model
65
-
66
- - `score(X: Union[pd.DataFrame, List[List[float]]], y: List[float]) -> Dict[str, float]`
67
- - Calculate model performance metrics
68
-
69
- - `get_metrics() -> Dict[str, Any]`
70
- - Get training metrics
71
-
72
- ## Requirements
73
-
74
- - Python 3.7+
75
- - requests
76
- - joblib
77
- - pandas
78
- - scikit-learn
79
- - tqdm
80
-
81
- ## License
82
-
83
- MIT License
File without changes