validmind 2.7.6__py3-none-any.whl → 2.7.8__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.
Files changed (148) hide show
  1. validmind/__init__.py +2 -0
  2. validmind/__version__.py +1 -1
  3. validmind/ai/test_descriptions.py +32 -2
  4. validmind/api_client.py +8 -1
  5. validmind/datasets/credit_risk/lending_club.py +3 -4
  6. validmind/html_templates/content_blocks.py +1 -1
  7. validmind/tests/__types__.py +17 -0
  8. validmind/tests/data_validation/ACFandPACFPlot.py +6 -2
  9. validmind/tests/data_validation/AutoMA.py +2 -2
  10. validmind/tests/data_validation/BivariateScatterPlots.py +4 -2
  11. validmind/tests/data_validation/BoxPierce.py +2 -2
  12. validmind/tests/data_validation/ClassImbalance.py +2 -1
  13. validmind/tests/data_validation/DatasetDescription.py +11 -2
  14. validmind/tests/data_validation/DatasetSplit.py +2 -2
  15. validmind/tests/data_validation/DickeyFullerGLS.py +2 -2
  16. validmind/tests/data_validation/FeatureTargetCorrelationPlot.py +8 -2
  17. validmind/tests/data_validation/HighCardinality.py +9 -2
  18. validmind/tests/data_validation/HighPearsonCorrelation.py +6 -2
  19. validmind/tests/data_validation/IQROutliersBarPlot.py +9 -2
  20. validmind/tests/data_validation/LaggedCorrelationHeatmap.py +2 -2
  21. validmind/tests/data_validation/MissingValuesBarPlot.py +12 -9
  22. validmind/tests/data_validation/MutualInformation.py +6 -8
  23. validmind/tests/data_validation/PearsonCorrelationMatrix.py +2 -2
  24. validmind/tests/data_validation/ProtectedClassesCombination.py +6 -1
  25. validmind/tests/data_validation/ProtectedClassesDescription.py +1 -1
  26. validmind/tests/data_validation/ProtectedClassesDisparity.py +4 -5
  27. validmind/tests/data_validation/ProtectedClassesThresholdOptimizer.py +1 -4
  28. validmind/tests/data_validation/RollingStatsPlot.py +21 -10
  29. validmind/tests/data_validation/ScatterPlot.py +3 -5
  30. validmind/tests/data_validation/ScoreBandDefaultRates.py +2 -1
  31. validmind/tests/data_validation/SeasonalDecompose.py +12 -2
  32. validmind/tests/data_validation/Skewness.py +6 -3
  33. validmind/tests/data_validation/SpreadPlot.py +8 -3
  34. validmind/tests/data_validation/TabularCategoricalBarPlots.py +4 -2
  35. validmind/tests/data_validation/TabularDateTimeHistograms.py +2 -2
  36. validmind/tests/data_validation/TargetRateBarPlots.py +4 -3
  37. validmind/tests/data_validation/TimeSeriesFrequency.py +7 -2
  38. validmind/tests/data_validation/TimeSeriesMissingValues.py +14 -10
  39. validmind/tests/data_validation/TimeSeriesOutliers.py +1 -5
  40. validmind/tests/data_validation/WOEBinPlots.py +2 -2
  41. validmind/tests/data_validation/WOEBinTable.py +11 -9
  42. validmind/tests/data_validation/nlp/CommonWords.py +2 -2
  43. validmind/tests/data_validation/nlp/Hashtags.py +2 -2
  44. validmind/tests/data_validation/nlp/LanguageDetection.py +9 -6
  45. validmind/tests/data_validation/nlp/Mentions.py +9 -6
  46. validmind/tests/data_validation/nlp/PolarityAndSubjectivity.py +2 -2
  47. validmind/tests/data_validation/nlp/Punctuations.py +4 -2
  48. validmind/tests/data_validation/nlp/Sentiment.py +2 -2
  49. validmind/tests/data_validation/nlp/StopWords.py +5 -4
  50. validmind/tests/data_validation/nlp/TextDescription.py +2 -2
  51. validmind/tests/data_validation/nlp/Toxicity.py +2 -2
  52. validmind/tests/model_validation/BertScore.py +2 -2
  53. validmind/tests/model_validation/BleuScore.py +2 -2
  54. validmind/tests/model_validation/ClusterSizeDistribution.py +2 -2
  55. validmind/tests/model_validation/ContextualRecall.py +2 -2
  56. validmind/tests/model_validation/FeaturesAUC.py +2 -2
  57. validmind/tests/model_validation/MeteorScore.py +2 -2
  58. validmind/tests/model_validation/ModelPredictionResiduals.py +2 -2
  59. validmind/tests/model_validation/RegardScore.py +6 -2
  60. validmind/tests/model_validation/RegressionResidualsPlot.py +4 -3
  61. validmind/tests/model_validation/RougeScore.py +6 -5
  62. validmind/tests/model_validation/TimeSeriesPredictionWithCI.py +11 -2
  63. validmind/tests/model_validation/TokenDisparity.py +2 -2
  64. validmind/tests/model_validation/ToxicityScore.py +10 -2
  65. validmind/tests/model_validation/embeddings/ClusterDistribution.py +9 -3
  66. validmind/tests/model_validation/embeddings/CosineSimilarityComparison.py +16 -2
  67. validmind/tests/model_validation/embeddings/CosineSimilarityDistribution.py +5 -3
  68. validmind/tests/model_validation/embeddings/CosineSimilarityHeatmap.py +2 -2
  69. validmind/tests/model_validation/embeddings/DescriptiveAnalytics.py +14 -4
  70. validmind/tests/model_validation/embeddings/EmbeddingsVisualization2D.py +2 -2
  71. validmind/tests/model_validation/embeddings/EuclideanDistanceComparison.py +16 -2
  72. validmind/tests/model_validation/embeddings/EuclideanDistanceHeatmap.py +2 -2
  73. validmind/tests/model_validation/embeddings/PCAComponentsPairwisePlots.py +4 -5
  74. validmind/tests/model_validation/embeddings/StabilityAnalysisKeyword.py +4 -2
  75. validmind/tests/model_validation/embeddings/StabilityAnalysisRandomNoise.py +4 -2
  76. validmind/tests/model_validation/embeddings/StabilityAnalysisSynonyms.py +4 -2
  77. validmind/tests/model_validation/embeddings/StabilityAnalysisTranslation.py +4 -2
  78. validmind/tests/model_validation/embeddings/TSNEComponentsPairwisePlots.py +8 -6
  79. validmind/tests/model_validation/embeddings/utils.py +11 -1
  80. validmind/tests/model_validation/ragas/AnswerCorrectness.py +2 -1
  81. validmind/tests/model_validation/ragas/AspectCritic.py +11 -7
  82. validmind/tests/model_validation/ragas/ContextEntityRecall.py +2 -1
  83. validmind/tests/model_validation/ragas/ContextPrecision.py +2 -1
  84. validmind/tests/model_validation/ragas/ContextPrecisionWithoutReference.py +2 -1
  85. validmind/tests/model_validation/ragas/ContextRecall.py +2 -1
  86. validmind/tests/model_validation/ragas/Faithfulness.py +2 -1
  87. validmind/tests/model_validation/ragas/NoiseSensitivity.py +2 -1
  88. validmind/tests/model_validation/ragas/ResponseRelevancy.py +2 -1
  89. validmind/tests/model_validation/ragas/SemanticSimilarity.py +2 -1
  90. validmind/tests/model_validation/sklearn/CalibrationCurve.py +3 -2
  91. validmind/tests/model_validation/sklearn/ClassifierThresholdOptimization.py +2 -5
  92. validmind/tests/model_validation/sklearn/ClusterCosineSimilarity.py +5 -2
  93. validmind/tests/model_validation/sklearn/ConfusionMatrix.py +2 -2
  94. validmind/tests/model_validation/sklearn/FeatureImportance.py +1 -14
  95. validmind/tests/model_validation/sklearn/HyperParametersTuning.py +6 -3
  96. validmind/tests/model_validation/sklearn/KMeansClustersOptimization.py +2 -2
  97. validmind/tests/model_validation/sklearn/MinimumROCAUCScore.py +8 -4
  98. validmind/tests/model_validation/sklearn/ModelParameters.py +1 -0
  99. validmind/tests/model_validation/sklearn/OverfitDiagnosis.py +3 -3
  100. validmind/tests/model_validation/sklearn/PermutationFeatureImportance.py +2 -2
  101. validmind/tests/model_validation/sklearn/PopulationStabilityIndex.py +20 -16
  102. validmind/tests/model_validation/sklearn/PrecisionRecallCurve.py +4 -2
  103. validmind/tests/model_validation/sklearn/ROCCurve.py +1 -1
  104. validmind/tests/model_validation/sklearn/RegressionR2Square.py +7 -9
  105. validmind/tests/model_validation/sklearn/RegressionR2SquareComparison.py +1 -3
  106. validmind/tests/model_validation/sklearn/SHAPGlobalImportance.py +2 -1
  107. validmind/tests/model_validation/sklearn/ScoreProbabilityAlignment.py +2 -1
  108. validmind/tests/model_validation/sklearn/SilhouettePlot.py +5 -3
  109. validmind/tests/model_validation/sklearn/TrainingTestDegradation.py +9 -1
  110. validmind/tests/model_validation/sklearn/WeakspotsDiagnosis.py +1 -1
  111. validmind/tests/model_validation/statsmodels/CumulativePredictionProbabilities.py +11 -4
  112. validmind/tests/model_validation/statsmodels/DurbinWatsonTest.py +1 -3
  113. validmind/tests/model_validation/statsmodels/GINITable.py +7 -15
  114. validmind/tests/model_validation/statsmodels/Lilliefors.py +2 -2
  115. validmind/tests/model_validation/statsmodels/RegressionCoeffs.py +1 -1
  116. validmind/tests/model_validation/statsmodels/RegressionFeatureSignificance.py +2 -2
  117. validmind/tests/model_validation/statsmodels/RegressionModelForecastPlotLevels.py +5 -2
  118. validmind/tests/model_validation/statsmodels/RegressionModelSensitivityPlot.py +5 -2
  119. validmind/tests/model_validation/statsmodels/RegressionModelSummary.py +7 -7
  120. validmind/tests/model_validation/statsmodels/RegressionPermutationFeatureImportance.py +2 -2
  121. validmind/tests/ongoing_monitoring/CalibrationCurveDrift.py +3 -1
  122. validmind/tests/ongoing_monitoring/ClassDiscriminationDrift.py +4 -2
  123. validmind/tests/ongoing_monitoring/ClassImbalanceDrift.py +4 -2
  124. validmind/tests/ongoing_monitoring/ClassificationAccuracyDrift.py +3 -1
  125. validmind/tests/ongoing_monitoring/ConfusionMatrixDrift.py +3 -1
  126. validmind/tests/ongoing_monitoring/CumulativePredictionProbabilitiesDrift.py +3 -1
  127. validmind/tests/ongoing_monitoring/FeatureDrift.py +1 -0
  128. validmind/tests/ongoing_monitoring/PredictionCorrelation.py +1 -0
  129. validmind/tests/ongoing_monitoring/PredictionProbabilitiesHistogramDrift.py +3 -1
  130. validmind/tests/ongoing_monitoring/PredictionQuantilesAcrossFeatures.py +1 -0
  131. validmind/tests/ongoing_monitoring/ROCCurveDrift.py +3 -2
  132. validmind/tests/ongoing_monitoring/ScoreBandsDrift.py +4 -2
  133. validmind/tests/ongoing_monitoring/ScorecardHistogramDrift.py +3 -1
  134. validmind/tests/ongoing_monitoring/TargetPredictionDistributionPlot.py +4 -3
  135. validmind/tests/prompt_validation/Bias.py +13 -9
  136. validmind/tests/prompt_validation/Clarity.py +13 -9
  137. validmind/tests/prompt_validation/Conciseness.py +13 -9
  138. validmind/tests/prompt_validation/Delimitation.py +13 -9
  139. validmind/tests/prompt_validation/NegativeInstruction.py +14 -11
  140. validmind/tests/prompt_validation/Robustness.py +6 -2
  141. validmind/tests/prompt_validation/Specificity.py +13 -9
  142. validmind/tests/run.py +6 -0
  143. validmind/utils.py +7 -8
  144. {validmind-2.7.6.dist-info → validmind-2.7.8.dist-info}/METADATA +1 -2
  145. {validmind-2.7.6.dist-info → validmind-2.7.8.dist-info}/RECORD +148 -148
  146. {validmind-2.7.6.dist-info → validmind-2.7.8.dist-info}/WHEEL +1 -1
  147. {validmind-2.7.6.dist-info → validmind-2.7.8.dist-info}/LICENSE +0 -0
  148. {validmind-2.7.6.dist-info → validmind-2.7.8.dist-info}/entry_points.txt +0 -0
@@ -7,7 +7,7 @@ from typing import List, Union
7
7
  import matplotlib.pyplot as plt
8
8
  import numpy as np
9
9
 
10
- from validmind import tags, tasks
10
+ from validmind import RawData, tags, tasks
11
11
  from validmind.logging import get_logger
12
12
  from validmind.vm_models import VMDataset, VMModel
13
13
 
@@ -111,4 +111,7 @@ def RegressionModelSensitivityPlot(
111
111
 
112
112
  plt.close()
113
113
 
114
- return fig
114
+ return fig, RawData(
115
+ transformed_target=transformed_target,
116
+ transformed_predictions=transformed_predictions,
117
+ )
@@ -45,17 +45,17 @@ def RegressionModelSummary(dataset: VMDataset, model: VMModel):
45
45
  - A high R-Squared or Adjusted R-Squared may not necessarily indicate a good model, especially in cases of
46
46
  overfitting.
47
47
  """
48
- y_true = dataset.y
49
- y_pred = dataset.y_pred(model)
50
-
51
48
  return [
52
49
  {
53
50
  "Independent Variables": dataset.feature_columns,
54
- "R-Squared": r2_score(y_true, y_pred),
51
+ "R-Squared": r2_score(dataset.y, dataset.y_pred(model)),
55
52
  "Adjusted R-Squared": adj_r2_score(
56
- y_true, y_pred, len(y_true), len(dataset.feature_columns)
53
+ dataset.y,
54
+ dataset.y_pred(model),
55
+ len(dataset.y),
56
+ len(dataset.feature_columns),
57
57
  ),
58
- "MSE": mean_squared_error(y_true=y_true, y_pred=y_pred, squared=True),
59
- "RMSE": mean_squared_error(y_true=y_true, y_pred=y_pred, squared=False),
58
+ "MSE": mean_squared_error(dataset.y, dataset.y_pred(model), squared=True),
59
+ "RMSE": mean_squared_error(dataset.y, dataset.y_pred(model), squared=False),
60
60
  }
61
61
  ]
@@ -8,7 +8,7 @@ import plotly.graph_objects as go
8
8
  from sklearn.metrics import r2_score
9
9
  from sklearn.utils import check_random_state
10
10
 
11
- from validmind import tags, tasks
11
+ from validmind import RawData, tags, tasks
12
12
  from validmind.logging import get_logger
13
13
  from validmind.vm_models import VMDataset, VMModel
14
14
 
@@ -97,4 +97,4 @@ def RegressionPermutationFeatureImportance(
97
97
  height=figure_height,
98
98
  )
99
99
 
100
- return fig
100
+ return fig, RawData(importances=importances)
@@ -2,11 +2,13 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
+ from typing import List
6
+
5
7
  import numpy as np
6
8
  import pandas as pd
7
9
  import plotly.graph_objects as go
8
10
  from sklearn.calibration import calibration_curve
9
- from typing import List
11
+
10
12
  from validmind import tags, tasks
11
13
  from validmind.errors import SkipTestError
12
14
  from validmind.vm_models import VMDataset, VMModel
@@ -2,12 +2,14 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
+ from typing import List
6
+
5
7
  import numpy as np
6
8
  import pandas as pd
9
+ from scipy import stats
7
10
  from sklearn.metrics import roc_auc_score
8
11
  from sklearn.preprocessing import LabelBinarizer
9
- from scipy import stats
10
- from typing import List
12
+
11
13
  from validmind import tags, tasks
12
14
  from validmind.vm_models import VMDataset, VMModel
13
15
 
@@ -2,12 +2,14 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
+ from typing import List
6
+
5
7
  import pandas as pd
6
8
  import plotly.graph_objs as go
7
- from typing import List
9
+
8
10
  from validmind import tags, tasks
9
- from validmind.vm_models import VMDataset
10
11
  from validmind.errors import SkipTestError
12
+ from validmind.vm_models import VMDataset
11
13
 
12
14
 
13
15
  @tags("tabular_data", "binary_classification", "multiclass_classification")
@@ -2,10 +2,12 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
+ from typing import List
6
+
5
7
  import numpy as np
6
8
  import pandas as pd
7
9
  from sklearn.metrics import classification_report
8
- from typing import List
10
+
9
11
  from validmind import tags, tasks
10
12
  from validmind.vm_models import VMDataset, VMModel
11
13
 
@@ -2,10 +2,12 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
+ from typing import List
6
+
5
7
  import numpy as np
6
8
  import pandas as pd
7
9
  from sklearn.metrics import confusion_matrix
8
- from typing import List
10
+
9
11
  from validmind import tags, tasks
10
12
  from validmind.vm_models import VMDataset, VMModel
11
13
 
@@ -2,10 +2,12 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
+ from typing import List
6
+
5
7
  import numpy as np
6
8
  import plotly.graph_objects as go
7
9
  from plotly.subplots import make_subplots
8
- from typing import List
10
+
9
11
  from validmind import tags, tasks
10
12
  from validmind.vm_models import VMDataset, VMModel
11
13
 
@@ -5,6 +5,7 @@
5
5
  import numpy as np
6
6
  import pandas as pd
7
7
  import plotly.graph_objects as go
8
+
8
9
  from validmind import tags, tasks
9
10
 
10
11
 
@@ -4,6 +4,7 @@
4
4
 
5
5
  import pandas as pd
6
6
  import plotly.graph_objects as go
7
+
7
8
  from validmind import tags, tasks
8
9
 
9
10
 
@@ -2,12 +2,14 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
+ from typing import List
6
+
5
7
  import numpy as np
6
8
  import pandas as pd
7
9
  import plotly.graph_objects as go
8
10
  from plotly.subplots import make_subplots
9
11
  from scipy import stats
10
- from typing import List
12
+
11
13
  from validmind import tags, tasks
12
14
  from validmind.vm_models import VMDataset, VMModel
13
15
 
@@ -4,6 +4,7 @@
4
4
 
5
5
  import plotly.graph_objects as go
6
6
  from plotly.subplots import make_subplots
7
+
7
8
  from validmind import tags, tasks
8
9
 
9
10
 
@@ -2,15 +2,16 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
+ from typing import List
6
+
5
7
  import numpy as np
6
8
  import plotly.graph_objects as go
7
9
  from sklearn.metrics import roc_auc_score, roc_curve
10
+
8
11
  from validmind import tags, tasks
9
12
  from validmind.errors import SkipTestError
10
13
  from validmind.vm_models import VMDataset, VMModel
11
14
 
12
- from typing import List
13
-
14
15
 
15
16
  @tags(
16
17
  "sklearn",
@@ -2,9 +2,11 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
- import pandas as pd
6
- import numpy as np
7
5
  from typing import List
6
+
7
+ import numpy as np
8
+ import pandas as pd
9
+
8
10
  from validmind import tags, tasks
9
11
  from validmind.vm_models import VMDataset, VMModel
10
12
 
@@ -2,12 +2,14 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
+ from typing import List
6
+
5
7
  import numpy as np
6
8
  import pandas as pd
7
9
  import plotly.graph_objects as go
8
10
  from plotly.subplots import make_subplots
9
11
  from scipy import stats
10
- from typing import List
12
+
11
13
  from validmind import tags, tasks
12
14
  from validmind.vm_models import VMDataset
13
15
 
@@ -2,10 +2,11 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
- import plotly.graph_objects as go
6
- import plotly.figure_factory as ff
7
5
  import pandas as pd
8
- from scipy.stats import skew, kurtosis
6
+ import plotly.figure_factory as ff
7
+ import plotly.graph_objects as go
8
+ from scipy.stats import kurtosis, skew
9
+
9
10
  from validmind import tags, tasks
10
11
 
11
12
 
@@ -2,7 +2,7 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
- from validmind import tags, tasks
5
+ from validmind import RawData, tags, tasks
6
6
  from validmind.errors import MissingRequiredTestInputError
7
7
 
8
8
  from .ai_powered_test import (
@@ -107,11 +107,15 @@ def Bias(model, min_threshold=7):
107
107
 
108
108
  passed = score > min_threshold
109
109
 
110
- return [
111
- {
112
- "Score": score,
113
- "Explanation": explanation,
114
- "Threshold": min_threshold,
115
- "Pass/Fail": "Pass" if passed else "Fail",
116
- }
117
- ], passed
110
+ return (
111
+ [
112
+ {
113
+ "Score": score,
114
+ "Explanation": explanation,
115
+ "Threshold": min_threshold,
116
+ "Pass/Fail": "Pass" if passed else "Fail",
117
+ }
118
+ ],
119
+ passed,
120
+ RawData(response=response),
121
+ )
@@ -2,7 +2,7 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
- from validmind import tags, tasks
5
+ from validmind import RawData, tags, tasks
6
6
  from validmind.errors import MissingRequiredTestInputError
7
7
 
8
8
  from .ai_powered_test import (
@@ -96,11 +96,15 @@ def Clarity(model, min_threshold=7):
96
96
 
97
97
  passed = score > min_threshold
98
98
 
99
- return [
100
- {
101
- "Score": score,
102
- "Explanation": explanation,
103
- "Threshold": min_threshold,
104
- "Pass/Fail": "Pass" if passed else "Fail",
105
- }
106
- ], passed
99
+ return (
100
+ [
101
+ {
102
+ "Score": score,
103
+ "Explanation": explanation,
104
+ "Threshold": min_threshold,
105
+ "Pass/Fail": "Pass" if passed else "Fail",
106
+ }
107
+ ],
108
+ passed,
109
+ RawData(response=response),
110
+ )
@@ -2,7 +2,7 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
- from validmind import tags, tasks
5
+ from validmind import RawData, tags, tasks
6
6
  from validmind.errors import MissingRequiredTestInputError
7
7
 
8
8
  from .ai_powered_test import (
@@ -103,11 +103,15 @@ def Conciseness(model, min_threshold=7):
103
103
 
104
104
  passed = score > min_threshold
105
105
 
106
- return [
107
- {
108
- "Score": score,
109
- "Threshold": min_threshold,
110
- "Explanation": explanation,
111
- "Pass/Fail": "Pass" if passed else "Fail",
112
- }
113
- ], passed
106
+ return (
107
+ [
108
+ {
109
+ "Score": score,
110
+ "Threshold": min_threshold,
111
+ "Explanation": explanation,
112
+ "Pass/Fail": "Pass" if passed else "Fail",
113
+ }
114
+ ],
115
+ passed,
116
+ RawData(response=response),
117
+ )
@@ -2,7 +2,7 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
- from validmind import tags, tasks
5
+ from validmind import RawData, tags, tasks
6
6
  from validmind.errors import MissingRequiredTestInputError
7
7
 
8
8
  from .ai_powered_test import (
@@ -89,11 +89,15 @@ def Delimitation(model, min_threshold=7):
89
89
 
90
90
  passed = score > min_threshold
91
91
 
92
- return [
93
- {
94
- "Score": score,
95
- "Threshold": min_threshold,
96
- "Explanation": explanation,
97
- "Pass/Fail": "Pass" if passed else "Fail",
98
- }
99
- ], passed
92
+ return (
93
+ [
94
+ {
95
+ "Score": score,
96
+ "Threshold": min_threshold,
97
+ "Explanation": explanation,
98
+ "Pass/Fail": "Pass" if passed else "Fail",
99
+ }
100
+ ],
101
+ passed,
102
+ RawData(response=response),
103
+ )
@@ -2,7 +2,7 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
- from validmind import tags, tasks
5
+ from validmind import RawData, tags, tasks
6
6
  from validmind.errors import MissingRequiredTestInputError
7
7
 
8
8
  from .ai_powered_test import (
@@ -106,13 +106,16 @@ def NegativeInstruction(model, min_threshold=7):
106
106
  explanation = get_explanation(response)
107
107
 
108
108
  passed = score > min_threshold
109
- result = [
110
- {
111
- "Score": score,
112
- "Threshold": min_threshold,
113
- "Explanation": explanation,
114
- "Pass/Fail": "Pass" if passed else "Fail",
115
- }
116
- ]
117
-
118
- return result, passed
109
+
110
+ return (
111
+ [
112
+ {
113
+ "Score": score,
114
+ "Threshold": min_threshold,
115
+ "Explanation": explanation,
116
+ "Pass/Fail": "Pass" if passed else "Fail",
117
+ }
118
+ ],
119
+ passed,
120
+ RawData(model_response=response),
121
+ )
@@ -4,7 +4,7 @@
4
4
 
5
5
  import pandas as pd
6
6
 
7
- from validmind import tags, tasks
7
+ from validmind import RawData, tags, tasks
8
8
  from validmind.errors import MissingRequiredTestInputError, SkipTestError
9
9
 
10
10
  from .ai_powered_test import call_model, missing_prompt_message
@@ -127,4 +127,8 @@ def Robustness(model, dataset, num_tests=10):
127
127
  for generated_input, response in zip(generated_inputs, responses)
128
128
  ]
129
129
 
130
- return results, all(result["Pass/Fail"] == "Pass" for result in results)
130
+ return (
131
+ results,
132
+ all(result["Pass/Fail"] == "Pass" for result in results),
133
+ RawData(generated_inputs=generated_inputs, responses=responses),
134
+ )
@@ -2,7 +2,7 @@
2
2
  # See the LICENSE file in the root of this repository for details.
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
- from validmind import tags, tasks
5
+ from validmind import RawData, tags, tasks
6
6
  from validmind.errors import MissingRequiredTestInputError
7
7
 
8
8
  from .ai_powered_test import (
@@ -103,11 +103,15 @@ def Specificity(model, min_threshold=7):
103
103
 
104
104
  passed = score > min_threshold
105
105
 
106
- return [
107
- {
108
- "Score": score,
109
- "Threshold": min_threshold,
110
- "Explanation": explanation,
111
- "Pass/Fail": "Pass" if passed else "Fail",
112
- }
113
- ], passed
106
+ return (
107
+ [
108
+ {
109
+ "Score": score,
110
+ "Threshold": min_threshold,
111
+ "Explanation": explanation,
112
+ "Pass/Fail": "Pass" if passed else "Fail",
113
+ }
114
+ ],
115
+ passed,
116
+ RawData(response=response),
117
+ )
validmind/tests/run.py CHANGED
@@ -3,6 +3,7 @@
3
3
  # SPDX-License-Identifier: AGPL-3.0 AND ValidMind Commercial
4
4
 
5
5
  import platform
6
+ import pprint
6
7
  import subprocess
7
8
  import time
8
9
  from datetime import datetime
@@ -396,3 +397,8 @@ def run_test( # noqa: C901
396
397
  result.show()
397
398
 
398
399
  return result
400
+
401
+
402
+ def print_env():
403
+ e = _get_run_metadata()
404
+ pprint.pp(e)
validmind/utils.py CHANGED
@@ -23,7 +23,6 @@ import seaborn as sns
23
23
  from IPython.core import getipython
24
24
  from IPython.display import HTML
25
25
  from IPython.display import display as ipy_display
26
- from latex2mathml.converter import convert
27
26
  from matplotlib.axes._axes import _log as matplotlib_axes_logger
28
27
  from numpy import ndarray
29
28
  from sklearn.exceptions import UndefinedMetricWarning
@@ -491,7 +490,7 @@ def display(widget_or_html, syntax_highlighting=True, mathjax=True):
491
490
  ipy_display(HTML(widget_or_html))
492
491
  # if html we can auto-detect if we actually need syntax highlighting or MathJax
493
492
  syntax_highlighting = 'class="language-' in widget_or_html
494
- mathjax = "$$" in widget_or_html
493
+ mathjax = "math/tex" in widget_or_html
495
494
  else:
496
495
  ipy_display(widget_or_html)
497
496
 
@@ -510,20 +509,20 @@ def md_to_html(md: str, mathml=False) -> str:
510
509
  )(md)
511
510
 
512
511
  if not mathml:
513
- # return the html as is (with latex that will be rendered by MathJax)
514
512
  return html
515
513
 
516
- # convert the latex to MathML which CKeditor can render
514
+ # convert the latex to mathjax
517
515
  math_block_pattern = re.compile(r'<div class="math">\$\$([\s\S]*?)\$\$</div>')
518
516
  html = math_block_pattern.sub(
519
- lambda match: "<p>{}</p>".format(convert(match.group(1), display="block")), html
517
+ lambda match: '<script type="math/tex; mode=display">{}</script>'.format(
518
+ match.group(1)
519
+ ),
520
+ html,
520
521
  )
521
522
 
522
523
  inline_math_pattern = re.compile(r'<span class="math">\\\((.*?)\\\)</span>')
523
524
  html = inline_math_pattern.sub(
524
- lambda match: "<span>{}</span>".format(
525
- convert(match.group(1), display="inline")
526
- ),
525
+ lambda match: '<script type="math/tex">{}</script>'.format(match.group(1)),
527
526
  html,
528
527
  )
529
528
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: validmind
3
- Version: 2.7.6
3
+ Version: 2.7.8
4
4
  Summary: ValidMind Library
5
5
  License: Commercial License
6
6
  Author: Andres Rodriguez
@@ -26,7 +26,6 @@ Requires-Dist: ipywidgets
26
26
  Requires-Dist: kaleido (>=0.2.1,!=0.2.1.post1)
27
27
  Requires-Dist: langchain-openai (>=0.1.8) ; extra == "all" or extra == "llm"
28
28
  Requires-Dist: langdetect
29
- Requires-Dist: latex2mathml (>=3.77.0)
30
29
  Requires-Dist: llvmlite ; python_version >= "3.8" and python_full_version <= "3.11.0"
31
30
  Requires-Dist: matplotlib
32
31
  Requires-Dist: mistune (>=3.0.2,<4.0.0)