analysistoolbox 2.1.9__tar.gz → 2.2.0__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.
Files changed (126) hide show
  1. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/PKG-INFO +88 -1
  2. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/README.md +87 -0
  3. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/ConductEntityMatching.py +28 -6
  4. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/llm/SendPromptToChatGPT.py +1 -1
  5. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox.egg-info/PKG-INFO +88 -1
  6. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/setup.py +1 -1
  7. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/LICENSE.md +0 -0
  8. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/__init__.py +0 -0
  9. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/calculus/FindDerivative.py +0 -0
  10. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/calculus/FindLimitOfFunction.py +0 -0
  11. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/calculus/FindMinimumSquareLoss.py +0 -0
  12. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/calculus/PlotFunction.py +0 -0
  13. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/calculus/__init__.py +0 -0
  14. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_collection/ExtractTextFromPDF.py +0 -0
  15. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_collection/FetchPDFFromURL.py +0 -0
  16. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_collection/FetchUSShapefile.py +0 -0
  17. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_collection/FetchWebsiteText.py +0 -0
  18. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_collection/GetCompanyFilings.py +0 -0
  19. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_collection/GetGoogleSearchResults.py +0 -0
  20. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_collection/GetZipFile.py +0 -0
  21. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_collection/__init__.py +0 -0
  22. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/AddDateNumberColumns.py +0 -0
  23. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/AddLeadingZeros.py +0 -0
  24. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/AddRowCountColumn.py +0 -0
  25. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/AddTPeriodColumn.py +0 -0
  26. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/AddTukeyOutlierColumn.py +0 -0
  27. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/CleanTextColumns.py +0 -0
  28. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/ConductAnomalyDetection.py +0 -0
  29. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/ConvertOddsToProbability.py +0 -0
  30. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/CountMissingDataByGroup.py +0 -0
  31. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/CreateBinnedColumn.py +0 -0
  32. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/CreateDataOverview.py +0 -0
  33. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/CreateRandomSampleGroups.py +0 -0
  34. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/CreateRareCategoryColumn.py +0 -0
  35. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/CreateStratifiedRandomSampleGroups.py +0 -0
  36. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/GeocodeUSAddresses.py +0 -0
  37. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/ImputeMissingValuesUsingNearestNeighbors.py +0 -0
  38. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/VerifyGranularity.py +0 -0
  39. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/data_processing/__init__.py +0 -0
  40. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/descriptive_analytics/ConductManifoldLearning.py +0 -0
  41. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/descriptive_analytics/ConductPrincipalComponentAnalysis.py +0 -0
  42. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/descriptive_analytics/ConductPropensityScoreMatching.py +0 -0
  43. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/descriptive_analytics/CreateAssociationRules.py +0 -0
  44. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/descriptive_analytics/CreateGaussianMixtureClusters.py +0 -0
  45. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/descriptive_analytics/CreateHierarchicalClusters.py +0 -0
  46. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/descriptive_analytics/CreateKMeansClusters.py +0 -0
  47. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/descriptive_analytics/GenerateEDAWithLIDA.py +0 -0
  48. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/descriptive_analytics/__init__.py +0 -0
  49. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/file_management/ConvertWordDocsToPDF.py +0 -0
  50. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/file_management/CreateCopyOfPDF.py +0 -0
  51. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/file_management/CreateFileTree.py +0 -0
  52. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/file_management/ImportDataFromFolder.py +0 -0
  53. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/file_management/__init__.py +0 -0
  54. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/ChiSquareTestOfIndependence.py +0 -0
  55. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/ChiSquareTestOfIndependenceFromTable.py +0 -0
  56. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/ConductCoxProportionalHazardRegression.py +0 -0
  57. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/ConductLinearRegressionAnalysis.py +0 -0
  58. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/ConductLogisticRegressionAnalysis.py +0 -0
  59. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/ConductSurvivalAnalysis.py +0 -0
  60. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/OneSampleTTest.py +0 -0
  61. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/OneWayANOVA.py +0 -0
  62. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/TTestOfMeanFromStats.py +0 -0
  63. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/TTestOfProportionFromStats.py +0 -0
  64. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/TTestOfTwoMeansFromStats.py +0 -0
  65. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/TwoSampleTTestOfIndependence.py +0 -0
  66. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/TwoSampleTTestPaired.py +0 -0
  67. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/hypothesis_testing/__init__.py +0 -0
  68. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/linear_algebra/CalculateEigenvalues.py +0 -0
  69. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/linear_algebra/ConvertMatrixToRowEchelonForm.py +0 -0
  70. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/linear_algebra/ConvertSystemOfEquationsToMatrix.py +0 -0
  71. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/linear_algebra/PlotVectors.py +0 -0
  72. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/linear_algebra/SolveSystemOfEquations.py +0 -0
  73. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/linear_algebra/VisualizeMatrixAsLinearTransformation.py +0 -0
  74. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/linear_algebra/__init__.py +0 -0
  75. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/llm/SendPromptToAnthropic.py +0 -0
  76. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/llm/__init__.py +0 -0
  77. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/predictive_analytics/CreateARIMAModel.py +0 -0
  78. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/predictive_analytics/CreateBoostedTreeModel.py +0 -0
  79. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/predictive_analytics/CreateDecisionTreeModel.py +0 -0
  80. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/predictive_analytics/CreateLinearRegressionModel.py +0 -0
  81. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/predictive_analytics/CreateLogisticRegressionModel.py +0 -0
  82. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/predictive_analytics/CreateNeuralNetwork_SingleOutcome.py +0 -0
  83. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/predictive_analytics/__init__.py +0 -0
  84. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/prescriptive_analytics/CreateContentBasedRecommender.py +0 -0
  85. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/prescriptive_analytics/__init__.py +0 -0
  86. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/probability/ProbabilityOfAtLeastOne.py +0 -0
  87. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/probability/__init__.py +0 -0
  88. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/CreateMetalogDistribution.py +0 -0
  89. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/CreateMetalogDistributionFromPercentiles.py +0 -0
  90. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/CreateSIPDataframe.py +0 -0
  91. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/CreateSLURPDistribution.py +0 -0
  92. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/SimulateCountOfSuccesses.py +0 -0
  93. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/SimulateCountOutcome.py +0 -0
  94. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/SimulateCountUntilFirstSuccess.py +0 -0
  95. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/SimulateNormallyDistributedOutcome.py +0 -0
  96. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/SimulateTDistributedOutcome.py +0 -0
  97. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/SimulateTimeBetweenEvents.py +0 -0
  98. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/SimulateTimeUntilNEvents.py +0 -0
  99. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/simulations/__init__.py +0 -0
  100. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/statistics/CalculateConfidenceIntervalOfMean.py +0 -0
  101. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/statistics/CalculateConfidenceIntervalOfProportion.py +0 -0
  102. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/statistics/__init__.py +0 -0
  103. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/Plot100PercentStackedBarChart.py +0 -0
  104. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotBarChart.py +0 -0
  105. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotBoxWhiskerByGroup.py +0 -0
  106. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotBulletChart.py +0 -0
  107. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotCard.py +0 -0
  108. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotClusteredBarChart.py +0 -0
  109. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotContingencyHeatmap.py +0 -0
  110. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotCorrelationMatrix.py +0 -0
  111. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotDensityByGroup.py +0 -0
  112. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotDotPlot.py +0 -0
  113. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotHeatmap.py +0 -0
  114. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotOverlappingAreaChart.py +0 -0
  115. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotRiskTolerance.py +0 -0
  116. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotScatterplot.py +0 -0
  117. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotSingleVariableCountPlot.py +0 -0
  118. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotSingleVariableHistogram.py +0 -0
  119. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/PlotTimeSeries.py +0 -0
  120. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/RenderTableOne.py +0 -0
  121. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox/visualizations/__init__.py +0 -0
  122. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox.egg-info/SOURCES.txt +0 -0
  123. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox.egg-info/dependency_links.txt +0 -0
  124. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox.egg-info/requires.txt +0 -0
  125. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/analysistoolbox.egg-info/top_level.txt +0 -0
  126. {analysistoolbox-2.1.9 → analysistoolbox-2.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: analysistoolbox
3
- Version: 2.1.9
3
+ Version: 2.2.0
4
4
  Summary: A collection tools in Python for data collection and processing, statistics, analytics, and intelligence analysis.
5
5
  Home-page: https://github.com/KyleProtho/AnalysisToolBox/tree/master/analysistoolbox
6
6
  Author: Kyle Protho
@@ -82,6 +82,7 @@ There are many modules in the analysistoolbox package, each with their own funct
82
82
  - [Descriptive Analytics](#descriptive-analytics)
83
83
  - [ConductManifoldLearning](#conductmanifoldlearning)
84
84
  - [ConductPrincipalComponentAnalysis](#conductprincipalcomponentanalysis)
85
+ - [ConductPropensityScoreMatching](#conductpropensityscorematching)
85
86
  - [CreateAssociationRules](#createassociationrules)
86
87
  - [CreateGaussianMixtureClusters](#creategaussianmixtureclusters)
87
88
  - [CreateHierarchicalClusters](#createhierarchicalclusters)
@@ -112,6 +113,9 @@ There are many modules in the analysistoolbox package, each with their own funct
112
113
  - [PlotVectors](#plotvectors)
113
114
  - [SolveSystemOfEquations](#solvesystemofequations)
114
115
  - [VisualizeMatrixAsLinearTransformation](#visualizematrixaslineartransformation)
116
+ - [LLM](#llm)
117
+ - [SendPromptToAnthropic](#sendprompttoanthropic)
118
+ - [SendPromptToChatGPT](#sendprompttochatgpt)
115
119
  - [Predictive Analytics](#predictive-analytics)
116
120
  - [CreateARIMAModel](#createarimamodel)
117
121
  - [CreateBoostedTreeModel](#createboostedtreemodel)
@@ -881,6 +885,29 @@ result = ConductPrincipalComponentAnalysis(
881
885
  )
882
886
  ```
883
887
 
888
+ #### ConductPropensityScoreMatching
889
+
890
+ Conducts propensity score matching to create balanced treatment and control groups for causal inference analysis.
891
+
892
+ ```python
893
+ from analysistoolbox.descriptive_analytics import ConductPropensityScoreMatching
894
+ import pandas as pd
895
+
896
+ # Create matched groups based on age, education, and experience
897
+ matched_df = ConductPropensityScoreMatching(
898
+ dataframe=df,
899
+ subject_id_column_name='employee_id',
900
+ list_of_column_names_to_base_matching=['age', 'education', 'years_experience'],
901
+ grouping_column_name='received_training',
902
+ control_group_name='No',
903
+ max_matches_per_subject=1,
904
+ balance_groups=True,
905
+ propensity_score_column_name="PS_Score",
906
+ matched_id_column_name="Matched_Employee_ID",
907
+ random_seed=412
908
+ )
909
+ ```
910
+
884
911
  #### CreateAssociationRules
885
912
 
886
913
  The **CreateAssociationRules** function creates association rules from a given dataframe. Association rules are widely used in market basket analysis, where the goal is to find associations and/or correlations among a set of items.
@@ -1459,6 +1486,66 @@ VisualizeMatrixAsLinearTransformation(
1459
1486
  )
1460
1487
  ```
1461
1488
 
1489
+ ### LLM
1490
+
1491
+ #### SendPromptToAnthropic
1492
+
1493
+ The **SendPromptToAnthropic** function sends a prompt to Anthropic's Claude API using LangChain. It supports template-based prompting and requires an Anthropic API key.
1494
+
1495
+ ```python
1496
+ from analysistoolbox.llm import SendPromptToAnthropic
1497
+
1498
+ # Define your prompt template with variables in curly braces
1499
+ prompt_template = "Given the text: {text}\nSummarize the main points in bullet form."
1500
+
1501
+ # Create a dictionary with your input variables
1502
+ user_input = {
1503
+ "text": "Your text to analyze goes here..."
1504
+ }
1505
+
1506
+ # Send the prompt to Claude
1507
+ response = SendPromptToAnthropic(
1508
+ prompt_template=prompt_template,
1509
+ user_input=user_input,
1510
+ system_message="You are a helpful assistant.",
1511
+ anthropic_api_key="your-api-key-here",
1512
+ temperature=0.0,
1513
+ chat_model_name="claude-3-opus-20240229",
1514
+ maximum_tokens=1000
1515
+ )
1516
+
1517
+ print(response)
1518
+ ```
1519
+
1520
+ #### SendPromptToChatGPT
1521
+
1522
+ The **SendPromptToChatGPT** function sends a prompt to OpenAI's ChatGPT API using LangChain. It supports template-based prompting and requires an OpenAI API key.
1523
+
1524
+ ```python
1525
+ from analysistoolbox.llm import SendPromptToChatGPT
1526
+
1527
+ # Define your prompt template with variables in curly braces
1528
+ prompt_template = "Analyze the following data: {data}\nProvide key insights."
1529
+
1530
+ # Create a dictionary with your input variables
1531
+ user_input = {
1532
+ "data": "Your data to analyze goes here..."
1533
+ }
1534
+
1535
+ # Send the prompt to ChatGPT
1536
+ response = SendPromptToChatGPT(
1537
+ prompt_template=prompt_template,
1538
+ user_input=user_input,
1539
+ system_message="You are a helpful assistant.",
1540
+ openai_api_key="your-api-key-here",
1541
+ temperature=0.0,
1542
+ chat_model_name="gpt-4o-mini",
1543
+ maximum_tokens=1000
1544
+ )
1545
+
1546
+ print(response)
1547
+ ```
1548
+
1462
1549
  ### Predictive Analytics
1463
1550
 
1464
1551
  #### CreateARIMAModel
@@ -64,6 +64,7 @@ There are many modules in the analysistoolbox package, each with their own funct
64
64
  - [Descriptive Analytics](#descriptive-analytics)
65
65
  - [ConductManifoldLearning](#conductmanifoldlearning)
66
66
  - [ConductPrincipalComponentAnalysis](#conductprincipalcomponentanalysis)
67
+ - [ConductPropensityScoreMatching](#conductpropensityscorematching)
67
68
  - [CreateAssociationRules](#createassociationrules)
68
69
  - [CreateGaussianMixtureClusters](#creategaussianmixtureclusters)
69
70
  - [CreateHierarchicalClusters](#createhierarchicalclusters)
@@ -94,6 +95,9 @@ There are many modules in the analysistoolbox package, each with their own funct
94
95
  - [PlotVectors](#plotvectors)
95
96
  - [SolveSystemOfEquations](#solvesystemofequations)
96
97
  - [VisualizeMatrixAsLinearTransformation](#visualizematrixaslineartransformation)
98
+ - [LLM](#llm)
99
+ - [SendPromptToAnthropic](#sendprompttoanthropic)
100
+ - [SendPromptToChatGPT](#sendprompttochatgpt)
97
101
  - [Predictive Analytics](#predictive-analytics)
98
102
  - [CreateARIMAModel](#createarimamodel)
99
103
  - [CreateBoostedTreeModel](#createboostedtreemodel)
@@ -863,6 +867,29 @@ result = ConductPrincipalComponentAnalysis(
863
867
  )
864
868
  ```
865
869
 
870
+ #### ConductPropensityScoreMatching
871
+
872
+ Conducts propensity score matching to create balanced treatment and control groups for causal inference analysis.
873
+
874
+ ```python
875
+ from analysistoolbox.descriptive_analytics import ConductPropensityScoreMatching
876
+ import pandas as pd
877
+
878
+ # Create matched groups based on age, education, and experience
879
+ matched_df = ConductPropensityScoreMatching(
880
+ dataframe=df,
881
+ subject_id_column_name='employee_id',
882
+ list_of_column_names_to_base_matching=['age', 'education', 'years_experience'],
883
+ grouping_column_name='received_training',
884
+ control_group_name='No',
885
+ max_matches_per_subject=1,
886
+ balance_groups=True,
887
+ propensity_score_column_name="PS_Score",
888
+ matched_id_column_name="Matched_Employee_ID",
889
+ random_seed=412
890
+ )
891
+ ```
892
+
866
893
  #### CreateAssociationRules
867
894
 
868
895
  The **CreateAssociationRules** function creates association rules from a given dataframe. Association rules are widely used in market basket analysis, where the goal is to find associations and/or correlations among a set of items.
@@ -1441,6 +1468,66 @@ VisualizeMatrixAsLinearTransformation(
1441
1468
  )
1442
1469
  ```
1443
1470
 
1471
+ ### LLM
1472
+
1473
+ #### SendPromptToAnthropic
1474
+
1475
+ The **SendPromptToAnthropic** function sends a prompt to Anthropic's Claude API using LangChain. It supports template-based prompting and requires an Anthropic API key.
1476
+
1477
+ ```python
1478
+ from analysistoolbox.llm import SendPromptToAnthropic
1479
+
1480
+ # Define your prompt template with variables in curly braces
1481
+ prompt_template = "Given the text: {text}\nSummarize the main points in bullet form."
1482
+
1483
+ # Create a dictionary with your input variables
1484
+ user_input = {
1485
+ "text": "Your text to analyze goes here..."
1486
+ }
1487
+
1488
+ # Send the prompt to Claude
1489
+ response = SendPromptToAnthropic(
1490
+ prompt_template=prompt_template,
1491
+ user_input=user_input,
1492
+ system_message="You are a helpful assistant.",
1493
+ anthropic_api_key="your-api-key-here",
1494
+ temperature=0.0,
1495
+ chat_model_name="claude-3-opus-20240229",
1496
+ maximum_tokens=1000
1497
+ )
1498
+
1499
+ print(response)
1500
+ ```
1501
+
1502
+ #### SendPromptToChatGPT
1503
+
1504
+ The **SendPromptToChatGPT** function sends a prompt to OpenAI's ChatGPT API using LangChain. It supports template-based prompting and requires an OpenAI API key.
1505
+
1506
+ ```python
1507
+ from analysistoolbox.llm import SendPromptToChatGPT
1508
+
1509
+ # Define your prompt template with variables in curly braces
1510
+ prompt_template = "Analyze the following data: {data}\nProvide key insights."
1511
+
1512
+ # Create a dictionary with your input variables
1513
+ user_input = {
1514
+ "data": "Your data to analyze goes here..."
1515
+ }
1516
+
1517
+ # Send the prompt to ChatGPT
1518
+ response = SendPromptToChatGPT(
1519
+ prompt_template=prompt_template,
1520
+ user_input=user_input,
1521
+ system_message="You are a helpful assistant.",
1522
+ openai_api_key="your-api-key-here",
1523
+ temperature=0.0,
1524
+ chat_model_name="gpt-4o-mini",
1525
+ maximum_tokens=1000
1526
+ )
1527
+
1528
+ print(response)
1529
+ ```
1530
+
1444
1531
  ### Predictive Analytics
1445
1532
 
1446
1533
  #### CreateARIMAModel
@@ -172,12 +172,34 @@ def ConductEntityMatching(dataframe_1,
172
172
  # Drop duplicates
173
173
  data_match_results.drop_duplicates(inplace=True)
174
174
 
175
- # Convert to wide-form dataframe
176
- data_match_results = data_match_results.pivot(index=['Entity_1', 'Entity_2'], columns='Match Method', values='Match Score')
177
- # Reset index of dataframe
178
- data_match_results['Entity 1'] = data_match_results.index.get_level_values(0)
179
- data_match_results['Entity 2'] = data_match_results.index.get_level_values(1)
180
- data_match_results.reset_index(drop=True, inplace=True)
175
+ # If there are no matches, create an empty dataframe with the right structure
176
+ if data_match_results.empty:
177
+ # Create a dataframe with all entity combinations
178
+ entity_pairs = entity_combinations[['Entity_1', 'Entity_2']].copy()
179
+
180
+ # Create an empty DataFrame with the correct structure
181
+ data_match_results = pd.DataFrame()
182
+
183
+ # Add entity columns
184
+ data_match_results['Entity 1'] = entity_pairs['Entity_1']
185
+ data_match_results['Entity 2'] = entity_pairs['Entity_2']
186
+
187
+ # Add empty columns for each match method
188
+ for method in match_methods:
189
+ data_match_results[method] = np.nan
190
+ else:
191
+ # Convert to wide-form dataframe
192
+ data_match_results = data_match_results.pivot(index=['Entity_1', 'Entity_2'], columns='Match Method', values='Match Score')
193
+
194
+ # Ensure all specified match methods are present as columns
195
+ for method in match_methods:
196
+ if method not in data_match_results.columns:
197
+ data_match_results[method] = np.nan
198
+
199
+ # Reset index of dataframe
200
+ data_match_results['Entity 1'] = data_match_results.index.get_level_values(0)
201
+ data_match_results['Entity 2'] = data_match_results.index.get_level_values(1)
202
+ data_match_results.reset_index(drop=True, inplace=True)
181
203
 
182
204
  # Move entity columns to front
183
205
  data_match_results = data_match_results[['Entity 1', 'Entity 2'] + [col for col in data_match_results.columns if col not in ['Entity 1', 'Entity 2']]]
@@ -7,7 +7,7 @@ def SendPromptToChatGPT(prompt_template,
7
7
  # LLM parameters
8
8
  openai_api_key=None,
9
9
  temperature=0.0,
10
- chat_model_name="gpt-4-1106-preview",
10
+ chat_model_name='gpt-4o-mini',
11
11
  maximum_tokens=1000,
12
12
  verbose=True):
13
13
  # Lazy load uncommon packages
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: analysistoolbox
3
- Version: 2.1.9
3
+ Version: 2.2.0
4
4
  Summary: A collection tools in Python for data collection and processing, statistics, analytics, and intelligence analysis.
5
5
  Home-page: https://github.com/KyleProtho/AnalysisToolBox/tree/master/analysistoolbox
6
6
  Author: Kyle Protho
@@ -82,6 +82,7 @@ There are many modules in the analysistoolbox package, each with their own funct
82
82
  - [Descriptive Analytics](#descriptive-analytics)
83
83
  - [ConductManifoldLearning](#conductmanifoldlearning)
84
84
  - [ConductPrincipalComponentAnalysis](#conductprincipalcomponentanalysis)
85
+ - [ConductPropensityScoreMatching](#conductpropensityscorematching)
85
86
  - [CreateAssociationRules](#createassociationrules)
86
87
  - [CreateGaussianMixtureClusters](#creategaussianmixtureclusters)
87
88
  - [CreateHierarchicalClusters](#createhierarchicalclusters)
@@ -112,6 +113,9 @@ There are many modules in the analysistoolbox package, each with their own funct
112
113
  - [PlotVectors](#plotvectors)
113
114
  - [SolveSystemOfEquations](#solvesystemofequations)
114
115
  - [VisualizeMatrixAsLinearTransformation](#visualizematrixaslineartransformation)
116
+ - [LLM](#llm)
117
+ - [SendPromptToAnthropic](#sendprompttoanthropic)
118
+ - [SendPromptToChatGPT](#sendprompttochatgpt)
115
119
  - [Predictive Analytics](#predictive-analytics)
116
120
  - [CreateARIMAModel](#createarimamodel)
117
121
  - [CreateBoostedTreeModel](#createboostedtreemodel)
@@ -881,6 +885,29 @@ result = ConductPrincipalComponentAnalysis(
881
885
  )
882
886
  ```
883
887
 
888
+ #### ConductPropensityScoreMatching
889
+
890
+ Conducts propensity score matching to create balanced treatment and control groups for causal inference analysis.
891
+
892
+ ```python
893
+ from analysistoolbox.descriptive_analytics import ConductPropensityScoreMatching
894
+ import pandas as pd
895
+
896
+ # Create matched groups based on age, education, and experience
897
+ matched_df = ConductPropensityScoreMatching(
898
+ dataframe=df,
899
+ subject_id_column_name='employee_id',
900
+ list_of_column_names_to_base_matching=['age', 'education', 'years_experience'],
901
+ grouping_column_name='received_training',
902
+ control_group_name='No',
903
+ max_matches_per_subject=1,
904
+ balance_groups=True,
905
+ propensity_score_column_name="PS_Score",
906
+ matched_id_column_name="Matched_Employee_ID",
907
+ random_seed=412
908
+ )
909
+ ```
910
+
884
911
  #### CreateAssociationRules
885
912
 
886
913
  The **CreateAssociationRules** function creates association rules from a given dataframe. Association rules are widely used in market basket analysis, where the goal is to find associations and/or correlations among a set of items.
@@ -1459,6 +1486,66 @@ VisualizeMatrixAsLinearTransformation(
1459
1486
  )
1460
1487
  ```
1461
1488
 
1489
+ ### LLM
1490
+
1491
+ #### SendPromptToAnthropic
1492
+
1493
+ The **SendPromptToAnthropic** function sends a prompt to Anthropic's Claude API using LangChain. It supports template-based prompting and requires an Anthropic API key.
1494
+
1495
+ ```python
1496
+ from analysistoolbox.llm import SendPromptToAnthropic
1497
+
1498
+ # Define your prompt template with variables in curly braces
1499
+ prompt_template = "Given the text: {text}\nSummarize the main points in bullet form."
1500
+
1501
+ # Create a dictionary with your input variables
1502
+ user_input = {
1503
+ "text": "Your text to analyze goes here..."
1504
+ }
1505
+
1506
+ # Send the prompt to Claude
1507
+ response = SendPromptToAnthropic(
1508
+ prompt_template=prompt_template,
1509
+ user_input=user_input,
1510
+ system_message="You are a helpful assistant.",
1511
+ anthropic_api_key="your-api-key-here",
1512
+ temperature=0.0,
1513
+ chat_model_name="claude-3-opus-20240229",
1514
+ maximum_tokens=1000
1515
+ )
1516
+
1517
+ print(response)
1518
+ ```
1519
+
1520
+ #### SendPromptToChatGPT
1521
+
1522
+ The **SendPromptToChatGPT** function sends a prompt to OpenAI's ChatGPT API using LangChain. It supports template-based prompting and requires an OpenAI API key.
1523
+
1524
+ ```python
1525
+ from analysistoolbox.llm import SendPromptToChatGPT
1526
+
1527
+ # Define your prompt template with variables in curly braces
1528
+ prompt_template = "Analyze the following data: {data}\nProvide key insights."
1529
+
1530
+ # Create a dictionary with your input variables
1531
+ user_input = {
1532
+ "data": "Your data to analyze goes here..."
1533
+ }
1534
+
1535
+ # Send the prompt to ChatGPT
1536
+ response = SendPromptToChatGPT(
1537
+ prompt_template=prompt_template,
1538
+ user_input=user_input,
1539
+ system_message="You are a helpful assistant.",
1540
+ openai_api_key="your-api-key-here",
1541
+ temperature=0.0,
1542
+ chat_model_name="gpt-4o-mini",
1543
+ maximum_tokens=1000
1544
+ )
1545
+
1546
+ print(response)
1547
+ ```
1548
+
1462
1549
  ### Predictive Analytics
1463
1550
 
1464
1551
  #### CreateARIMAModel
@@ -12,7 +12,7 @@ setup(
12
12
  long_description=long_description,
13
13
  long_description_content_type='text/markdown',
14
14
  url="https://github.com/KyleProtho/AnalysisToolBox/tree/master/analysistoolbox",
15
- version='2.1.9',
15
+ version='2.2.0',
16
16
  author='Kyle Protho',
17
17
  author_email='kyletprotho@gmail.com',
18
18
  license='GNU GPLv3',