Skip to content

Commit

Permalink
reg metric updated
Browse files Browse the repository at this point in the history
  • Loading branch information
reneshbedre committed Feb 14, 2021
1 parent 1054de9 commit 3ce5ec7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1013,15 +1013,16 @@ Attribute | Description

### ROC plot

Receiver operating characteristic (ROC) curve for visualizing classification performance

`latest update v1.0.4`

`bioinfokit.visuz.stat.roc(fpr, tpr, c_line_style, c_line_color, c_line_width, diag_line, diag_line_style,
diag_line_width, diag_line_color, auc, shade_auc, shade_auc_color, axxlabel, axylabel, axtickfontsize,
axtickfontname, axlabelfontsize, axlabelfontname, plotlegend, legendpos, legendanchor, legendcols, legendfontsize,
legendlabelframe, legend_columnspacing, dim, show, figtype, figname, r, ylm)`

Receiver operating characteristic (ROC) curve for visualizing classification performance


Parameters | Description
------------ | -------------
`fpr` | Increasing false positive rates obtained from `sklearn.metrics.roc_curve` [list][default:None]
Expand Down Expand Up @@ -1063,6 +1064,26 @@ ROC plot image in same directory (roc.png)
<a href="https://reneshbedre.github.io/blog/logit.html#prediction-of-test-dataset-using-fitted-model" target="_blank">Working example</a>


### Regression metrics

Calculate Root Mean Square Error (RMSE), Mean squared error (MSE), Mean absolute error (MAE), and Mean absolute percent
error (MAPE) from regression fit

`latest update v1.0.8`

`bioinfokit.analys.stat.reg_metric(y, yhat, resid)`

Parameters | Description
------------ | -------------
`y` | Original values for dependent variable [numpy array] [default: None]
`yhat` | Predicted values from regression [numpy array] [default: None]
`resid` | Regression residuals [numpy array][default: None]

Returns:

Pandas dataframe with values for RMSE, MSE, MAE, and MAPE

<a href="https://www.reneshbedre.com/blog/linear-regression.html" target="_blank">Working example</a>



Expand Down
2 changes: 1 addition & 1 deletion bioinfokit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "bioinfokit"
__version__ = "1.0.7"
__version__ = "1.0.8"
__author__ = "Renesh Bedre"


3 changes: 2 additions & 1 deletion bioinfokit/analys.py
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,6 @@ def reg_metric(self, y=None, yhat=None, resid=None):
mae = np.mean(np.abs(y - yhat))
# Mean absolute percentage error (MAPE)
mape = np.mean(np.abs((y - yhat) / y))
print(rmse, mae, mse, mape)
self.reg_metric_df = pd.DataFrame({'Metrics':
['Root Mean Square Error (RMSE)', 'Mean Squared Error (MSE)', 'Mean Absolute Error (MAE)',
'Mean Absolute Percentage Error (MAPE)'], 'Value': [rmse, mse, mae, mape]}).round(4)
Expand Down Expand Up @@ -2677,6 +2676,8 @@ def __init__(self, data=None):
self.data = pd.read_csv("https://reneshbedre.github.io/assets/posts/logit/wdbc_test.csv")
elif data=='plant_richness':
self.data = pd.read_csv('https://reneshbedre.github.io/assets/posts/reg/plant_richness_data_mlr.txt', sep='\t')
elif data=='plant_richness_lr':
self.data = pd.read_csv('https://reneshbedre.github.io/assets/posts/reg/plant_richness_data_lr.txt', sep='\t')
else:
print("Error: Provide correct parameter for data\n")

Expand Down

0 comments on commit 3ce5ec7

Please sign in to comment.