[
https://issues.apache.org/jira/browse/MADLIB-907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15280948#comment-15280948
]
Orhan Kislal commented on MADLIB-907:
-------------------------------------
Both [~decibel] and [~riyer] mentioned implementing SRF might be more useful. I
tried a simple implementation for one of the functions. Please let me know what
you think.
CREATE or REPLACE FUNCTION mean_abs_error_srf(
table_in TEXT,
prediction_col TEXT,
observed_col TEXT,
grouping_cols TEXT
)
RETURNS SETOF RECORD AS
'
DECLARE
r RECORD;
BEGIN
FOR r IN EXECUTE
''SELECT AVG(ABS(''|| $2 ||'' - ''|| $3 ||'')) AS mean_abs_error
FROM '' || $1 || '' GROUP BY '' || $4 LOOP
RETURN NEXT r;
END LOOP;
RETURN;
END
'
LANGUAGE plpgsql;
> Prediction Metrics
> ------------------
>
> Key: MADLIB-907
> URL: https://issues.apache.org/jira/browse/MADLIB-907
> Project: Apache MADlib
> Issue Type: New Feature
> Components: Module: Utilities
> Reporter: Frank McQuillan
> Assignee: Orhan Kislal
> Fix For: v1.9.1
>
> Attachments: interface_v1.sql, interface_v3.sql
>
>
> Story
> As a data scientist, I want to compute prediction metrics on my data, so that
> I can gauge model accuracy based on predicted values vs. actual values.
> 1) The PDL Tools modules "Prediction Metrics" [1] is an example of what
> could be ported to MADlib. Source code is located at [2].
> 2) Here is functionality from PDL tools to use as a starting point:
> mf_mae
> Mean Absolute Error.
>
> mf_mape
> Mean Absolute Percentage Error.
>
> mf_mpe
> Mean Percentage Error.
>
> mf_rmse
> Root Mean Square Error.
>
> mf_r2
> R-squared.
>
> mf_adjusted_r2
> Adjusted R-squared.
>
> mf_binary_classifier
> Metrics for binary classification.
>
> mf_auc
> Area under the ROC curve (in binary classification).
>
> mf_confusion_matrix
> Confusion matrix for a multi-class classifier.
> References
> [1] PDL Tools Prediction Metrics module
> http://pivotalsoftware.github.io/PDLTools/group__grp__prediction__metrics.html
> [2] PDL tools source code
> https://github.com/pivotalsoftware/PDLTools
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)