Home > SuperSegger > trainingConstants > lassoScore.m

lassoScore

PURPOSE ^

calculateLassoScores : calculates scores as A_1 + A_i*X_i + A_ij * X_i * X_j

SYNOPSIS ^

function [rawScores] = lassoScore (X,coefficients)

DESCRIPTION ^

 calculateLassoScores : calculates scores as A_1 + A_i*X_i + A_ij * X_i * X_j

 INPUT :
       X : properties of regions or segments used for score calculation
       A : coefficients as calculated by lasso regularized regression for
       the score function above
 OUPUT :
    rawScores : are calculate from the probabilities 0-1 converted to -50
    to 50. rawScores < 0 have score 0 (bad segment/region) and rawScores > 0
    have score 1 (good segment/regin)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [rawScores] = lassoScore (X,coefficients)
0002 % calculateLassoScores : calculates scores as A_1 + A_i*X_i + A_ij * X_i * X_j
0003 %
0004 % INPUT :
0005 %       X : properties of regions or segments used for score calculation
0006 %       A : coefficients as calculated by lasso regularized regression for
0007 %       the score function above
0008 % OUPUT :
0009 %    rawScores : are calculate from the probabilities 0-1 converted to -50
0010 %    to 50. rawScores < 0 have score 0 (bad segment/region) and rawScores > 0
0011 %    have score 1 (good segment/regin)
0012 
0013 
0014 linear = false;
0015 
0016 if linear
0017     alldataX = [X];
0018 else % calculates quadratic relationships, keeps unique relationships only
0019     quadraticX = repmat(X,1,size(X,2)).*repelem(X,1,size(X,2));
0020     numD = size(X,2);
0021     indicesToStay = find(tril(ones(numD,numD)));
0022     quadraticX = quadraticX(:,indicesToStay);
0023     % adds linear and quadratic in one vector
0024     alldataX = [X, quadraticX];
0025 end
0026 
0027 % calculates scores (rawScores - from 0 to 1). scores are rounded rawScores
0028 rawScores = glmval(coefficients,alldataX,'logit');
0029 rawScores(isnan(rawScores)) = 0;
0030 rawScores = (rawScores - .5) * 100;
0031 
0032 end

Generated on Thu 19-Jan-2017 13:55:21 by m2html © 2005