febolt 0.1.57__tar.gz → 0.1.58__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -362,7 +362,7 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
362
362
 
363
363
  [[package]]
364
364
  name = "febolt"
365
- version = "0.1.57"
365
+ version = "0.1.58"
366
366
  dependencies = [
367
367
  "blas",
368
368
  "intel-mkl-src",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "febolt"
3
- version = "0.1.57"
3
+ version = "0.1.58"
4
4
  edition = "2021"
5
5
  description = "Statistics library for Python powered by Rust"
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: febolt
3
- Version: 0.1.57
3
+ Version: 0.1.58
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "febolt"
7
- version = "0.1.57"
7
+ version = "0.1.58"
8
8
  requires-python = ">=3.8"
9
9
  description = "A Rust-based Statistics and ML package, callable from Python."
10
10
  keywords = ["rust", "python", "Machine Learning", "Statistics", "pyo3"]
@@ -92,13 +92,23 @@ fn ame<'py>(
92
92
  // 1) detect Logit vs Probit
93
93
  let is_logit = detect_model_type(model)?;
94
94
 
95
- // 2) read params
96
- let params_pyarray: &PyArray1<f64> = model.getattr("params")?.downcast()?;
97
- let beta = unsafe { params_pyarray.as_array() }; // shape(k)
98
-
99
- // 3) read cov
100
- let cov_pyarray: &PyArray2<f64> = model.call_method0("cov_params")?.downcast()?;
101
- let cov_beta = unsafe { cov_pyarray.as_array() }; // shape(k,k)
95
+ // 2) read params (handle pandas Series)
96
+ let params_obj = model.getattr("params")?;
97
+ let params_pyarray = if let Ok(values) = params_obj.getattr("values") {
98
+ values.downcast::<PyArray1<f64>>()?
99
+ } else {
100
+ params_obj.downcast::<PyArray1<f64>>()?
101
+ };
102
+ let beta = unsafe { params_pyarray.as_array() };
103
+
104
+ // 3) read cov (handle pandas DataFrame)
105
+ let cov_obj = model.call_method0("cov_params")?;
106
+ let cov_pyarray = if let Ok(values) = cov_obj.getattr("values") {
107
+ values.downcast::<PyArray2<f64>>()?
108
+ } else {
109
+ cov_obj.downcast::<PyArray2<f64>>()?
110
+ };
111
+ let cov_beta = unsafe { cov_pyarray.as_array() };
102
112
 
103
113
  // 4) Get model object and handle exog (X) and exog_names
104
114
  let model_obj = model.getattr("model").unwrap_or(model);
File without changes
File without changes
File without changes