From 0166c980800e45f21bc4374dbd69f3e68ef21e46 Mon Sep 17 00:00:00 2001 From: Sarvesh Prakash Nikumbh Date: Sun, 30 Jul 2017 22:37:51 +0200 Subject: [PATCH] Function help/comments edited. --- comik_main_with_weight_vector.m | 2 +- libsvm_plotroc.m | 9 +++++---- logMessages.m | 19 +++++++++++++++++++ mkl.py | 15 ++++++++++----- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/comik_main_with_weight_vector.m b/comik_main_with_weight_vector.m index b35da36..3151e7e 100644 --- a/comik_main_with_weight_vector.m +++ b/comik_main_with_weight_vector.m @@ -490,7 +490,7 @@ % heatmapFname = strcat(outputFolder,'/Heatmap-InstanceWeights', '_oligoLen', num2str(oligoLen), '_segmentSize', num2str(segmentSizeInBps) , '_maxDist', num2str(maxDist), '_nClusters', num2str(bestParamComb.best_nClusters), '_svmC', num2str(bestParamComb.best_C) ,'_sigma', num2str(bestParamComb.best_sigma), '.pdf'); % - p = plot_heatmap(normInstanceWeightsInEachBag, heatmapFname, 0, 1); + p = plotHeatmap(normInstanceWeightsInEachBag, heatmapFname, 0, 1); logMessages(debugMsgLocation,sprintf('done!\n'), debugLevel); % end diff --git a/libsvm_plotroc.m b/libsvm_plotroc.m index 36e0750..4d8d645 100644 --- a/libsvm_plotroc.m +++ b/libsvm_plotroc.m @@ -1,10 +1,11 @@ function [auROC auPRC] = plotroc(y,x,params) -%plotroc draws the recevier operating characteristic(ROC) curve. +% Reused and adapted from the Matlab code of LIBSVM. +% plotroc draws the recevier operating characteristic(ROC) curve. % -%auc = plotroc(training_label, training_instance [, libsvm_options -v cv_fold]) +% auc = plotroc(training_label, training_instance [, libsvm_options -v cv_fold]) % Use cross-validation on training data to get decision values and plot ROC curve. % -%auc = plotroc(testing_label, testing_instance, model) +% auc = plotroc(testing_label, testing_instance, model) % Use the given model to predict testing data and obtain decision values % for ROC % @@ -16,6 +17,7 @@ % [y,x] = libsvmread('heart_scale'); % model = svmtrain(y,x); % plotroc(y,x,model); + rand('state',0); % reset random seed if nargin < 2 help plotroc @@ -29,7 +31,6 @@ [predict_label,mse,deci] = libsvmpredict(y,x,model); % the procedure for predicting [auROC auPRC] = roc_curve(deci*model.Label(1),y); elseif exist('params') && strcmp(params, 'personal') - %disp('Personal auROC'); [auROC auPRC] = roc_curve(x, y); [prc_stack_x, prc_stack_y, prc_thre, auPRC] = perfcurve(y, x, 1, 'xCrit', 'reca', 'yCrit', 'prec'); %% This condition takes care of scenario when diff --git a/logMessages.m b/logMessages.m index 5fbfdda..f2e8181 100644 --- a/logMessages.m +++ b/logMessages.m @@ -1,5 +1,24 @@ function logMessages(fid, statement, debugLevel) +% LOGMESSAGES +% Prints out log messages for CoMIK +% +% INPUT PARAMS +% Param 'fid' +% +% +% Param 'statement' +% +% +% Param 'debugLevel' +% +% ADDITIONAL NOTES +% debugLevel 2 prints all messages +% debugLevel 1 place holder level, may be used in the future +% debugLevel 0 silent on most of the messages, prints very few messages for the user +% +% Author: snikumbh@mpi-inf.mpg.de + if debugLevel == 2 fprintf(fid, statement); %when fid is 1, this prints to command window end diff --git a/mkl.py b/mkl.py index dd4793e..6e81012 100755 --- a/mkl.py +++ b/mkl.py @@ -1,5 +1,14 @@ #!/usr/bin/env python +# This python script performs MKL for CoMIK +# +# ADDITIONAL NOTES +# We will read kernel_files from disk +# C will be a passed argument +# +# Author: snikumbh@mpi-inf.mpg.de + + #system imports from optparse import OptionParser, OptionGroup, OptionValueError import numpy, sys, os @@ -16,9 +25,6 @@ print "Refer to instructions on http://www.shogun-toolbox.org/ for installing SHOGUN with the python_modular interface." raise -# will read kernel_files from disk -# C will be a passed argument -# parser = OptionParser() @@ -54,7 +60,6 @@ trainlabels = BinaryLabels(numpy.array(trainlabels)) # assemble combined kernel - with open(options.trainkernelsListFilename, 'r') as f: kernelFilenames = [fl.rstrip() for fl in f.readlines()] @@ -67,7 +72,7 @@ else: raise OptionValueError("Cannot open %s as a file. Please check if it exists." % thisFname) -#trainkernel.set_normalizer(SqrtDiagKernelNormalizer(True)) +# trainkernel.set_normalizer(SqrtDiagKernelNormalizer(True)) # train MKL mkl = MKLClassification(LibSVM())