From b7c80cf212b5382c4f446ff0a3427c095958b676 Mon Sep 17 00:00:00 2001
From: sanyhe
Date: Tue, 27 Feb 2024 17:13:58 +0800
Subject: [PATCH] perf: optimize the functionality of formula showing in linear
model.
---
README.md | 14 +++++++++++++-
.../Data_Preprocessing/Data Preprocessing.md | 2 +-
docs/source/For User/User Docs link.md | 2 +-
docs/source/Home/Introduction.md | 8 +++++++-
.../data_mining/model/func/_common_supervised.py | 12 ++++++++++--
geochemistrypi/data_mining/model/regression.py | 4 ++++
6 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index c6523824..2cc05e2e 100644
--- a/README.md
+++ b/README.md
@@ -46,13 +46,19 @@ The following figure is the frontend-backend separation architecture of Geochemi
-**Cite the work as:**
+**If the software contributes to your research, cite the work as :**
ZhangZhou J\*, He Can\*, Sun Jianhao, Zhao Jianming, Lyu Yang, Wang Shengxin, Zhao Wenyu, Li Anzhou, Ji Xiaohui. Geochemistry π: Automated machine learning python framework for tabular data (2024). Geochemistry, Geophysics,
Geosystems, 25, e2023GC011324
Download link: https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2023GC011324
+**Related report:**
+
+Geochemistry π was selected for featuring as an Editor’s Highlight in EOS magazine by American Geophysical Union (fewer than 2 percent of paper are selected) and quoted in Geochemical NEWS by Geochemical Society.
+
+Eos Website: https://eos.org/editor-highlights/machine-learning-for-geochemists-who-dont-want-to-code.
+
## Quick Installation
One instruction to download on **command line**, such as Terminal on macOS, Power Shell on Windows.
@@ -223,6 +229,12 @@ The following figure is the storage mechanism:
The whole package is under construction and the documentation is progressively evolving.
+## Geochemistry π Mind Map
+
+[→ Click here for more details](https://docs.qq.com/mind/DZkJTYmVHcmFneUli?u=40ac0718eb494b008b2f072197ea95db)
+
+![Geochemistry π.png](https://github.com/ZJUEarthData/geochemistrypi/assets/97781484/3de6ea2b-7ab1-4145-bf4e-225eeabc7987)
+
## Team Info
**Leader:**
diff --git a/docs/source/For User/Model Example/Data_Preprocessing/Data Preprocessing.md b/docs/source/For User/Model Example/Data_Preprocessing/Data Preprocessing.md
index fe4e5326..ef7be7bc 100644
--- a/docs/source/For User/Model Example/Data_Preprocessing/Data Preprocessing.md
+++ b/docs/source/For User/Model Example/Data_Preprocessing/Data Preprocessing.md
@@ -12,7 +12,7 @@ In order to utilize the functions provided by our software, your own data set sh
- be with the suffix **.xlsx**, which is supported by Microsoft Excel.
- be comprise of location information **LATITUDE** and **LONGITUDE**, two columns respectively.
-If you want to run **classification** algorithm, only supporting binary classification currently, you data set should satisfy:
+If you want to run **classification** algorithm, you data set should satisfy:
- Tag column **LABEL** to differentiate the data.
diff --git a/docs/source/For User/User Docs link.md b/docs/source/For User/User Docs link.md
index fcee3723..0ddfb226 100644
--- a/docs/source/For User/User Docs link.md
+++ b/docs/source/For User/User Docs link.md
@@ -1,4 +1,4 @@
-## User Documents Link
+# User Documents Link
### 1. Geochemistry π Project Introduction
diff --git a/docs/source/Home/Introduction.md b/docs/source/Home/Introduction.md
index 68ecb6a2..b5410988 100644
--- a/docs/source/Home/Introduction.md
+++ b/docs/source/Home/Introduction.md
@@ -47,13 +47,19 @@ The following figure is the frontend-backend separation architecture of Geochemi
-**Cite the work as:**
+**If the software contributes to your research, cite the work as :**
ZhangZhou J\*, He Can\*, Sun Jianhao, Zhao Jianming, Lyu Yang, Wang Shengxin, Zhao Wenyu, Li Anzhou, Ji Xiaohui. Geochemistry π: Automated machine learning python framework for tabular data (2024). Geochemistry, Geophysics,
Geosystems, 25, e2023GC011324
Download link: https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2023GC011324
+**Related report:**
+
+Geochemistry π was selected for featuring as an Editor’s Highlight in EOS magazine by American Geophysical Union (fewer than 2 percent of paper are selected) and quoted in Geochemical NEWS by Geochemical Society.
+
+Eos Website: https://eos.org/editor-highlights/machine-learning-for-geochemists-who-dont-want-to-code.
+
## Quick Installation
One instruction to download on **command line**, such as Terminal on macOS, Power Shell on Windows.
diff --git a/geochemistrypi/data_mining/model/func/_common_supervised.py b/geochemistrypi/data_mining/model/func/_common_supervised.py
index 70432a65..dbdfab2f 100644
--- a/geochemistrypi/data_mining/model/func/_common_supervised.py
+++ b/geochemistrypi/data_mining/model/func/_common_supervised.py
@@ -179,7 +179,11 @@ def show_formula(coef: np.ndarray, intercept: np.ndarray, features_name: np.ndar
if regression_classification == "Regression":
if len(y_train.columns) == 1: # Single target
coef = np.around(coef, decimals=3)[0]
- intercept = np.around(intercept, decimals=3)[0]
+ # Check if intercept is a scalar
+ if isinstance(intercept, np.ndarray):
+ intercept = np.around(intercept, decimals=3)[0]
+ else:
+ intercept = np.around(intercept, decimals=3)
terms = [("-" if c < 0 else "+") + " " + str(abs(c)) + f if c != 0 else "" for c, f in zip(coef, features_name)]
terms_first = (terms[0][2:] if coef[0] > 0 else terms[0]).replace(" ", "")
@@ -199,7 +203,11 @@ def show_formula(coef: np.ndarray, intercept: np.ndarray, features_name: np.ndar
elif regression_classification == "Classification":
if coef.shape[0] == 1: # Binary classification
coef = np.around(coef, decimals=3)[0]
- intercept = np.around(intercept, decimals=3)[0]
+ # Check if intercept is a scalar
+ if isinstance(intercept, np.ndarray):
+ intercept = np.around(intercept, decimals=3)[0]
+ else:
+ intercept = np.around(intercept, decimals=3)
terms = [("-" if c < 0 else "+") + " " + str(abs(c)) + f if c != 0 else "" for c, f in zip(coef, features_name)]
terms_first = (terms[0][2:] if coef[0] > 0 else terms[0]).replace(" ", "")
diff --git a/geochemistrypi/data_mining/model/regression.py b/geochemistrypi/data_mining/model/regression.py
index 98f84927..b621bdbd 100644
--- a/geochemistrypi/data_mining/model/regression.py
+++ b/geochemistrypi/data_mining/model/regression.py
@@ -4171,6 +4171,8 @@ def special_components(self, **kwargs) -> None:
coef=[self.model.coef_],
intercept=self.model.intercept_,
features_name=RidgeRegression.X_train.columns,
+ regression_classification="Regression",
+ y_train=RidgeRegression.y,
algorithm_name=self.naming,
local_path=GEOPI_OUTPUT_ARTIFACTS_PATH,
mlflow_path="root",
@@ -4250,6 +4252,8 @@ def special_components(self, is_automl: bool, **kwargs) -> None:
coef=[self.auto_model.coef_],
intercept=self.auto_model.intercept_,
features_name=RidgeRegression.X_train.columns,
+ regression_classification="Regression",
+ y_train=RidgeRegression.y,
algorithm_name=self.naming,
local_path=GEOPI_OUTPUT_ARTIFACTS_PATH,
mlflow_path="root",