matlab编写的程序输⼊参数怎么写,运⾏程序:参数如何输⼊function [results] = AntminerPlus(trainingfile, testfile, outputfile, options)
%Performs a single run of the AntMiner+ algorithm on a given training and
function怎么记忆%test set.
%
% * trainingfile: file containing the training set (and validation set in
% case of Early stop)
% * testfile: file containing the test set
% * output: detailed information is printed to this file when using
% verbose mode (-V)
% * options: options string
% -ES: (1) use early stop (1) or not (0)
% -limit: (200) maximum iterations for a single rule
% -stop: (0.01) fraction of non-majority class data
% -heuristic: (K) specifies the rule evaluation function
% 'K',F','M','RCM','A+' or 'SS'
% -heuristicParameter: specifies the parameter used in the rule
% evaluation function (0.44 - 0.28 - 7 - 0.028 resp.)
% -ants: (1000) number of ants
% -rho: (0.85) evaporation factor in pheromone update
% -p: (0.1) MAX-MIN AS parameter
% -epsilon: (0.05) sensitivity of the convergence check
% -disc: ('fay') the discretization method - 'kon','efb,'eib','fay'
% -bins: (10) the number of bins in 'efb' or 'eib' discretization
% -AS: (0) use attribute selection (1) or not (0)
% -ASmethod: (rel) attribute selection method. 'cfs','con', 'chi',
% 'svm', 'gai', 'inf','1R', 'rel', 'sym'
% -ASnumAttr: (10) specify number of attributes to select
% -s: (time) the seed of the random number generator
% -V: (0) verbose mode: print data to 'output' (1) or not (0)
%Returns: results Contains several fields with key statistics
% results.accuracy test set accuracy
% results.rules number of rules
% s number of terms per rule
% results.time runtime of the algorithm
%WARNING: due the a rounding error in the output, the seed in the output
%file does not match that used by the random number generator. If
%recreating an experiment is required, always specify the seed.
%Written by Bart Minnaert
%parse the 'options' string
parse_options
RandStream.setDefaultStream(RandStream('mt19937ar','seed',seed));
import java.util.Random;
import java.lang.System;
gen = Random(seed);
% Read the dataset
Instances;
shufflefile = testfile;
read_data %reads 'shufflefile' and returns 'wekadata' - also gathers metadata
testset = wekadata;
shufflefile = trainingfile;
read_data
trainingset = wekadata;
if Estop == 0 %do not use early stop => no validation set
validationset = trainingset; %validationset can't be empty in next steps - explicitly declare it empty at the end of preprocessing
else %early stop: use a validation set
validationset = stCV(3,0); %take one third of the training set for validation - note that this is not randomized!
trainingset = ainCV(3,0); %this reduces the training set however.
end
trainingPointsStart = trainingset.numInstances(); %number of training data at the start of the algorithm
nbTraining = trainingPointsStart;
nbValidation = validationset.numInstances();
nbTest = testset.numInstances();
if Estop == 0
nbValidation = 0;
end
nbDatapoints = nbTraining+nbValidation+nbTest;
nbDatapointsStart = nbDatapoints;
% Preprocessing and removal of majority class
modifydata
% After modifydata, the data is no longer in the weka-format % Initialize the search
init_measurements
% Run the AntMiner+ algorithm
timestart = tic; %measure runtime
AntminerCore
runtime = toc(timestart);
% Save raw output
testAccuracy = finalAccuracy;
fname = outputfile;
%print the parameters, measurements and the ruleset to a file if(verbose)
save_raw_output
end
fclose('all');
stats = [finalAccuracy,nbRules,avgRL,runtime];
results.accuracy = finalAccuracy;
results.rules = nbRules;
results.time = runtime;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论