Classcentroid and Roccurve: Difference between pages

From Eigenvector Research Documentation Wiki
(Difference between pages)
Jump to navigation Jump to search
imported>Jeremy
 
imported>Donal
(Created page with "===Purpose=== Calculate and display ROC curve(s) for yknown and ypred. ===Synopsis=== : roc = roccurve(yknown, ypred, options) ===Description=== ROC curves can be used to as...")
 
Line 1: Line 1:
===Purpose===
===Purpose===


Centers data to the centroid of all classes.
Calculate and display ROC curve(s) for yknown and ypred.


===Synopsis===
===Synopsis===


:[ccx,mn]      = classcentroid(x,options); %calibrate, centers the data
: roc = roccurve(yknown, ypred, options)
:[ccx,mn,pstd] = classcentroid(x,options); %calibrate, centers and scales
: ccx = classcentroid(x,mn);              %apply, centers new data
: ccx = classcentroid(x,mn,pstd);          %apply, centers and scales


===Description===
===Description===


Rows in the input data are centered to the centroid of all the classes. The centroid is equivalent to a weighted mean where each class is given the same weight. For example, if two classes A and B are present the centroid is
ROC curves can be used to assess the specificity and sensitivity for different predicted y-value thresholds, for input y known and predicted.
  mn = mean([mean(Class A); mean(Class B)]);


If only two outputs are requested, then the data is centered only. If three outputs are requested, than the data is both centered and scaled (scaling based on the pooled standard deviation of the classes). Note that samples belonging to class 0 (unknown class) are not used in calculating the centroid or pooled variance. For more details, see [[Advanced_Preprocessing:_Variable_Centering]].
Cases:
:If yknown is nx1 logical vector and ypred is nxm, then m roc curves are produced, one for each column of ypred. roc is a dataset nx(2*m), containing column-pairs of Specificity and Sensitivity for each yknown vs. ypred pairing.
:If yknown is nxm logical and ypred is nxm then m roc curves are produced, one for each pair of yknown and its corresponding ypred column. roc is a dataset nx(2*m).
:If yknown is multi-column, nxm, and ypred has a different number of columns, nxp, then an error is thrown.


====Inputs====
====Inputs====
* '''first''' = first input is this.
* '''yknown''' = nx1 logical vector, or vector of only 0's and another integer or nxm logical vector.
* '''ypred''' = nxm double array, m columns of y predictions.


* '''x''' = DataSet object to be class-centered.
====Outputs====
* '''roc''' = Output is a dataset with the specificity/sensitivity data (roc).


====Optional Inputs====
====Options====
 
* '''mn''' = Means from previous call to classcentroid. Must be passed with associated classes (see classset).
* '''pstd''' = Pooled standard deviation of the classes. e.g., pstd = mean([std(Class A).^2/MA; std(Class B).^2/MB]); where MA and MB are the number of samples in each class.


====Options====
options = a structure array with the following fields:


'''options''' = structure array with the following fields :
* '''plots''': [ {'none'} | 'final' ] governs plotting of results, and
* '''classset''' = Class set (from rows) which should be used to center data. Default is class set 1.
* '''figure''': [ 'new' | 'gui' | figure_handle ] governs location for plot. 'new' plots onto a new figure. 'gui' plots using noninteger figure handle. A figure handle specifies the figure onto which the plot should be made.
* '''offset''' = scales by pstd = pstd+offset (default = 0).
* '''plotstyle''': [ 'roc' | 'threshold' | {'all'} ] governs type of plots.
:'roc' and 'threshold' give only the specified type of
:plot. 'all' shows both types of plots on one figure (default).
:Plot style can also be specified as 1 (which gives 'roc' plots) or 2 (which gives 'threshold' plots)


====Outputs====
===Example===


* '''ccx''' = Centered x. Dataset object.
<pre>
* '''mn''' = Row vector of the centroid of the classes.
>>This is an example
* '''pstd''' = Row vector of pooled standard deviation of the classes.
Error: does not exist
</pre>


===See Also===
===See Also===
[[mncn]], [[rescale]], [[scale]], [[classcenter]]
 
[[baselinew]], [[deresolv]]

Revision as of 17:10, 2 October 2012

Purpose

Calculate and display ROC curve(s) for yknown and ypred.

Synopsis

roc = roccurve(yknown, ypred, options)

Description

ROC curves can be used to assess the specificity and sensitivity for different predicted y-value thresholds, for input y known and predicted.

Cases:

If yknown is nx1 logical vector and ypred is nxm, then m roc curves are produced, one for each column of ypred. roc is a dataset nx(2*m), containing column-pairs of Specificity and Sensitivity for each yknown vs. ypred pairing.
If yknown is nxm logical and ypred is nxm then m roc curves are produced, one for each pair of yknown and its corresponding ypred column. roc is a dataset nx(2*m).
If yknown is multi-column, nxm, and ypred has a different number of columns, nxp, then an error is thrown.

Inputs

  • first = first input is this.
  • yknown = nx1 logical vector, or vector of only 0's and another integer or nxm logical vector.
  • ypred = nxm double array, m columns of y predictions.

Outputs

  • roc = Output is a dataset with the specificity/sensitivity data (roc).

Options

options = a structure array with the following fields:

  • plots: [ {'none'} | 'final' ] governs plotting of results, and
  • figure: [ 'new' | 'gui' | figure_handle ] governs location for plot. 'new' plots onto a new figure. 'gui' plots using noninteger figure handle. A figure handle specifies the figure onto which the plot should be made.
  • plotstyle: [ 'roc' | 'threshold' | {'all'} ] governs type of plots.
'roc' and 'threshold' give only the specified type of
plot. 'all' shows both types of plots on one figure (default).
Plot style can also be specified as 1 (which gives 'roc' plots) or 2 (which gives 'threshold' plots)

Example

>>This is an example
Error: does not exist

See Also

baselinew, deresolv