Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: optimize the functionality of formula showing in linear model. #313

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ The following figure is the frontend-backend separation architecture of Geochemi
</p>


**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.
Expand Down Expand Up @@ -223,6 +229,12 @@ The following figure is the storage mechanism: <br>

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:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/For User/User Docs link.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## User Documents Link
# User Documents Link

### 1. Geochemistry π Project Introduction

Expand Down
8 changes: 7 additions & 1 deletion docs/source/Home/Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ The following figure is the frontend-backend separation architecture of Geochemi
</p>


**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.
Expand Down
12 changes: 10 additions & 2 deletions geochemistrypi/data_mining/model/func/_common_supervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ", "")
Expand All @@ -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(" ", "")
Expand Down
4 changes: 4 additions & 0 deletions geochemistrypi/data_mining/model/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Loading