ravix 0.1.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.
- ravix-0.1.0/LICENSE +21 -0
- ravix-0.1.0/MANIFEST.in +9 -0
- ravix-0.1.0/PKG-INFO +176 -0
- ravix-0.1.0/README.md +148 -0
- ravix-0.1.0/pyproject.toml +53 -0
- ravix-0.1.0/ravix/__init__.py +65 -0
- ravix-0.1.0/ravix/_internal/__init__.py +6 -0
- ravix-0.1.0/ravix/_internal/helpers.py +86 -0
- ravix-0.1.0/ravix/_version.py +2 -0
- ravix-0.1.0/ravix/data/Airbnb.csv +10371 -0
- ravix-0.1.0/ravix/data/Betas.csv +37 -0
- ravix-0.1.0/ravix/data/Charges.csv +1001 -0
- ravix-0.1.0/ravix/data/CustomersInsurance.csv +85 -0
- ravix-0.1.0/ravix/data/Employment.csv +22 -0
- ravix-0.1.0/ravix/data/HR_retention.csv +101 -0
- ravix-0.1.0/ravix/data/HousePrices.csv +151 -0
- ravix-0.1.0/ravix/data/JobChanges.csv +101 -0
- ravix-0.1.0/ravix/data/LoanDefault.csv +1241 -0
- ravix-0.1.0/ravix/data/MarketingToys.csv +1001 -0
- ravix-0.1.0/ravix/data/PriceSize.csv +501 -0
- ravix-0.1.0/ravix/data/Sales.csv +143 -0
- ravix-0.1.0/ravix/data/SalesAds.csv +366 -0
- ravix-0.1.0/ravix/data/TireSales.csv +501 -0
- ravix-0.1.0/ravix/data/Top200.csv +201 -0
- ravix-0.1.0/ravix/data/Twitter.csv +498 -0
- ravix-0.1.0/ravix/data/Vacation.csv +201 -0
- ravix-0.1.0/ravix/data/Youtube.csv +158 -0
- ravix-0.1.0/ravix/data/__init__.py +0 -0
- ravix-0.1.0/ravix/data/salary_churn.csv +501 -0
- ravix-0.1.0/ravix/diagnostics/__init__.py +17 -0
- ravix-0.1.0/ravix/diagnostics/multicollinearity.py +129 -0
- ravix-0.1.0/ravix/diagnostics/normality.py +107 -0
- ravix-0.1.0/ravix/diagnostics/variance.py +190 -0
- ravix-0.1.0/ravix/modeling/__init__.py +28 -0
- ravix-0.1.0/ravix/modeling/bsr.py +148 -0
- ravix-0.1.0/ravix/modeling/environment.py +20 -0
- ravix-0.1.0/ravix/modeling/fit.py +428 -0
- ravix-0.1.0/ravix/modeling/format_utils.py +66 -0
- ravix-0.1.0/ravix/modeling/intervals.py +142 -0
- ravix-0.1.0/ravix/modeling/parse_formula.py +628 -0
- ravix-0.1.0/ravix/modeling/predict.py +67 -0
- ravix-0.1.0/ravix/modeling/print_anova_table.py +145 -0
- ravix-0.1.0/ravix/modeling/stepwise.py +251 -0
- ravix-0.1.0/ravix/modeling/summary.py +745 -0
- ravix-0.1.0/ravix/modeling/xy_split.py +47 -0
- ravix-0.1.0/ravix/plots/__init__.py +66 -0
- ravix-0.1.0/ravix/plots/_utils.py +205 -0
- ravix-0.1.0/ravix/plots/abline.py +64 -0
- ravix-0.1.0/ravix/plots/barplot.py +366 -0
- ravix-0.1.0/ravix/plots/boxplot.py +214 -0
- ravix-0.1.0/ravix/plots/hist.py +603 -0
- ravix-0.1.0/ravix/plots/plot.py +802 -0
- ravix-0.1.0/ravix/plots/plot_bsr.py +353 -0
- ravix-0.1.0/ravix/plots/plot_cook.py +74 -0
- ravix-0.1.0/ravix/plots/plot_cor.py +376 -0
- ravix-0.1.0/ravix/plots/plot_intervals.py +251 -0
- ravix-0.1.0/ravix/plots/qq.py +613 -0
- ravix-0.1.0/ravix/plots/viz.py +79 -0
- ravix-0.1.0/ravix/transforms/__init__.py +12 -0
- ravix-0.1.0/ravix/transforms/box_cox.py +157 -0
- ravix-0.1.0/ravix.egg-info/PKG-INFO +176 -0
- ravix-0.1.0/ravix.egg-info/SOURCES.txt +66 -0
- ravix-0.1.0/ravix.egg-info/dependency_links.txt +1 -0
- ravix-0.1.0/ravix.egg-info/requires.txt +4 -0
- ravix-0.1.0/ravix.egg-info/top_level.txt +3 -0
- ravix-0.1.0/requirements.txt +6 -0
- ravix-0.1.0/setup.cfg +31 -0
ravix-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel McGibney
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ravix-0.1.0/MANIFEST.in
ADDED
ravix-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ravix
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Applied regression modeling and visualization for business analytics
|
|
5
|
+
Home-page: https://github.com/danmcgib/ravix
|
|
6
|
+
Author: Daniel McGibney
|
|
7
|
+
Author-email: dmcgibney@bus.miami.edu
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/danielmcgibney/ravix
|
|
10
|
+
Project-URL: Source, https://github.com/danielmcgibney/ravix
|
|
11
|
+
Project-URL: Issues, https://github.com/danielmcgibney/ravix/issues
|
|
12
|
+
Keywords: regression,ols,logistic regression,business analytics,statistics,education,formula
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Intended Audience :: Education
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: numpy>=1.20
|
|
24
|
+
Requires-Dist: pandas>=1.4
|
|
25
|
+
Requires-Dist: statsmodels>=0.13
|
|
26
|
+
Requires-Dist: matplotlib>=3.5
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# Ravix
|
|
30
|
+
|
|
31
|
+
Ravix is a Python package for regression analysis and data visualization. It provides tools for model fitting, prediction, and various types of plots to help visualize your data particularly for regression analysis.
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- Model fitting and prediction with convenient formula notation
|
|
36
|
+
- Streamlined code for plotting (boxplot, histogram, scatter plot, etc.)
|
|
37
|
+
- Regression analysis diagnostic tools
|
|
38
|
+
- Integration with popular libraries like `pandas` and `statsmodels`
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
You can install the package using `pip`:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
pip install ravix
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
Here are some examples of how to use the key functions in the package.
|
|
51
|
+
|
|
52
|
+
### Importing the Package
|
|
53
|
+
|
|
54
|
+
To use the functions provided by the package, import it as follows:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import ravix
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Getting Data
|
|
61
|
+
|
|
62
|
+
There are multiple datasets available from Ravix and are easily attained using the `get_data` function. The datasets currently available are:
|
|
63
|
+
|
|
64
|
+
* AirBnb.csv
|
|
65
|
+
* Betas.csv
|
|
66
|
+
* Charges.csv
|
|
67
|
+
* Employment.csv
|
|
68
|
+
* HousePrices.csv
|
|
69
|
+
* HR_retention.csv
|
|
70
|
+
* MarketingToys.csv
|
|
71
|
+
* Sales.csv
|
|
72
|
+
* Top200.csv
|
|
73
|
+
* Twitter.csv
|
|
74
|
+
* Youtube.csv
|
|
75
|
+
|
|
76
|
+
See [Applied Linear Regression for Business Analytics with Python](www.businessregression.com) for details regarding these datasets. Sample import example:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
import ravix
|
|
80
|
+
|
|
81
|
+
# Load data from ravix
|
|
82
|
+
df = ravix.get_data("Betas.csv")
|
|
83
|
+
|
|
84
|
+
# Format the data (for later)
|
|
85
|
+
df.drop(columns = df.columns[0], inplace=True)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Model Fitting and Prediction
|
|
89
|
+
|
|
90
|
+
Ravix formula supports formula functionality similar to R. Fit a model with a formula:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
# Fit model with formula
|
|
94
|
+
model = ravix.ols("SPY ~ .", df)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Summary types are specified using the `out` argument. Different summaries are available including:
|
|
98
|
+
|
|
99
|
+
* simple (default)
|
|
100
|
+
* statsmodels
|
|
101
|
+
* R
|
|
102
|
+
* ANOVA
|
|
103
|
+
* coefficients (coef)
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
# Generate a model summary
|
|
107
|
+
ravix.summary(model)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Making Predictions
|
|
111
|
+
|
|
112
|
+
A Statsmodels object is created by default. From this object, the predict function can be used. Since `df` is the dataframe used to fit the model, the following lines produce the same result.
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
# Make predictions
|
|
116
|
+
ravix.predict(model, df)
|
|
117
|
+
|
|
118
|
+
# Produce fitted values
|
|
119
|
+
ravix.predict(model)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### General Plotting
|
|
123
|
+
|
|
124
|
+
Plotting code is streamlined and built on top of Seaborn and MatPlotLib. Samples provided below.
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
# Generate a boxplot
|
|
128
|
+
ravix.boxplot("SPY ~ .", df)
|
|
129
|
+
|
|
130
|
+
# Generate a histogram
|
|
131
|
+
ravix.hist(df.SPY)
|
|
132
|
+
|
|
133
|
+
# Multiple histograms
|
|
134
|
+
ravix.hists("SPY ~ .",data = df)
|
|
135
|
+
|
|
136
|
+
# Scatter plot
|
|
137
|
+
ravix.plot("MSFT ~ SPY", data = df)
|
|
138
|
+
|
|
139
|
+
# Multiple Scatter plots
|
|
140
|
+
ravix.plot("SPY ~ .", data = df)
|
|
141
|
+
|
|
142
|
+
# Correlation Plot
|
|
143
|
+
ravix.plot_cor(df)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Required Fixes
|
|
147
|
+
|
|
148
|
+
Based on current testing, the following fixes are required:
|
|
149
|
+
|
|
150
|
+
1. Ensure global scope accessibility for variables.
|
|
151
|
+
2. Adjust summary spacing.
|
|
152
|
+
3. Provide compatibility with `scikit-learn`.
|
|
153
|
+
4. Implement AI-generated summaries.
|
|
154
|
+
5. Allow for additional plotting customization (using kwargs).
|
|
155
|
+
6. Review and improve diagnostic plots.
|
|
156
|
+
7. Provide support for logistic regression and other GLMs.
|
|
157
|
+
8. Provide support for automatic dummy variable retrieval.
|
|
158
|
+
9. Plots should work without formulas.
|
|
159
|
+
|
|
160
|
+
## Contributing
|
|
161
|
+
|
|
162
|
+
We welcome contributions to Ravix! If you find a bug or have a feature request, please open an issue on [GitHub](https://github.com/danmcgib/ravix). You can also contribute by:
|
|
163
|
+
|
|
164
|
+
1. Forking the repository
|
|
165
|
+
2. Creating a new branch (`git checkout -b feature-branch`)
|
|
166
|
+
3. Committing your changes (`git commit -am 'Add some feature'`)
|
|
167
|
+
4. Pushing to the branch (`git push origin feature-branch`)
|
|
168
|
+
5. Creating a pull request
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
173
|
+
|
|
174
|
+
## Acknowledgements
|
|
175
|
+
|
|
176
|
+
We would like to thank all contributors and users of Ravix for their support and feedback.
|
ravix-0.1.0/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Ravix
|
|
2
|
+
|
|
3
|
+
Ravix is a Python package for regression analysis and data visualization. It provides tools for model fitting, prediction, and various types of plots to help visualize your data particularly for regression analysis.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Model fitting and prediction with convenient formula notation
|
|
8
|
+
- Streamlined code for plotting (boxplot, histogram, scatter plot, etc.)
|
|
9
|
+
- Regression analysis diagnostic tools
|
|
10
|
+
- Integration with popular libraries like `pandas` and `statsmodels`
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
You can install the package using `pip`:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
pip install ravix
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Here are some examples of how to use the key functions in the package.
|
|
23
|
+
|
|
24
|
+
### Importing the Package
|
|
25
|
+
|
|
26
|
+
To use the functions provided by the package, import it as follows:
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
import ravix
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Getting Data
|
|
33
|
+
|
|
34
|
+
There are multiple datasets available from Ravix and are easily attained using the `get_data` function. The datasets currently available are:
|
|
35
|
+
|
|
36
|
+
* AirBnb.csv
|
|
37
|
+
* Betas.csv
|
|
38
|
+
* Charges.csv
|
|
39
|
+
* Employment.csv
|
|
40
|
+
* HousePrices.csv
|
|
41
|
+
* HR_retention.csv
|
|
42
|
+
* MarketingToys.csv
|
|
43
|
+
* Sales.csv
|
|
44
|
+
* Top200.csv
|
|
45
|
+
* Twitter.csv
|
|
46
|
+
* Youtube.csv
|
|
47
|
+
|
|
48
|
+
See [Applied Linear Regression for Business Analytics with Python](www.businessregression.com) for details regarding these datasets. Sample import example:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import ravix
|
|
52
|
+
|
|
53
|
+
# Load data from ravix
|
|
54
|
+
df = ravix.get_data("Betas.csv")
|
|
55
|
+
|
|
56
|
+
# Format the data (for later)
|
|
57
|
+
df.drop(columns = df.columns[0], inplace=True)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Model Fitting and Prediction
|
|
61
|
+
|
|
62
|
+
Ravix formula supports formula functionality similar to R. Fit a model with a formula:
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
# Fit model with formula
|
|
66
|
+
model = ravix.ols("SPY ~ .", df)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Summary types are specified using the `out` argument. Different summaries are available including:
|
|
70
|
+
|
|
71
|
+
* simple (default)
|
|
72
|
+
* statsmodels
|
|
73
|
+
* R
|
|
74
|
+
* ANOVA
|
|
75
|
+
* coefficients (coef)
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
# Generate a model summary
|
|
79
|
+
ravix.summary(model)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Making Predictions
|
|
83
|
+
|
|
84
|
+
A Statsmodels object is created by default. From this object, the predict function can be used. Since `df` is the dataframe used to fit the model, the following lines produce the same result.
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
# Make predictions
|
|
88
|
+
ravix.predict(model, df)
|
|
89
|
+
|
|
90
|
+
# Produce fitted values
|
|
91
|
+
ravix.predict(model)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### General Plotting
|
|
95
|
+
|
|
96
|
+
Plotting code is streamlined and built on top of Seaborn and MatPlotLib. Samples provided below.
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
# Generate a boxplot
|
|
100
|
+
ravix.boxplot("SPY ~ .", df)
|
|
101
|
+
|
|
102
|
+
# Generate a histogram
|
|
103
|
+
ravix.hist(df.SPY)
|
|
104
|
+
|
|
105
|
+
# Multiple histograms
|
|
106
|
+
ravix.hists("SPY ~ .",data = df)
|
|
107
|
+
|
|
108
|
+
# Scatter plot
|
|
109
|
+
ravix.plot("MSFT ~ SPY", data = df)
|
|
110
|
+
|
|
111
|
+
# Multiple Scatter plots
|
|
112
|
+
ravix.plot("SPY ~ .", data = df)
|
|
113
|
+
|
|
114
|
+
# Correlation Plot
|
|
115
|
+
ravix.plot_cor(df)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Required Fixes
|
|
119
|
+
|
|
120
|
+
Based on current testing, the following fixes are required:
|
|
121
|
+
|
|
122
|
+
1. Ensure global scope accessibility for variables.
|
|
123
|
+
2. Adjust summary spacing.
|
|
124
|
+
3. Provide compatibility with `scikit-learn`.
|
|
125
|
+
4. Implement AI-generated summaries.
|
|
126
|
+
5. Allow for additional plotting customization (using kwargs).
|
|
127
|
+
6. Review and improve diagnostic plots.
|
|
128
|
+
7. Provide support for logistic regression and other GLMs.
|
|
129
|
+
8. Provide support for automatic dummy variable retrieval.
|
|
130
|
+
9. Plots should work without formulas.
|
|
131
|
+
|
|
132
|
+
## Contributing
|
|
133
|
+
|
|
134
|
+
We welcome contributions to Ravix! If you find a bug or have a feature request, please open an issue on [GitHub](https://github.com/danmcgib/ravix). You can also contribute by:
|
|
135
|
+
|
|
136
|
+
1. Forking the repository
|
|
137
|
+
2. Creating a new branch (`git checkout -b feature-branch`)
|
|
138
|
+
3. Committing your changes (`git commit -am 'Add some feature'`)
|
|
139
|
+
4. Pushing to the branch (`git push origin feature-branch`)
|
|
140
|
+
5. Creating a pull request
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
145
|
+
|
|
146
|
+
## Acknowledgements
|
|
147
|
+
|
|
148
|
+
We would like to thank all contributors and users of Ravix for their support and feedback.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ravix"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Applied regression modeling and visualization for business analytics"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Daniel McGibney" }
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
keywords = [
|
|
18
|
+
"regression",
|
|
19
|
+
"ols",
|
|
20
|
+
"logistic regression",
|
|
21
|
+
"business analytics",
|
|
22
|
+
"statistics",
|
|
23
|
+
"education",
|
|
24
|
+
"formula"
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
dependencies = [
|
|
28
|
+
"numpy>=1.20",
|
|
29
|
+
"pandas>=1.4",
|
|
30
|
+
"statsmodels>=0.13",
|
|
31
|
+
"matplotlib>=3.5"
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
classifiers = [
|
|
35
|
+
"Programming Language :: Python :: 3",
|
|
36
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
37
|
+
"License :: OSI Approved :: MIT License",
|
|
38
|
+
"Intended Audience :: Education",
|
|
39
|
+
"Intended Audience :: Science/Research",
|
|
40
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
41
|
+
"Topic :: Scientific/Engineering :: Information Analysis"
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/danielmcgibney/ravix"
|
|
46
|
+
Source = "https://github.com/danielmcgibney/ravix"
|
|
47
|
+
Issues = "https://github.com/danielmcgibney/ravix/issues"
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.packages.find]
|
|
50
|
+
where = ["."]
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.package-data]
|
|
53
|
+
ravix = ["data/*.csv"]
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from ._version import __version__
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Ravix Package
|
|
5
|
+
================
|
|
6
|
+
Applied modeling and visualization for business analytics
|
|
7
|
+
|
|
8
|
+
Root exports are intentionally kept small and user-facing:
|
|
9
|
+
- Modeling: OLS, logistic, and Poisson regression with summary, prediction, and interval utilities
|
|
10
|
+
- Plots: high-level plotting functions
|
|
11
|
+
- Utils: get_data
|
|
12
|
+
|
|
13
|
+
Advanced/internal helpers remain available under submodules:
|
|
14
|
+
- ravix.modeling (e.g., format_summary, significance_code, print_* helpers, EvalEnvironment)
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
# --- Modeling (public surface) ---
|
|
18
|
+
from .modeling import (
|
|
19
|
+
bsr, fit, ols, logistic, poisson,
|
|
20
|
+
intervals, predict,
|
|
21
|
+
stepwise, summary, xy_split
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# --- Plots (public surface) ---
|
|
25
|
+
from .plots import (
|
|
26
|
+
barplot, boxplot, abline, hist, plot_bsr, plot_cor, plot_cook,
|
|
27
|
+
plot, plot_intervals, qq, viz
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# --- Diagnostics (numeric tests only) ---
|
|
31
|
+
from .diagnostics import (
|
|
32
|
+
ncv,
|
|
33
|
+
bp,
|
|
34
|
+
shapiro,
|
|
35
|
+
vif,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
# --- Transforms (data-modifying utilities) ---
|
|
39
|
+
from .transforms import (
|
|
40
|
+
box_cox,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# --- Helpers
|
|
45
|
+
from ._internal.helpers import get_data
|
|
46
|
+
|
|
47
|
+
__all__ = [
|
|
48
|
+
# Version
|
|
49
|
+
"__version__",
|
|
50
|
+
|
|
51
|
+
# Modeling (public)
|
|
52
|
+
"bp", "bsr", "fit", "ols", "logistic", "poisson",
|
|
53
|
+
"intervals", "ncv", "predict",
|
|
54
|
+
"shapiro", "stepwise", "summary", "vif", "xy_split",
|
|
55
|
+
|
|
56
|
+
# Transforms (public)
|
|
57
|
+
"box_cox",
|
|
58
|
+
|
|
59
|
+
# Plots (public)
|
|
60
|
+
"barplot", "boxplot", "abline", "hist", "plot_bsr", "plot_cor", "plot_cook",
|
|
61
|
+
"plot", "plot_intervals", "qq", "viz",
|
|
62
|
+
|
|
63
|
+
# Helpers
|
|
64
|
+
"get_data"
|
|
65
|
+
]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from importlib import resources
|
|
2
|
+
import pandas as pd
|
|
3
|
+
import warnings
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
def get_data(filename=None):
|
|
7
|
+
"""
|
|
8
|
+
Load data from the package's data directory.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
# -------------------------------
|
|
12
|
+
# LIST FILES
|
|
13
|
+
# -------------------------------
|
|
14
|
+
if filename is None:
|
|
15
|
+
try:
|
|
16
|
+
data_dir = resources.files('ravix').joinpath('data')
|
|
17
|
+
|
|
18
|
+
if data_dir.is_dir():
|
|
19
|
+
# Use Traversable API
|
|
20
|
+
files = [
|
|
21
|
+
f.name for f in data_dir.iterdir()
|
|
22
|
+
if f.is_file()
|
|
23
|
+
and not f.name.startswith('.')
|
|
24
|
+
and f.name != '__init__.py'
|
|
25
|
+
and not f.name.endswith('.pyc')
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
files = sorted(files)
|
|
29
|
+
|
|
30
|
+
if files:
|
|
31
|
+
print("Available data files in ravix:")
|
|
32
|
+
for f in files:
|
|
33
|
+
print(f" - {f}")
|
|
34
|
+
else:
|
|
35
|
+
print("No data files found in ravix package.")
|
|
36
|
+
|
|
37
|
+
return None
|
|
38
|
+
else:
|
|
39
|
+
print("No data directory found in ravix package.")
|
|
40
|
+
return []
|
|
41
|
+
|
|
42
|
+
except Exception as e:
|
|
43
|
+
warnings.warn(f"Could not list package data files: {e}", UserWarning)
|
|
44
|
+
return []
|
|
45
|
+
|
|
46
|
+
# -------------------------------
|
|
47
|
+
# LOAD FROM PACKAGE
|
|
48
|
+
# -------------------------------
|
|
49
|
+
try:
|
|
50
|
+
csv_path = resources.files('ravix').joinpath('data', filename)
|
|
51
|
+
|
|
52
|
+
if csv_path.is_file():
|
|
53
|
+
with csv_path.open('rb') as f:
|
|
54
|
+
return pd.read_csv(f)
|
|
55
|
+
|
|
56
|
+
except Exception:
|
|
57
|
+
pass
|
|
58
|
+
|
|
59
|
+
# -------------------------------
|
|
60
|
+
# FALLBACK TO FILESYSTEM
|
|
61
|
+
# -------------------------------
|
|
62
|
+
if os.path.exists(filename):
|
|
63
|
+
warnings.warn(
|
|
64
|
+
f"Loading '{filename}' from filesystem. "
|
|
65
|
+
f"get_data() is intended for package data files. "
|
|
66
|
+
f"For external files, please use pd.read_csv() directly.",
|
|
67
|
+
UserWarning,
|
|
68
|
+
stacklevel=2
|
|
69
|
+
)
|
|
70
|
+
return pd.read_csv(filename)
|
|
71
|
+
|
|
72
|
+
# -------------------------------
|
|
73
|
+
# FILE NOT FOUND
|
|
74
|
+
# -------------------------------
|
|
75
|
+
available_files = get_data() # List files for message
|
|
76
|
+
|
|
77
|
+
if available_files:
|
|
78
|
+
raise FileNotFoundError(
|
|
79
|
+
f"'{filename}' not found in package data directory or filesystem.\n"
|
|
80
|
+
f"See above for available package data files."
|
|
81
|
+
)
|
|
82
|
+
else:
|
|
83
|
+
raise FileNotFoundError(
|
|
84
|
+
f"'{filename}' not found in package data directory or filesystem. "
|
|
85
|
+
f"Use get_data() for package data files or pd.read_csv() for external files."
|
|
86
|
+
)
|