|
10 | 10 | import math
|
11 | 11 | import pickle
|
12 | 12 | import pickletools
|
| 13 | +import warnings |
13 | 14 | from collections.abc import Iterable
|
14 | 15 |
|
15 | 16 |
|
@@ -196,7 +197,7 @@ def writeModelPropertiesJSON(
|
196 | 197 | # Check if model description provided is smaller than then 1024 character limit
|
197 | 198 | if len(modelDesc) > 1024:
|
198 | 199 | modelDesc = modelDesc[:1024]
|
199 |
| - print( |
| 200 | + warnings.warn( |
200 | 201 | "WARNING: The provided model description was truncated to 1024 characters."
|
201 | 202 | )
|
202 | 203 |
|
@@ -533,15 +534,10 @@ def calculateFitStat(
|
533 | 534 | dataSets[i] = data.tolist()
|
534 | 535 |
|
535 | 536 | if len(dataPartitionExists) == 0:
|
536 |
| - try: |
537 |
| - raise ValueError |
538 |
| - except ValueError: |
539 |
| - print( |
540 |
| - "No data was provided. Please provide the actual " |
541 |
| - + "and predicted values for at least one of the " |
542 |
| - + "partitions (VALIDATE, TRAIN, or TEST)." |
543 |
| - ) |
544 |
| - raise |
| 537 | + raise ValueError( |
| 538 | + "No data was provided. Please provide the actual and predicted values for at least one of the " |
| 539 | + "partitions (VALIDATE, TRAIN, or TEST). " |
| 540 | + ) |
545 | 541 |
|
546 | 542 | for j in dataPartitionExists:
|
547 | 543 | fitStats = nullJSONDict["data"][j]["dataMap"]
|
@@ -705,12 +701,10 @@ def generateROCLiftStat(
|
705 | 701 | dataSets[i][columns] = data.transpose()
|
706 | 702 |
|
707 | 703 | if len(dataPartitionExists) == 0:
|
708 |
| - print( |
709 |
| - "No data was provided. Please provide the actual " |
710 |
| - + "and predicted values for at least one of the " |
711 |
| - + "partitions (VALIDATE, TRAIN, or TEST)." |
| 704 | + raise ValueError( |
| 705 | + "No data was provided. Please provide the actual and predicted values for at least one " |
| 706 | + "of the partitions (VALIDATE, TRAIN, or TEST)" |
712 | 707 | )
|
713 |
| - raise ValueError |
714 | 708 |
|
715 | 709 | nullLiftRow = list(range(1, 64))
|
716 | 710 | nullROCRow = list(range(1, 301))
|
@@ -1075,7 +1069,7 @@ def get_local_package_version(cls, package_list):
|
1075 | 1069 | """
|
1076 | 1070 |
|
1077 | 1071 | def package_not_found_output(package_name, package_versions):
|
1078 |
| - print( |
| 1072 | + warnings.warn( |
1079 | 1073 | f"Warning: Package {package_name} was not found in the local environment. Either {package_name} is not "
|
1080 | 1074 | f"a valid Python package, or the package is not present in this environment. The requirements.json file"
|
1081 | 1075 | f" will include a commented out version of the pip installation command at the bottom of the file. "
|
|
0 commit comments