示例#1
0
import similarity
import display
import grouping
import tradingmeasure
import parameters as para
import util
import constants as const

#testOutputFilename = 'testresults.txt'
testOutputFilename = 'testresults_test.txt'
#testOutputFilename = 'results_confidenceSellOrKeep_fyh_nocond_byFirst.txt'

# test all algos
algosToTest = {
    'acf': similarity.tsdist('acfDistance'),
    'ar.lpc.ceps': similarity.tsdist('ar.lpc.cepsDistance'),
    #'ar.mah': similarity.tsdist('ar.mahDistance'), #Need to retrieve p-value
    'ar.pic': similarity.tsdist('ar.picDistance'),
    'ccor': similarity.tsdist('ccorDistance'),
    #'cdm': similarity.tsdist('cdmDistance'), # (USE) SLOW / INTERNAL ERROR 5 IN MEMCOMPRESS...?
    'cid': similarity.tsdist('cidDistance'),
    'cor': similarity.tsdist('corDistance'),
    'cort': similarity.tsdist('cortDistance'),
    'dissimapprox': similarity.tsdist('dissimapproxDistance'),
    'dissim': similarity.tsdist('dissimDistance'),
    'dtw': similarity.tsdist('dtwDistance'),
    'edr_005': similarity.tsdist('edrDistance', 0.05),
    'edr_01': similarity.tsdist('edrDistance', 0.1),
    'edr_025': similarity.tsdist('edrDistance', 0.25),
    'edr_05': similarity.tsdist('edrDistance', 0.5),
    'erp_01': similarity.tsdist('erpDistance', 0.1),
import grouping
import tradingmeasure
import pyswarm
import dataselect
import util
import constants as const

# We try to find the optimal linear combination of these parameters.
# Edit this list to configure the parameters to use.
# Make sure that these parameters have been defined by parameters.readFile() first.
parametersToOptimise = ['Close', 'RatioClose', 'AvgClose', 'DiffCloseSign', 'RunningRatio']

# Test multiple algorithms
# The average score of the algorithms is used as the objective function.
algosToTest = {
    'sts': similarity.tsdist('stsDistance'),
    'inf.norm': similarity.tsdist('inf.normDistance'),
    'cort': similarity.tsdist('cortDistance'),
    'lcss_05': similarity.tsdist('lcssDistance', 0.05),
    'minkowski_25': similarity.lpNorms(2.5), #otherwise known as lp-norms
    'minkowski_30': similarity.lpNorms(3),
    'lbKeogh_3': similarity.tsdist('lb.keoghDistance', 3),
    'dtw': similarity.tsdist('dtwDistance'),
    'euclidean': similarity.tsdist('euclideanDistance'),
    'fourier': similarity.tsdist('fourierDistance'),
    'dissim': similarity.tsdist('dissimDistance'),
}

# Test only sts (overwrites the previous algosToTest if not commented out)
algosToTest = {
    'sts': similarity.tsdist('stsDistance'),