sciml 0.0.4__py3-none-any.whl → 0.0.6__py3-none-any.whl
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.
- sciml/pipelines.py +16 -9
- {sciml-0.0.4.dist-info → sciml-0.0.6.dist-info}/METADATA +13 -14
- sciml-0.0.6.dist-info/RECORD +8 -0
- {sciml-0.0.4.dist-info → sciml-0.0.6.dist-info}/WHEEL +1 -1
- sciml-0.0.4.dist-info/RECORD +0 -8
- {sciml-0.0.4.dist-info → sciml-0.0.6.dist-info}/LICENSE +0 -0
- {sciml-0.0.4.dist-info → sciml-0.0.6.dist-info}/top_level.txt +0 -0
    
        sciml/pipelines.py
    CHANGED
    
    | @@ -1,8 +1,12 @@ | |
| 1 1 | 
             
            import numpy as np
         | 
| 2 | 
            +
            import pandas as pd
         | 
| 2 3 | 
             
            from scipy import stats
         | 
| 3 4 | 
             
            from sklearn.metrics import mean_squared_error
         | 
| 4 5 |  | 
| 5 6 | 
             
            def get_metrics(df, truth = 'truth', pred = 'pred', return_dict = False):
         | 
| 7 | 
            +
                '''
         | 
| 8 | 
            +
                Calculate statistical measures between validation and prediction sequences
         | 
| 9 | 
            +
                '''
         | 
| 6 10 | 
             
                df = df[[truth, pred]].copy().dropna()
         | 
| 7 11 | 
             
                slope, intercept, r_value, p_value, std_err = stats.linregress(df.dropna()[truth], df.dropna()[pred])
         | 
| 8 12 | 
             
                r2 = r_value**2
         | 
| @@ -11,7 +15,7 @@ def get_metrics(df, truth = 'truth', pred = 'pred', return_dict = False): | |
| 11 15 | 
             
                mbe = np.mean(df.dropna()[pred] - df.dropna()[truth])
         | 
| 12 16 | 
             
                mae = (df.dropna()[pred] - df.dropna()[truth]).abs().mean()
         | 
| 13 17 | 
             
                if return_dict:
         | 
| 14 | 
            -
                    return {
         | 
| 18 | 
            +
                    return pd.DataFrame.from_dict([{
         | 
| 15 19 | 
             
                        'R2': r2, 
         | 
| 16 20 | 
             
                        'Slope': slope, 
         | 
| 17 21 | 
             
                        'RMSE': rmse, 
         | 
| @@ -20,7 +24,7 @@ def get_metrics(df, truth = 'truth', pred = 'pred', return_dict = False): | |
| 20 24 | 
             
                        'Intercept': intercept, 
         | 
| 21 25 | 
             
                        'p-value': p_value, 
         | 
| 22 26 | 
             
                        'std_err': std_err
         | 
| 23 | 
            -
                    }
         | 
| 27 | 
            +
                    }])
         | 
| 24 28 | 
             
                else:
         | 
| 25 29 | 
             
                    return r2, slope, rmse, mbe, mae, intercept, p_value, std_err
         | 
| 26 30 |  | 
| @@ -108,19 +112,22 @@ def train_ml( | |
| 108 112 |  | 
| 109 113 | 
             
            def test_ml(X_test, y_test, regr):
         | 
| 110 114 | 
             
                res = y_test.copy() # y_test is 2D pandas dataframe.
         | 
| 111 | 
            -
                res.columns = [' | 
| 115 | 
            +
                res.columns = ['truth']
         | 
| 112 116 | 
             
                res['pred'] = regr.predict(X_test)
         | 
| 113 117 | 
             
                return res
         | 
| 114 118 |  | 
| 115 119 | 
             
            # ===============================================================================================================================
         | 
| 116 120 | 
             
            # Deep learning neural networks
         | 
| 117 121 |  | 
| 118 | 
            -
             | 
| 119 | 
            -
            from tensorflow | 
| 120 | 
            -
            from tensorflow.keras import  | 
| 121 | 
            -
             | 
| 122 | 
            -
            from keras. | 
| 123 | 
            -
            from  | 
| 122 | 
            +
            try:
         | 
| 123 | 
            +
                from tensorflow import keras
         | 
| 124 | 
            +
                from tensorflow.keras import layers
         | 
| 125 | 
            +
                from tensorflow.keras import models
         | 
| 126 | 
            +
                # from keras.layers import Dropout
         | 
| 127 | 
            +
                from keras.callbacks import EarlyStopping
         | 
| 128 | 
            +
                from scitbx.stutils import *
         | 
| 129 | 
            +
            except Exception as e:
         | 
| 130 | 
            +
                print(e)
         | 
| 124 131 |  | 
| 125 132 | 
             
            def train_lstm(X_train, y_train, nfeature, ntime, verbose = 2, epochs = 200, batch_size = 64):
         | 
| 126 133 | 
             
                # create and fit the LSTM network
         | 
| @@ -1,14 +1,13 @@ | |
| 1 | 
            -
            Metadata-Version: 2.1
         | 
| 2 | 
            -
            Name: sciml
         | 
| 3 | 
            -
            Version: 0.0. | 
| 4 | 
            -
            Summary: draw and basic calculations/conversions
         | 
| 5 | 
            -
            Home-page: https://github.com/soonyenju/sciml
         | 
| 6 | 
            -
            Author: Songyan Zhu
         | 
| 7 | 
            -
            Author-email: zhusy93@gmail.com
         | 
| 8 | 
            -
            License: MIT Licence
         | 
| 9 | 
            -
            Keywords: Scientific machine learning wrappers
         | 
| 10 | 
            -
            Platform: any
         | 
| 11 | 
            -
            License-File: LICENSE
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            coming soon
         | 
| 14 | 
            -
             | 
| 1 | 
            +
            Metadata-Version: 2.1
         | 
| 2 | 
            +
            Name: sciml
         | 
| 3 | 
            +
            Version: 0.0.6
         | 
| 4 | 
            +
            Summary: draw and basic calculations/conversions
         | 
| 5 | 
            +
            Home-page: https://github.com/soonyenju/sciml
         | 
| 6 | 
            +
            Author: Songyan Zhu
         | 
| 7 | 
            +
            Author-email: zhusy93@gmail.com
         | 
| 8 | 
            +
            License: MIT Licence
         | 
| 9 | 
            +
            Keywords: Scientific machine learning wrappers
         | 
| 10 | 
            +
            Platform: any
         | 
| 11 | 
            +
            License-File: LICENSE
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            coming soon
         | 
| @@ -0,0 +1,8 @@ | |
| 1 | 
            +
            sciml/__init__.py,sha256=9Yj8J5bW79Kb3JvoOG8k-AmMv-M5Mn8KLmf-wArsJdo,49
         | 
| 2 | 
            +
            sciml/pipelines.py,sha256=lAGtLwp6JKO6aBUZ0ka8VrA013QVDRmAlHG9dQnxY88,5424
         | 
| 3 | 
            +
            sciml/utils.py,sha256=qCdABaTUu3K0R269jI7D_8SO6AqEjphg03CzdxCJR2k,1876
         | 
| 4 | 
            +
            sciml-0.0.6.dist-info/LICENSE,sha256=hcunSTJmVgRcUNOa1rKl8axtY3Jsy2B4wXDYtQsrAt0,1081
         | 
| 5 | 
            +
            sciml-0.0.6.dist-info/METADATA,sha256=PHJ68gGZvR-leW-QCRW_-ZsnHNycM1Kvd4MA_YJKtsU,326
         | 
| 6 | 
            +
            sciml-0.0.6.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
         | 
| 7 | 
            +
            sciml-0.0.6.dist-info/top_level.txt,sha256=dS_7aBCZFKQE3myPy5sh4USjQZCZyGg382-YxUUYcdw,6
         | 
| 8 | 
            +
            sciml-0.0.6.dist-info/RECORD,,
         | 
    
        sciml-0.0.4.dist-info/RECORD
    DELETED
    
    | @@ -1,8 +0,0 @@ | |
| 1 | 
            -
            sciml/__init__.py,sha256=9Yj8J5bW79Kb3JvoOG8k-AmMv-M5Mn8KLmf-wArsJdo,49
         | 
| 2 | 
            -
            sciml/pipelines.py,sha256=pi8bNCNSHqe7JVErSsT8l5qnpggeGj1HuhfdWCh9t18,5210
         | 
| 3 | 
            -
            sciml/utils.py,sha256=qCdABaTUu3K0R269jI7D_8SO6AqEjphg03CzdxCJR2k,1876
         | 
| 4 | 
            -
            sciml-0.0.4.dist-info/LICENSE,sha256=hcunSTJmVgRcUNOa1rKl8axtY3Jsy2B4wXDYtQsrAt0,1081
         | 
| 5 | 
            -
            sciml-0.0.4.dist-info/METADATA,sha256=mhvizQNbQxKzI1LSlvzIoAeo_cTAhp5Ti0fpAWlwY6k,314
         | 
| 6 | 
            -
            sciml-0.0.4.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
         | 
| 7 | 
            -
            sciml-0.0.4.dist-info/top_level.txt,sha256=dS_7aBCZFKQE3myPy5sh4USjQZCZyGg382-YxUUYcdw,6
         | 
| 8 | 
            -
            sciml-0.0.4.dist-info/RECORD,,
         | 
| 
            File without changes
         | 
| 
            File without changes
         |